=== TraceWise Status & Monitoring ===
Contributors: razorsoftinc
Tags: status, uptime, incidents, blocks
Requires at least: 6.7
Tested up to: 7.1
Stable tag: 1.1.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show public TraceWise status pages in WordPress, and manage monitors with an API key that stays on the server.

== Description ==

TraceWise Status & Monitoring embeds public [TraceWise](https://www.tracewise.dev/) status pages in WordPress. TraceWise is an external service operated by RazorSoft, Inc. A workspace can publish more than one public status page, subject to the TraceWise plan. Public widgets do not use an API key.

Administrators can connect a TraceWise API key under TraceWise → Connection. The key is encrypted in WordPress and is used only for server-side requests to the TraceWise REST API. It is not added to pages, blocks, JavaScript, or REST responses. The connection is optional. Existing status widgets keep working without it.

TraceWise subscription limits still apply. Those limits include how many monitors a workspace can create, the shortest check interval, and the API rate limit. This plugin does not change TraceWise prices or plan limits.

Visitors load `https://www.tracewise.dev/embed/status.js` once on a page that contains a widget. That script fetches the published status page for that widget from TraceWise. WordPress stores the default slug and display defaults only. It does not store a separate setting for every status page.

Open TraceWise → Public Status Widgets and save the default status-page slug. Widgets that do not specify another slug use that page. Each block and shortcode can use a different public status-page slug. If you do not have a public status page yet, create a TraceWise account and enable one under Dashboard → Settings → Status page.

The TraceWise menu contains:

* Overview
* Monitors
* Public Status Widgets
* Connection

In the block editor, insert any of these blocks:

* TraceWise Status Badge
* TraceWise Status Indicator
* TraceWise Status Card
* TraceWise Uptime History
* TraceWise Incident List

Each block can set its own public status-page slug, theme, and refresh interval. Leave the slug blank to use the default status page. The indicator can hide its label. The badge, indicator, card, and history bar can show uptime. History accepts 7, 30, or 90 days. The incident list accepts 5, 10, or 20 incidents and can hide resolved incidents. Refresh is a number of seconds. Leave it empty to use the setting, use 0 to load once, and use at least 60 to poll.

The shortcodes are `[tracewise_status]`, `[tracewise_indicator]`, `[tracewise_card]`, `[tracewise_history]`, and `[tracewise_incidents]`.

Attributes use the same names: `slug`, `theme`, `show_uptime`, `show_label`, `period`, `limit`, `show_resolved`, and `refresh`. Leave `slug` off to use the default status page. Set `slug` to show a different public status page. Blocks and shortcodes share one renderer.

The script is enqueued only when a widget is rendered, including several widgets on one page. The block editor also loads it so the preview can run. The plugin does not accept a custom API URL.

`auto` follows the visitor's color scheme. `light` and `dark` set the status colors. Add CSS variables such as `--tw-status-operational` and `--tw-status-surface` on a parent to match a theme. See the [component documentation](https://www.tracewise.dev/docs/components).

A read-only key can view monitors. Create, edit, and delete stay hidden until TraceWise confirms `monitors:write`. Manual checks stay hidden until TraceWise confirms `checks:run`. TraceWise does not provide a scope list, so the plugin learns those two scopes from responses that do not create a monitor or run a check.

= External service and privacy =

TraceWise Status & Monitoring contacts `https://www.tracewise.dev`, an external service:

* Public widgets send the status-page slug to the hosted embed in the visitor's browser. The embed then requests the published status page. No API key is included. Visitors of a page that contains a widget also receive the embed script from TraceWise.
* Authenticated monitoring sends the API key from the WordPress server to `https://www.tracewise.dev/api/v1`. The browser does not receive the key. Responses used on the admin screens are cached briefly in WordPress.
* The plugin stores the public widget settings and the encrypted API key in WordPress options. It does not send WordPress user accounts, comments, or post content to TraceWise.
* Uninstall deletes the plugin settings, the encrypted key, and cached monitor views. It does not delete WordPress content and it does not delete the TraceWise account.
* Terms of Service: https://www.tracewise.dev/terms
* Privacy Policy: https://www.tracewise.dev/privacy

= Translations =

The text domain is `tracewise-status-monitoring`. That is the slug WordPress.org generates from the display name. PHP, block metadata, and the block editor scripts use that domain. WordPress 6.7 loads translations just in time. The plugin directory, option names, block names, and shortcodes stay `tracewise-status` so existing sites keep working. The plugin does not ship translation files.

== Installation ==

1. Upload the `tracewise-status` folder to `/wp-content/plugins/`, or install `tracewise-status-monitoring-1.1.0.zip` through Plugins → Add New → Upload Plugin. The zip contains `tracewise-status/tracewise-status.php`.
2. Activate TraceWise Status & Monitoring on the Plugins screen. Updating from 1.0.0 keeps the same plugin, the saved settings, and the stored API key.
3. Open TraceWise → Public Status Widgets and save the default status-page slug. Widgets that leave the slug blank use that page. A block or shortcode can name another public status page.
4. Edit a page, insert a TraceWise Status block, or add a shortcode such as `[tracewise_status]`.
5. Optional: open TraceWise → Connection and paste an API key to view or manage monitors.

No Docker, Node.js, or Composer is required on the WordPress site. The block editor source is included in `src/`. Node.js and `npm run build` are only needed to rebuild the files in `build/`.

WordPress.com sites need a plan that allows uploaded plugins, such as Business or Commerce. The plugin uses the WordPress options and HTTP APIs. It does not create custom database tables.

== Frequently Asked Questions ==

= Does this plugin need a TraceWise API key? =

Public widgets do not. Badges, indicators, cards, uptime history, and incident lists read a published status page.

Monitor management does. Create a key in TraceWise with `monitors:read`, `incidents:read`, `monitors:write`, and `checks:run`. Paste it under TraceWise → Connection. WordPress stores it encrypted and does not show it again. Disconnect removes it. The public widgets do not change.

= What if the key can only read monitors? =

A key without `monitors:write` can still open the monitor list. Add, edit, and delete are hidden, and the screen explains the missing scope. A key without `checks:run` does not show Check now. Test the connection again after you add a scope in TraceWise. The plugin does not treat a successful monitor list as permission to change monitors.

= What if I do not have a public status page? =

Create an account at https://www.tracewise.dev/sign-up and enable a public status page in TraceWise. The settings screen links there. Paste that page's slug as the default. The public `demo` slug can be used to preview the widgets.

= Do TraceWise plan limits still apply? =

Yes. TraceWise enforces monitor caps, minimum check intervals, duplicate URLs, and API rate limits. This plugin shows those errors. It does not raise the limits or change subscription prices.

= Which theme values work? =

`auto`, `light`, and `dark`. The settings screen chooses the default. A block or shortcode can override it. Unknown values fall back to the default.

= Why does a page load the script only sometimes? =

The embed script is registered when a TraceWise block or shortcode is rendered. A page with no widget does not load it. Several widgets still load it once.

= Do page builders work? =

Gutenberg and the Site Editor use the blocks. The Classic Editor, a Text widget, and builders that process shortcodes, including the Elementor Shortcode widget, use the shortcodes. A Custom HTML block does not run shortcodes. Paste a shortcode into a Shortcode or Text element instead. Builders that store content as blocks keep the TraceWise blocks.

= How do I match my theme? =

Choose Auto, Light, or Dark. For brand colors, add the `--tw-status-*` variables in Additional CSS or the theme stylesheet. The widgets use normal document flow and shrink to the content width.

= Can one site show more than one status page? =

Yes. TraceWise supports multiple public status pages per workspace, subject to plan limits. Save the default slug under TraceWise → Public Status Widgets. Leave a block or shortcode slug blank to use that default, or set `slug` to a different public status page. This plugin does not add a WordPress setting for every status page. Each widget still loads the hosted embed script once per page.

= What data is sent to TraceWise? =

Public pages send the status-page slug through the hosted embed and then fetch the published status data. Connected admin screens send the API key from the server to the TraceWise API. The key is not placed in page HTML or browser JavaScript. See the privacy notes in the description and https://www.tracewise.dev/privacy.

= What is deleted on uninstall? =

Uninstall deletes the public widget settings, the encrypted API key, and cached monitor views. It does not delete WordPress posts or pages, and it does not change the TraceWise account. Deactivation leaves the settings and the key in place.

= Does an update keep my settings? =

Yes. Version 1.1.0 uses the same plugin file, options, blocks, and shortcodes as 1.0.0. The translation text domain is `tracewise-status-monitoring`. An existing API key is read and then stored again with authenticated encryption. You do not need to paste the key again unless WordPress can no longer decrypt it.

= Where are the screenshots? =

The install zip does not include screenshot files. WordPress.org keeps them in the directory assets folder, outside the plugin:

1. screenshot-1.png — TraceWise → Public Status Widgets with the default status page slug, theme, refresh interval, uptime period, and optional link.
2. screenshot-2.png — The block inserter showing the five TraceWise blocks.
3. screenshot-3.png — A Status Badge block with its sidebar settings and editor preview.
4. screenshot-4.png — A published page with the badge, indicator, card, uptime history, and incident list.
5. screenshot-5.png — The same page with the Dark theme selected.
6. screenshot-6.png — TraceWise → Connection with the scope list and a stored key ending in four characters.
7. screenshot-7.png — TraceWise → Monitors for a read-only key, with create, edit, delete, and manual checks hidden.

= Who is the WordPress.org contributor? =

The WordPress.org contributor username is razorsoftinc.

== Screenshots ==

1. TraceWise → Public Status Widgets, with the default status page slug, theme, refresh interval, uptime period, and optional link.
2. The five TraceWise blocks in the inserter.
3. Status Badge settings and editor preview.
4. A page showing the badge, indicator, card, uptime history, and incident list.
5. The same page in the dark theme.
6. TraceWise → Connection, with the required scopes and the stored key hint.
7. TraceWise → Monitors when the key cannot change monitors or run checks.

== Changelog ==

= 1.1.0 =
* Show the plugin as TraceWise Status & Monitoring. The text domain is tracewise-status-monitoring. The install path, options, blocks, and shortcodes stay tracewise-status.
* Encrypt API keys with AES-256-GCM. Keys stored by 1.0.0 keep working and are rewritten on the next read.
* Hide create, edit, and delete when TraceWise says the key lacks monitors:write. Hide manual checks when it lacks checks:run.
* Document the external TraceWise service, public status requests, and the server-side API key.
* Describe the saved slug as the default status page. Blocks and shortcodes can name another public status page.
* Name the install archive tracewise-status-monitoring-1.1.0.zip. The plugin directory inside it remains tracewise-status.

= 1.0.0 =
* Add TraceWise → Public Status Widgets for the public slug, theme, refresh interval, uptime period, and optional status page link.
* Add five blocks and five shortcodes that render through the public TraceWise embed. Each one can target a different public status page, and a page loads the embed script once.
* Add a TraceWise menu for public widgets, connection, monitor health, uptime, incidents, diagnostics, and monitor create, edit, check, and delete.
* Add a WordPress Dashboard widget for administrators.
* Store the API key encrypted on the server. Public widgets remain usable without a key.

== Upgrade Notice ==

= 1.1.0 =
The display name is TraceWise Status & Monitoring. Translations use the text domain tracewise-status-monitoring. Existing settings, blocks, shortcodes, and the stored API key remain in place.

= 1.0.0 =
Show a public TraceWise status page with blocks or shortcodes. No API key is required.
