=== Devex Hub Smart Lead Engine ===
Contributors: devexhubprivatelimited
Tags: contact form, lead management, crm, google sheets, form
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A contact form that saves every submission as a lead in your WordPress admin — with a Kanban pipeline, Google Sheets sync, and team tools built in.

== Description ==

**Devex Hub Smart Lead Engine** is more than a contact form — it's a full lead management system built into WordPress. Most contact form plugins just send you an email and forget the submission. Smart Lead Engine saves every enquiry as a lead in your dashboard, lets your team manage and convert it, and optionally syncs it to a Google Sheet automatically.

No monthly fees. No SaaS subscriptions. No data leaving your server unless you choose to sync it.

Just add `[dhle_form]` to any page and every contact enquiry becomes a trackable, manageable lead.

**Perfect for:**

* Small businesses replacing Contact Form 7 or WPForms who want to actually track their enquiries
* Agencies and freelancers who receive client enquiries through their website
* Teams who want to assign, follow up, and convert website contacts without a paid CRM
* Anyone who wants every contact form submission saved automatically to Google Sheets

= ✅ What Makes It Different From a Normal Contact Form =

Most contact form plugins (Contact Form 7, WPForms, Gravity Forms) send you an email — and that's it. If you miss the email, the lead is gone. Smart Lead Engine works differently:

* Every submission is **permanently saved** in your WordPress database as a lead
* You get an **admin dashboard** showing all leads, their status, and conversion stats
* You can **assign leads** to team members, add notes, and track progress
* You get a **visual Kanban pipeline** to move leads from New → Contacted → Converted
* Every submission can be **automatically synced to Google Sheets** for reporting or sharing

= ✅ Key Features =

* **Contact Form** — Add `[dhle_form]` to any page or post. Captures name, email, phone, and message. Works with any theme.
* **Leads Dashboard** — Every form submission appears as a lead in your admin. Search, filter, assign, and update — all from one screen.
* **Visual Kanban Pipeline** — Drag-and-drop leads across New / Contacted / Converted columns. See your pipeline at a glance.
* **Google Sheets Sync** — Every new lead is automatically appended as a row in your own Google Sheet. Full setup guide and the Apps Script code are built right into the Settings page — no external tools needed.
* **Email Notifications** — Customisable admin notification and lead confirmation emails with `{name}`, `{email}`, `{phone}`, `{message}` placeholder support.
* **Team Assignment** — Assign leads to specific admins, agents, or managers.
* **Internal Notes** — Add private follow-up notes to any lead, shown as a threaded timeline.
* **CSV Export** — Export all leads to a spreadsheet with one click.
* **Custom User Roles** — Includes `Lead Agent` and `Lead Manager` roles with scoped permissions.
* **Spam Protection** — Honeypot field blocks bots silently, no CAPTCHA needed.
* **AJAX Submission** — Form submits without page reload. Instant feedback for visitors.
* **Dark Mode Ready** — Form adapts to the visitor's OS colour preference automatically.
* **Clean Uninstall** — Removes all data, tables, roles, and settings on deletion.

= 🔧 How To Use =

1. Activate the plugin
2. Add `[dhle_form]` to any page, post, or widget area
3. Visitors fill in the form — submissions appear instantly under **Lead Engine → Leads**
4. Optionally connect Google Sheets under **Lead Engine → Settings** to get every lead in a spreadsheet too

= 📊 Google Sheets Sync =

Connect once, sync forever. Every new form submission is automatically added as a new row in your Google Sheet — name, email, phone, message, date, and site URL.

Setup takes about 5 minutes and everything you need is inside the Settings page:

