=== Zephena ===
Contributors: zephena
Tags: chatbot, ai, faq, structured data, leads
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect your site to your Zephena AI business agent: chat widget plus server-rendered FAQ, structured data, and llms.txt.

== Description ==

Zephena gives your business an AI agent that answers visitors' questions, captures leads, and publishes your approved FAQ content where search engines and AI answer engines can read it.

This plugin is a thin connector for the Zephena hosted service (https://zephena.com). It does three things:

* **Places your chat widget** on your pages (with per-page exclusions).
* **Server-renders your findability content** — the approved FAQ block, FAQPage/LocalBusiness structured data, and /llms.txt — into your pages' raw HTML, so crawlers see it without executing JavaScript.
* **Reports status** — connection and plan — with links into your Zephena dashboard on zephena.com, where all management (agents, content approval, leads, billing) lives.
* **Can show your dashboard inside WordPress** — on the plugin downloaded from zephena.com, the Zephena menu can open your real Zephena dashboard inside your admin, in a sandboxed frame that loads only when you click and after you sign in to Zephena as yourself.

The plugin has no tiers and no plan logic: what your account can do is decided by the Zephena service. It plays nicely with cache plugins (LiteSpeed Cache, WP Rocket, W3 Total Cache are detected and purged automatically when your published content changes).

== External services ==

This plugin relies on the Zephena hosted service. Once you connect, it contacts the Zephena gateway (gw.zephena.ai) to verify your embed key and fetch your approved, public FAQ content — about twice a day in the background, and again each time you open a Zephena page in your WordPress admin, so a key that was disconnected from your Zephena dashboard is noticed at once. The only data sent is your embed key, your findability key, and your site URL (as the HTTP user agent) — no visitor data, no admin data, and no site content is ever transmitted.

Before you connect — before you paste your embed key and click Connect — the plugin makes no request to Zephena and loads nothing from it, with one exception on this build: it asks Zephena's update server for plugin updates (about twice a day, through WordPress's normal update screen); that request carries only the plugin version and your site URL, and update packages are checksum-verified before installation.

The chat widget itself is loaded by your visitors' browsers from Zephena's CDN, on the pages where you chose to place it.

The embedded dashboard under the Zephena admin menu (this build only) is Zephena's own site (zephena.com) shown in a sandboxed frame; it loads only when you click "Open dashboard here" and after you sign in there as yourself, and nothing about your WordPress login is sent to it.

Disconnecting stops every request. All of this is under Zephena's terms and privacy policy:

* Terms: https://zephena.com/terms
* Privacy: https://zephena.com/privacy

== Installation ==

1. Install and activate the plugin.
2. In your Zephena dashboard, open My agents → your agent → Embed on your website, and copy the embed key (pk_…).
3. In WordPress, open the Zephena menu in the admin sidebar, paste the key, and click Connect.
4. Choose where the FAQ block renders and enable llms.txt — done.

== Frequently Asked Questions ==

= Do I need a paid Zephena plan? =
An account, yes; the plugin itself works with every plan. What each plan includes is decided by the service — the plugin simply reflects it.

= Where do I manage my agent and content? =
In your Zephena dashboard. The plugin's status card links you straight there. Nothing is managed in WordPress.

= Can I see my dashboard inside WordPress? =
On the plugin downloaded from zephena.com, yes: the Zephena menu opens your dashboard in a sandboxed frame, only when you click "Open dashboard here" and after you sign in to Zephena as yourself. Billing and organization settings always open in a full tab.

= Does the widget show a "Powered by" badge? =
Depending on your plan, the chat widget may display a small "Powered by Zephena" badge. You consent to this explicitly when connecting the plugin; it is shown by default, and white-label plans can switch it off per agent in the Zephena dashboard.

= How do updates work? =
Like any plugin: WordPress shows "update available" under Plugins and installs it in one click. The plugin checks Zephena's update server about twice a day; the Zephena Settings screen shows the last check and has a "Check for updates now" button. If you installed 0.x by uploading a zip, install the current version by zip once, and every later version updates in place.

== Changelog ==

= 1.2.0 =
* The embedded dashboard now opens only when you ask: the Zephena menu shows a card with an "Open dashboard here" button and nothing loads before you click it (a tab where you already signed in opens it straight away). The frame is sandboxed, and a slow or blocked frame now says so, with Retry and a full-tab link, instead of looking stuck.
* Before you connect, the plugin makes no request to Zephena and loads nothing from it (the update check is the one exception on this build), and the Settings screen has a direct "Open your Zephena dashboard" link.

