=== askVela – Live Chat & AI Support ===
Contributors: askvela
Tags: live chat, chatbot, ai, customer support, woocommerce
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.2
Stable tag: 1.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add the askVela live chat & AI support widget to WordPress and WooCommerce. For WooCommerce it also provides a secure order lookup so the AI can answer order questions.

== Description ==

askVela is an AI-powered live chat and customer support service for online shops. This plugin embeds the askVela chat widget on your WordPress or WooCommerce site and – on WooCommerce – exposes a secure, signed endpoint so the askVela assistant can answer questions about a customer's orders.

You need an askVela account (workspace), which you can create at https://askvela.pro. The easiest setup is **one-click connect**: under **Settings → askVela** click "Connect with askVela", confirm in your askVela account, and the Widget Key (and, for WooCommerce, the order lookup) are configured automatically. You can also enter the Widget Key manually.

= What you get =

* **AI & live chat widget** on all pages (including WooCommerce product, cart and checkout pages).
* **Order lookup for WooCommerce (built in):** the plugin publishes a secure REST endpoint that the askVela assistant can call (HMAC-SHA256 signed) to retrieve a customer's orders and basic customer details by email. No coding required.
* **Privacy by design:** the lookup endpoint only answers requests that carry a valid signature created with your shared secret. Without the secret, no data is returned.
* **HPOS compatible:** orders are read through the official WooCommerce CRUD API, so it works with both the classic and the High-Performance Order Storage.

= How the order lookup works =

1. The plugin generates a secret automatically and shows you a **Lookup URL** and a **Secret** under Settings → askVela.
2. You paste both values into your askVela dashboard (Settings → "Lookup URL of your shop" and "Signature secret").
3. When a known customer asks about an order, askVela calls your Lookup URL with the customer's email and the signature. The plugin verifies the signature and returns the matching orders.

Full guide: https://askvela.pro/wordpress

== External services ==

This plugin connects to askVela, a third-party SaaS service operated by askVela, to provide the chat widget and (optionally) the order lookup. By installing and configuring this plugin you choose to use that service.

1. **askVela widget loader (frontend).** When you set a Widget Key, the plugin loads the widget script from `https://askvela.pro/widget.js` on your site's frontend. Through the widget, chat messages, the current page URL, and any name/email a visitor enters are sent to askVela so the assistant can respond. The Widget Key (which identifies your workspace) is included.

2. **Order lookup (WooCommerce, optional).** When the order lookup is enabled, askVela may call the plugin's endpoint `/wp-json/askvela/v1/lookup` with a customer email and an HMAC signature. In the response, the plugin sends order and customer data to askVela: order number, status, total, date, order URL, amount, currency, an optional payment reference, and basic customer details (name, number of orders, customer since, total spent). This only happens for requests carrying a valid signature, and only when you have enabled the lookup and entered the URL + secret in askVela.

3. **Product sync (WooCommerce, optional).** When a product sync is enabled, askVela may call the plugin's endpoint `/wp-json/askvela/v1/products` with an HMAC signature. In the response, the plugin sends your product catalog to askVela: name, description, attributes, price, currency, image URL, product URL, category and stock status. This only happens for requests carrying a valid signature.

4. **One-click connect (optional).** If you use the "Connect with askVela" button, you are sent to askVela to confirm while logged in. After you confirm, the plugin exchanges a one-time code with `https://askvela.pro/api/wp/connect`, sending your site's lookup URL, product-sync URL and secret (so askVela can be configured automatically) and receiving your Widget Key. This only runs when you click connect.

No data is sent to askVela until you enter a Widget Key (widget), configure the lookup/product sync (order/product data), or use one-click connect.

* Service & terms: https://askvela.pro/impressum
* Privacy policy: https://askvela.pro/datenschutz

== Installation ==

1. In your WordPress admin, go to **Plugins → Add New → Upload Plugin** and upload the plugin ZIP, then click **Install Now** and **Activate**.
2. Go to **Settings → askVela**. Easiest: click **Connect with askVela** and confirm in your askVela account – the Widget Key and (for WooCommerce) the order lookup are set up automatically. Or paste your Widget Key manually and save.
3. The chat widget now appears on your shop. If you use a caching plugin, clear its cache.
4. (WooCommerce, optional) On the same settings page, copy the **Lookup URL** and **Secret** into your askVela dashboard under Settings to enable order lookup.

== Frequently Asked Questions ==

= Do I need an askVela account? =

Yes. askVela is a hosted service; this plugin is the WordPress client for it. You can create a workspace at https://askvela.pro.

= Does it work with WooCommerce? =

Yes. The widget runs on all WooCommerce pages automatically. The plugin additionally provides a secure order lookup so the assistant can answer order questions.

= Is the order data secure? =

The lookup endpoint only returns data for requests signed with your shared secret (HMAC-SHA256, verified in constant time). Requests without a valid signature are rejected. You can disable the lookup at any time with a single checkbox.

= The widget does not show up. What can I do? =

Make sure the Widget Key is entered correctly (no spaces) and clear any caching/optimization plugin's cache. In very rare cases a theme does not call `wp_footer`, or a browser ad blocker hides the widget.

= How do I change the widget's colour or greeting? =

In your askVela dashboard under Settings → Widget. The plugin only embeds the widget; appearance is managed in askVela.

== Screenshots ==

1. The askVela settings page – enter your Widget Key and copy the order-lookup URL & secret.
2. The chat & AI widget on a WooCommerce storefront.
3. The assistant answering an order question using the secure WooCommerce lookup.

== Changelog ==

= 1.3.0 =
* New: built-in WooCommerce product sync (secure HMAC endpoint). One-click connect now also configures the product sync, so the assistant can advise on your full catalog.

= 1.2.1 =
* Fix: one-click connect could fail with "missing" – the PKCE verifier is now stored reliably (separate option, no longer dropped by the settings sanitizer).

= 1.2.0 =
* New: one-click "Connect with askVela" – securely links your account (PKCE), auto-fills the Widget Key and configures the WooCommerce order lookup. No copy-paste.

= 1.1.0 =
* New: built-in secure order lookup for WooCommerce (HMAC-signed REST endpoint, HPOS compatible).
* New: settings section showing the Lookup URL and auto-generated secret.

= 1.0.0 =
* Initial release: embeds the askVela chat & AI support widget via your Widget Key.

== Upgrade Notice ==

= 1.3.0 =
Adds built-in WooCommerce product sync; one-click connect now configures it automatically too.

= 1.2.1 =
Fixes one-click connect failing with "missing". Update if you use Connect with askVela.

= 1.2.0 =
Adds one-click "Connect with askVela": link your account and auto-configure the Widget Key and order lookup, no copy-paste.

= 1.1.0 =
Adds a secure WooCommerce order lookup so the AI can answer order questions. Copy the Lookup URL and secret from Settings → askVela into your askVela dashboard.