1. Open your Google Sheet → Extensions → Apps Script
2. Paste the script shown in Settings (one-click Copy button provided)
3. Replace the Spreadsheet ID placeholder with your own Sheet ID (found in your Sheet's URL)
4. Deploy as Web App (Execute as: Me, Access: Anyone) → copy the URL
5. Paste the URL in Settings → Save → click **Test Google Sheet Connection**

Uses Google Apps Script — free, no API keys, no OAuth, no third-party accounts.

= 📧 Support & Custom Development =

* **Email:** [info@devexhub.com](mailto:info@devexhub.com)
* **Website:** [https://devexhub.com](https://devexhub.com)

We build custom WordPress plugins, WooCommerce extensions, and full websites for businesses worldwide.

= 🔒 Privacy =

All form submissions are stored in your own WordPress database. The only external connection this plugin makes is to your own Google Apps Script URL — if you configure one. No data is sent to Devex Hub or any third-party service.

== Installation ==

**From the WordPress plugin directory (recommended):**

1. Go to **Plugins → Add New** in your WordPress dashboard.
2. Search for **Devex Hub Smart Lead Engine**.
3. Click **Install Now**, then **Activate**.

**Manual installation:**

1. Download the plugin zip file.
2. Go to **Plugins → Add New → Upload Plugin**.
3. Choose the zip file and click **Install Now**, then **Activate**.

**After activation:**

1. Add `[dhle_form]` to any page to start capturing leads.
2. Go to **Lead Engine → Dashboard** to see your leads and stats.
3. Go to **Lead Engine → Settings** to set up Google Sheets sync and email templates.

== Frequently Asked Questions ==

= How is this different from Contact Form 7 or WPForms? =
Contact Form 7 and WPForms send you an email when someone fills in your form — and that's it. Smart Lead Engine saves every submission permanently as a lead in your WordPress dashboard, so you can track, assign, follow up on, and convert every enquiry. It also syncs to Google Sheets automatically if you want.

= Where are my leads stored? =
All lead data is stored in your own WordPress database (`wp_dhle_leads` and `wp_dhle_notes` tables). Nothing is sent to any external server unless you configure the optional Google Sheets sync.

= Does this plugin work with any theme? =
Yes. The contact form CSS is fully scoped and isolated so no theme can break the form design.

= Does it work with Elementor, Divi, or other page builders? =
Yes. Paste `[dhle_form]` into any Shortcode widget or block in your builder.

= Can I customise the email notifications? =
Yes — go to **Lead Engine → Settings** and customise both the admin notification and the visitor confirmation email using `{name}`, `{email}`, `{phone}`, `{message}`, `{sitename}`, and `{siteurl}` placeholders.

= How does the Google Sheets sync work? =
When a visitor submits the form, the plugin sends their data to a Google Apps Script Web App URL that you create in your own Google account. The script appends the data as a new row in your Google Sheet. You own and control the script and sheet — no third-party service is involved.

= Do I need a Google API key for the Sheets sync? =
No. It uses Google Apps Script which is free and part of your Google account. The script code is provided inside the Settings page — just copy, paste, and deploy.

= Can I export leads to Excel? =
Yes — click **Export CSV** on the Leads page. Opens directly in Excel or any spreadsheet app.

= What user roles does the plugin add? =
**Lead Agent** (can view and manage leads) and **Lead Manager** (can manage leads and access settings). Administrators get full access automatically.

= Is this plugin GDPR-friendly? =
All data stays on your own server by default. If you enable Google Sheets sync, data goes to your own Google Sheet only. You are responsible for your own privacy policy regarding the contact data you collect.

= What happens when I delete the plugin? =
Everything is removed cleanly — database tables, options, roles, and cron events. No data is left behind.

= Can you build custom features? =
Yes. Contact us at [info@devexhub.com](mailto:info@devexhub.com) or [https://devexhub.com](https://devexhub.com).

== Screenshots ==

1. Dashboard — conversion stats and recent leads at a glance.
2. Leads table — search, filter, assign to team members, add notes.
3. Kanban pipeline — drag-and-drop leads through New, Contacted, and Converted.
4. Settings page — Google Sheets sync with built-in script and Test Connection button.
5. Contact form on the front end — clean floating-label design, works with any theme.

== Changelog ==

= 1.0.0 =
* Initial release.
* Contact form shortcode `[dhle_form]` — captures name, email, phone, message.
* Every submission saved as a lead in the WordPress admin.
* Leads table with search, filter, bulk delete, assign, and CSV export.
* Kanban pipeline with drag-and-drop.
* Internal notes per lead.
* Google Sheets sync via Google Apps Script (guide and script built into Settings).
* Email notifications with customisable templates.
* Custom roles: Lead Agent and Lead Manager.
* Honeypot spam protection.
* Clean uninstall.

== Upgrade Notice ==

= 1.0.0 =
Initial release — no upgrade action required.

== Additional Information ==

= External Services =

This plugin optionally connects to **Google Apps Script**, a free service provided by Google LLC.

* **When is it used?** Only when you enter a Google Apps Script Web App URL in Lead Engine → Settings. When configured, the plugin sends lead data (name, email, phone, message, submission date, and your site URL) to that URL each time a form is submitted.
* **Who controls the script and data?** You do. You create and own the Google Apps Script yourself using your own Google account. The plugin does not connect to any Devexhub-owned server or any third-party service.
* **Google's privacy policy:** https://policies.google.com/privacy
* **Google Apps Script Terms of Service:** https://developers.google.com/terms

No data is sent to any external service if you leave the Google Apps Script URL field empty in Settings.
