=== Waveform License Manager ===
Contributors: alexnasla
Tags: license keys, software licensing, woocommerce, activation, digital downloads
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.3.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

License keys for software you sell. Manage keys, devices and releases in wp-admin; with WooCommerce, keys issue on purchase and revoke on refund.

== Description ==

Waveform License Manager connects a WooCommerce store to the Waveform License Manager service. Every order for a licensed product gets a license key, emailed to the buyer and shown on their My Account page. A refund or cancellation revokes exactly the units it covers. Your software checks the key online or offline through the Waveform SDK or the JUCE kit.

* **Licenses** in wp-admin: search, view devices, release a device, grant an extra activation, revoke.
* **Order dual-write**: completed, refunded and canceled orders are mirrored to the service in the background (Action Scheduler), so checkout is never slowed down.
* **License seats on the order screen**: before you refund, see which devices still hold a seat and release them with a recorded reason.
* **My Account "Licenses" tab**: buyers see their keys and devices and can deactivate a device themselves.
* **Products, NFR keys, branding and integration** pages, all driven by one per-store API key.
* WooCommerce Subscriptions: one key per subscription, extended on every renewal instead of a new key each billing period.
* Works with HPOS (custom order tables) and the legacy order storage.

WooCommerce is optional. Without it, the plugin is a wp-admin console for your Waveform account: licenses, devices, products, code pools, releases, NFR keys, blocked customers and email branding all work, and your software activates against the API as usual. With WooCommerce active, orders issue and revoke keys automatically, the order screen shows license seats, and buyers get the My Account "Licenses" tab.

The plugin needs a Waveform License Manager account. There is a free plan. See https://waveformanager.com/ for plans.

== External services ==

This plugin is a client for the Waveform License Manager API, run by Waveform Inc. at https://api.waveformanager.com (the URL can be changed in Settings or with the `WAVEFORM_API_URL` constant). It does nothing until you save an API key in **Waveform → Settings**. After that it sends:

* **When an order is completed, refunded or canceled** (only if Order dual-write is on): the order and line-item ids, each licensed product's Waveform product id and name, the buyer's email and first name, and a reference to the buyer's WordPress user, so the service can issue or revoke license keys and email the buyer. For WooCommerce Subscriptions it also sends the subscription id and the next payment date.
* **When a buyer opens My Account → Licenses** (only if the buyer portal is on): the buyer's customer reference, to list their keys; and the device id when they deactivate a device.
* **When you use the Waveform admin pages**: the searches and actions you take there (license key, device id, the reason you type).
* **When WordPress runs a personal-data export or erasure**: the buyer's email, so their license data is included or removed.

Terms of service: https://waveformanager.com/terms/
Privacy policy: https://waveformanager.com/privacy/

== Installation ==

1. Install this plugin from **Plugins → Add New**, or upload the zip, and activate it.
2. Open **Waveform → Settings**, paste the API key from your Waveform License Manager account and click **Test connection**.
3. To issue keys on purchase, install and activate WooCommerce, map your products on **Waveform → Products**, then switch on **Order dual-write** and the **Buyer "Licenses" portal**.

== Frequently Asked Questions ==

= Do I need WooCommerce? =

No. Without WooCommerce you manage licenses, devices, products, releases and NFR keys from wp-admin, and administrators use the Waveform menu. Keys issued on purchase, refunds revoking keys, the order screen's seats box and the My Account tab need WooCommerce; switch it on at any time and they start, using the settings you already saved.

= Does it work without an account? =

No. The keys are issued and verified by the Waveform License Manager service, so the plugin needs an API key from an account. There is a free plan.

= What happens if the service is unreachable? =

Checkout is never blocked. Order events are queued and retried with Action Scheduler, and the admin screens show a one-line notice instead of failing.

= I already issue keys with another licensing plugin. =

Existing keys can be adopted, so buyers keep the key they already have. The `waveform_adopt_license_key` filter lets you plug in any previous system.

== Screenshots ==

1. Releases: see which version every device is running, and publish a release so customers on older builds see an update notice.
2. The dashboard: licenses issued over time, your licensed products and recent activity.

== Changelog ==

= 1.3.3 =
* A new install now guides you instead of showing errors. Until a merchant key is saved, every Waveform page says the site is not connected yet and links to Settings, and Settings explains where to get the key.
* Failures are described in plain words (key not accepted, service not reachable) instead of internal codes, and a Licenses list that cannot load no longer looks like an empty list.
* Page headings are just the page name.
* Issue NFR license offers to create a customer account only when WooCommerce is active.

= 1.3.2 =
* Scripts and styles are now enqueued through WordPress from files in the plugin's assets folder, instead of being printed inline.
* Form input on the admin pages is sanitized where it is read, and a release reason is sanitized rather than only trimmed.
* The notices about an earlier version of the plugin appear only on the Plugins screen and on this plugin's own pages.

= 1.3.1 =
* No change in behavior. Clears the last WordPress Plugin Check findings, so the plugin passes with no errors and no warnings.

= 1.3.0 =
* One-time orders now email the buyer their license key. One email per order carries the key for every unit, so a guest buyer gets their key too. Nothing is sent while migration mode is on, because your previous plugin has already emailed its own key. The `waveform_send_order_license_email` filter turns it off per order.
* A subscription payment emails every unit's key in one message. A renewal of licenses that already exist stays silent, as before.
* Codes that were waiting on an empty code pool are emailed to the waiting customers when you upload more, and the Code Pools notice says how many are being emailed.
* A refund now names the units it took, so a partial refund never takes a unit the buyer kept. Queued key emails and mints skip units that were refunded and orders that were refunded or canceled in the meantime.
* Very large orders and subscriptions are split across several queued jobs, so none is dropped for being too big; a very large order can therefore produce more than one email.
* The store name in these emails is no longer shown HTML-encoded.

= 1.2.0 =
* WooCommerce is optional. The plugin activates and runs without it; order dual-write, the order screen's seats box and the My Account tab load only while WooCommerce is active, and their settings are kept for when it is.
* Without WooCommerce, the Waveform menu is for administrators (WooCommerce's shop manager capability does not exist there), and the Waveform pages say what waits for WooCommerce.
* Error messages from the API are logged as written, without HTML escaping.

= 1.1.0 =
* The dashboard shows your plan's license usage, and a notice when a plan with a firm license limit is close to it, at it, or has paid orders waiting for keys.
* Each order's licenses are sent with the order number, the store name and the store's email address, so the buyer's "key on the way" and license emails name the order and come from the store.

= 1.0.0 =
* First public release, licensed GPLv2 or later.
* Order screen: the License seats box is redesigned for the narrow side column. Each license shows its status, key, seat policy and support budget; each device is its own card with the release reason, Override budget and Release laid out on aligned rows.
* The "Customer must deactivate first" and "Ready to refund" messages are full-bordered callouts.
* Log lines go to WooCommerce → Status → Logs (source "waveform-license-manager") instead of PHP's error log.

= 0.7.1 =
* Takes over from the plugin's earlier name ("Waveform Licensing for WooCommerce"): activating it deactivates the old copy and carries its settings across, and it no longer loads alongside the old copy.

= 0.7.0 =
* Issue NFR links the key to a WordPress user found or created for the email, so the recipient can sign in and see it.

= 0.6.1 =
* A partial refund sends its refund id, so a retried refund is applied once.

= 0.6.0 and earlier =
* Pre-release builds.
