=== Connect for WooPilot AI – Operations & Analytics via Telegram for WooCommerce ===
Contributors: justrelaxdc
Donate link: https://woopilot.xyz
Tags: woocommerce, telegram, ai, analytics, automation
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
Requires Plugins: woocommerce
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AI Operations Director for WooCommerce via Telegram. Real-time analytics, store automation and safe 1-click catalog management.

== Description ==

**WooPilot AI for WooCommerce** is your autonomous AI operations director and analytics assistant right inside Telegram. Manage your store on the go, execute quick catalog updates, analyze store performance with natural language, view interactive charts in Telegram Mini App, and receive instant sales alerts without opening a complex WordPress admin dashboard.

Whether you are traveling, away from your desk, or managing high-volume store operations, WooPilot AI gives you instant clarity and 1-click control in seconds.

### 🌟 Key Features

* **Natural Language Store Analytics:** Ask business questions in plain English (*"What is my top-selling category this month?"*, *"Compare revenue this week vs last week"*, *"Show orders with refunded status"*) and receive instant data insights calculated directly by your database.
* **Interactive Telegram Mini App & Charts:** View visual revenue trends, product ranking bars, status breakdowns, and paginated data tables right inside Telegram.
* **Store Operations & 1-Click Execution:** Update product stock quantities, adjust prices, create discount coupons, or change order statuses with interactive confirmation buttons (Human-in-the-Loop). Zero accidental mutations.
* **Proactive Store Automation & Alerts:** Instant Telegram notifications for new orders, abandoned checkouts, and low-inventory thresholds before you lose revenue.
* **Zero-Key QR Onboarding:** Connect your store in 10 seconds simply by scanning a QR code with Telegram. No API keys, tokens, or webhooks to configure manually.
* **Privacy & GDPR Compliance:** Unconditional protection for authentication secrets, HMAC-SHA256 signature verification, and optional 1-click PII data anonymization (masking customer emails, phone numbers, and full names).
* **High-Speed Direct SQL Architecture:** Read-only analytical queries execute with hardware guards (strict SELECT/WITH validation, LIMIT 3000 capping, and a 3-second MySQL session timeout). All mutating actions execute strictly via official native WooCommerce APIs.

== External Services ==

This plugin connects your site to external services to provide its core functionality:

**1. WooPilot AI Cloud (api.woopilot.xyz)**
* **Purpose:** AI prompt orchestration, natural language SQL query translation, store management tool execution, real-time alert dispatching, and webhook routing.
* **Data Transmitted:** 
  - Store metadata and technical environment parameters (Store URL, site name, active currency, locale, time zone, and database table structure / schema definitions).
  - Analytical and operational store data requested by the authorized store owner during conversations (order metrics, sales reports, inventory levels, product catalog details, coupon data, and customer purchase histories).
  - Real-time store event notification payloads (Order ID, total amount, currency, order items summary, order status, and customer name / contact details unless PII masking is enabled).
  - Tool execution parameters and confirmation payloads (such as updated stock quantities, price adjustments, coupon codes, and order status transitions).
* **When Data is Transmitted:** Only after the store owner explicitly connects their store via QR code pairing in the WordPress admin dashboard. No data is sent prior to pairing.
* **Terms of Service:** [https://woopilot.xyz/terms](https://woopilot.xyz/terms)
* **Privacy Policy:** [https://woopilot.xyz/privacy](https://woopilot.xyz/privacy)

**2. Telegram Bot API (api.telegram.org)**
* **Purpose:** Delivering conversational AI answers, interactive action confirmation buttons, store analytics reports, and instant real-time event notifications directly to the authorized store owner's Telegram account.
* **Data Transmitted:** Operational summaries, analytical charts/reports, interactive action buttons, notification messages, and bot command responses dispatched by the WooPilot AI Cloud.
* **When Data is Transmitted:** During conversational interactions, analytical queries, and when store event notifications (e.g. new orders) are triggered.
* **Privacy Policy:** [https://telegram.org/privacy](https://telegram.org/privacy)

== Installation ==

1. Upload the `connect-woopilot-assistant` folder to the `/wp-content/plugins/` directory, or install the plugin directly through the WordPress plugins screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Ensure WooCommerce is active and updated to version 8.0 or higher.
4. Navigate to **WooCommerce -> WooPilot** in your admin menu.
5. Scan the displayed QR code with your Telegram app (or click the deep-link button) to pair your store with the bot.

== Frequently Asked Questions ==

= Does this plugin send data to external servers automatically? =
No. The plugin will NOT contact external servers or dispatch any data until you explicitly pair your store by scanning the QR code in the settings dashboard.

= Do I need to create my own Telegram Bot? =
No. WooPilot AI provides the verified Telegram Bot infrastructure as part of its cloud service. You simply scan the QR code to pair your store.

= Does this plugin modify my database directly with SQL? =
No. The Direct SQL execution bridge is strictly read-only (`SELECT` and `WITH` queries only). All mutating actions (updating stock, prices, coupons, orders) execute exclusively via official native WooCommerce PHP APIs.

= Is my customer data safe and GDPR compliant? =
Yes. All communication is authenticated via HMAC-SHA256 signatures with timestamp verification, and authentication secrets (passwords and API tokens) are permanently masked. You can also enable Personally Identifiable Information (PII) anonymization in the settings at any time to automatically mask customer emails, phone numbers, full names, and IP addresses before query results leave your server.

= What are the system requirements? =
* WordPress 6.0 or higher
* WooCommerce 8.0 or higher (High-Performance Order Storage HPOS compatible)
* PHP 8.0 or higher

== Privacy Policy ==

This plugin respects your privacy and adheres to strict data minimisation practices:
* No tracking or analytics data is gathered without explicit user consent.
* All inter-service communication is authenticated via HMAC-SHA256 signatures with timestamp validation.
* Read queries sent to the database are strictly limited to analytical read-only operations.
* For the full privacy policy, visit [https://woopilot.xyz/privacy](https://woopilot.xyz/privacy).

== Support ==

For documentation, support requests, or bug reports, please email us at support@woopilot.xyz or open a topic in the WordPress.org support forums.

== Screenshots ==

1. Admin Dashboard with Zero-Key QR Onboarding and Token Timer.
2. Security & PII Anonymization Settings and Live Security Audit Log.
3. Telegram UX showing interactive analytics and 1-click action buttons.

== Changelog ==

= 1.0.0 =
* Initial public release.
* Zero-Key QR Code onboarding for Telegram.
* Direct-SQL read layer with hardware guards and LIMIT enforcement.
* Action Mutation Gate for stock, pricing, coupons, and orders.
* GDPR PII masking and Security Audit Log.
* HPOS (High-Performance Order Storage) full compatibility.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