= 1.1.13 =
* Documentation only: the External services section now says the embed key is also verified each time you open a Zephena admin page (added in 1.1.11). No code change.

= 1.1.12 =
* The Settings screen no longer displays the embed key. The plugin verifies it on every visit, so there is nothing to compare by hand, and one fewer place shows it.

= 1.1.11 =
* Every Zephena admin page now re-checks the embed key on every visit (1.1.10 waited five minutes between checks). A key disconnected or re-keyed from the dashboard is treated as revoked the moment you open the plugin — the only pause is one minute after Zephena could not be reached, so an outage never turns every click into a wait.

= 1.1.10 =
* The plugin now notices a revoked embed key on its own: opening any Zephena admin page re-checks the key when the last check is older than five minutes, so a site disconnected or re-keyed from the dashboard shows the Reconnect screen within minutes instead of at the next twice-daily check-in. The Settings screen also shows the embed key the site holds, so it can be compared with the dashboard's.

= 1.1.9 =
* When Zephena stops recognizing this site's embed key (you disconnected or re-keyed it from the dashboard), the plugin now says so: the Zephena menu shrinks to Reconnect and Settings, the Settings screen explains what happened and offers the key field again, and the chat widget is no longer placed until a new key connects. Before, the screen kept saying "Connected" with nowhere to enter the new key.

= 1.1.8 =
* Housekeeping for the WordPress plugin directory review: every file, class and function now carries standard documentation, the class files follow the WordPress naming convention, and the whole plugin passes the WordPress coding standards with no exceptions beyond one documented line. No behavior change.

= 1.1.7 =
* Every value the plugin reads from a request is sanitized at the point it is read, and every value it prints is escaped at the point it is printed — including the FAQ and business structured data, which is now validated as JSON before it reaches your page. No behavior change; this is the housekeeping the WordPress plugin directory review asked for.

= 1.1.6 =
* An update announces itself: after installing a new version the plugin checks in with Zephena within seconds, so your dashboard's "On your site" page shows the new version right away instead of after the next twice-daily check-in or a manual "Refresh now". Works for one-click updates, uploaded zips, and directory updates alike.

= 1.1.5 =
* Published content now goes dark honestly: when Zephena stops serving this site's FAQ bundle for any reason (a plan change, a retired key, or two days without a successful refresh), the FAQ block, JSON-LD and llms.txt stop rendering and your page cache is purged — nothing stale lingers for crawlers. Deactivating or uninstalling purges too.
* Your Zephena guide now sits in the corner of the Zephena admin pages, the same bubble as on the dashboard, once you have signed in through the Dashboard menu. Links it offers take you straight to that Zephena menu page.
* The embedded dashboard keeps the WordPress page in step: when a link inside the frame moves to another section (the guide's "click My Agents", say), the page title, the Zephena menu highlight, the address bar and the "Open full dashboard" link follow — no reload.
* A public read-only route (/wp-json/zephena/v1/site) echoes this site's embed key so Zephena can confirm the site before recording it as connected. The key is already in your page source; nothing else is disclosed.
* The weekly lead count is no longer sent to the settings card — see it in your Zephena dashboard, where you are signed in.

= 1.1.4 =
* Settings now explain why a change you just made in Zephena is not on your site yet — this site pulls approved changes within 12 hours, and "Refresh now" fetches them immediately and purges your page cache in one step.

= 1.1.3 =
* The plugin now has its own page at https://zephena.com/wordpress-plugin, with what it does, what it deliberately does not do, and how to install it.

= 1.1.2 =
* Fixed: WordPress now offers "Enable auto-updates" for Zephena on the Plugins screen. The plugin only told WordPress about itself when WordPress happened to rewrite its update list, so the control could be missing for hours after installing.
* Housekeeping for the WordPress plugin directory: every settings action verifies its nonce inline, the widget tag is printed through core's script-tag printer, and file deletion goes through core's helper.

= 1.1.0 =
* Updates now install in place through WordPress's normal update screen, instead of by uploading a zip. Tested up to WordPress 7.1.

= 0.2.0 =
* Embedded dashboard: the Zephena menu now opens your real Zephena dashboard inside WordPress admin, scoped to the connected business. You sign in to Zephena as yourself (a WordPress login never grants Zephena access); billing and organization settings always open in a full tab. Settings moved to Zephena → Settings.

= 0.1.0 =
* Initial release: connect flow, widget placement with exclusions, FAQ block shortcode + auto-append with matching structured data, LocalBusiness head toggle, /llms.txt route, cache-plugin purge citizenship, status card with dashboard deep links.
