=== Ipira AI Chat Widget ===
Contributors: godevtechnologies
Tags: chat, ai, chatbot, customer support, lead generation
Requires at least: 5.8
Tested up to: 7.0
Stable tag: 1.2.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add an AI-powered chat widget to your WordPress site that automatically answers customer questions and captures qualified leads 24/7.

== Description ==

Ipira is an AI-powered chat assistant that learns from your knowledge base and answers customer questions automatically — 24 hours a day, 7 days a week. It captures and qualifies leads conversationally, so your team wakes up to warm contacts instead of cold traffic numbers.

**How it works:**
* Upload your documents, FAQs, and website content to Ipira
* Your AI assistant learns from your knowledge base
* Visitors ask questions and get instant, accurate answers
* High-intent visitors are automatically identified as leads
* The AI collects contact info and your custom qualifying questions — all in natural conversation
* Leads land in your Ipira dashboard with full conversation transcripts

**Features:**

*AI Chat*
* Answers questions using your own documents, website content, and uploaded files
* Understands images, PDFs, and Word documents
* Suggests related pages and YouTube videos when relevant
* Privacy mode option for sensitive industries

*Lead Capture*
* Automatic lead detection — recognizes buying signals and high-intent phrases in real time
* Custom trigger keywords — add industry-specific phrases (e.g. "free estimate", "book a call") that instantly activate lead capture
* Custom lead questions — ask your own follow-up questions after collecting name, email, and phone to qualify leads the way your business needs
* Lead confirmation step — visitors review their info and custom answers before submitting, with an edit flow so the data you receive is accurate
* Leads emailed to you instantly with full answers to your custom questions
* Session-smart deduplication — the same visitor can submit a new lead in a future session without being silently dropped

*Widget Customization*
* Colors, position, size, welcome message, and FAQ quick questions
* Fully customizable per website
* Works on all pages automatically
* Enable/disable toggle without deactivating the plugin
* Shortcode support [ipira_chat] to embed on specific pages

*Developer Tools*
* JavaScript API — open, close, or pre-fill the widget from any button, link, or marketing CTA on your site
* Test Connection button verifies your Widget Key and shows the connected website instantly

*Analytics (Ipira Dashboard)*
* Conversations and leads over time with 7 / 30 / 90 day and custom date range charts
* "What Visitors Are Asking" — ranked top-10 topic analysis from real visitor messages
* Conversation search — find any past conversation instantly (Pro)
* Export Conversations and Leads as CSV for your CRM or reporting (Pro)
* Recent conversations table with lead indicators and full message transcripts

*Knowledge Base Management*
* Upload PDF, DOCX, TXT, and Markdown files
* Scrape website content automatically
* Edit documents directly in the dashboard — no re-uploading needed
* Folder visibility controls — share documents across all websites or assign them to specific sites
* Hide folders from the AI entirely for staging or internal content

*No coding required*

**Requirements:**
* An active Ipira account ([start your free 14-day trial](https://ipira.io))
* Your Widget Key from your Ipira dashboard

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/ipira-chat-widget/` or install through the WordPress plugin screen
2. Activate the plugin through the Plugins screen in WordPress
3. Go to **Ipira Chat** in your WordPress dashboard sidebar
4. Log in to your [Ipira dashboard](https://ipira.io) and copy your Widget Key
5. Paste your Widget Key into the settings page and click **Test Connection** to verify
6. Click **Save Settings**
7. Visit your website — the chat widget will appear automatically on every page

== Frequently Asked Questions ==

= Where do I find my Widget Key? =
Log in to your Ipira dashboard at ipira.io, select your website, and click Embed Code in the sidebar. You will see a copy button to grab just the Widget Key.

= Do I need an Ipira account? =
Yes. The plugin connects your WordPress site to your Ipira AI assistant. [Start a free 14-day trial](https://ipira.io) — credit card required, no charge until after the trial ends.

= Does the chat automatically hand off conversations to a live person? =
No. The Ipira Chat Widget is an AI-only assistant and does not include built-in live agent transfer or escalation. If a visitor needs human support, you can guide them with custom FAQ quick questions or messaging in your welcome text to contact your team by phone, email, or your existing support channel.

= Will the widget slow down my site? =
No. The widget script loads asynchronously and has no impact on your page load speed or Core Web Vitals.

= Can I disable the widget without deactivating the plugin? =
Yes. Go to Ipira Chat in your dashboard sidebar and uncheck "Show the chat widget on all pages."

= How do I know my Widget Key is working? =
Use the Test Connection button on the settings page. It will confirm your key is valid and show you which website and company it is connected to.

= Can I open the widget from a button on my site? =
Yes. Use the JavaScript API included with the widget script:

  <button onclick="window.IpiraChat?.open({ message: 'I need a free estimate' })">
    Get a Free Estimate
  </button>

You can pre-fill any message to give visitors a head start in the conversation.

= Can I place the widget on specific pages only? =
The widget loads on all pages by default. Use the enable/disable toggle in the plugin settings to turn it off, then manually add the widget to specific pages using your theme or page builder.

= Can I ask my own questions during lead capture? =
Yes. In your Ipira dashboard under Widget Configuration > Behavior, you can add custom lead questions that the AI asks after collecting name, email, and phone. Each question can be marked Required or Optional. Required questions are re-asked once if skipped; optional questions move on immediately if the visitor skips them.

= What happens after the AI collects a visitor's contact details? =
The visitor sees a confirmation summary showing their name, email, phone, and all custom question answers before the lead is submitted. They can request changes — the AI will ask for the corrected value, update the summary, and re-show it. You receive an email notification with the complete lead including all custom answers.

= Can the AI detect when someone is ready to buy? =
Yes. Ipira automatically detects buying signals in visitor messages. You can also add your own custom trigger keywords — phrases specific to your industry (like "get a quote" or "book a consultation") that immediately activate lead capture the moment a visitor uses them.

= Can I control which documents the AI uses on each website? =
Yes. In your Ipira dashboard you can organize documents into folders and set each folder's scope: shared across all websites, assigned to specific sites only, or hidden from the AI entirely (useful for staging content or internal reference documents).

= Where is my customer data stored? =
All data is stored securely in your Ipira account. See [ipira.io/privacy](https://ipira.io/privacy) for details.

== Screenshots ==

1. The Ipira Chat settings page in the WordPress dashboard sidebar
2. The Test Connection button confirming a valid Widget Key
3. The chat widget on a live website
4. Lead capture in action

== Changelog ==

= 1.2.0 =
* Custom lead questions — configure additional qualifying questions asked by the AI after collecting name, email, and phone (set in Widget Configuration > Behavior)
* Lead confirmation step — visitors review their contact info and custom answers before submitting, with a two-step edit flow for corrections
* Custom trigger keywords — add industry-specific phrases that immediately activate lead capture
* Session-smart lead deduplication — returning visitors can submit a new lead in a future session
* Lead notification emails now include all custom question answers
* Analytics: conversations and leads over time with 7 / 30 / 90 day and custom date range filters
* Analytics: "What Visitors Are Asking" topic analysis from real visitor messages
* Analytics: conversation search and CSV export for leads and conversations (Pro)
* Document folder visibility controls — scope folders to specific websites or hide from AI
* Inline document editor in dashboard — edit knowledge base documents without re-uploading

= 1.1.0 =
* Added JavaScript API (window.IpiraChat) — open the widget programmatically from any button or link
* Added window.IpiraChat.open(), close(), and isOpen() methods
* Support for pre-filling a message when opening the widget

= 1.0.1 =
* Fixed script registration to use wp_enqueue_script() per WordPress standards
* Fixed nonce verification in settings AJAX handler
* Updated tested up to WordPress 7.0

= 1.0.0 =
* Initial release
* Widget Key validation with Test Connection button
* Enable/disable toggle
* Shortcode support [ipira_chat]
* Open Ipira Dashboard button

== Upgrade Notice ==

= 1.2.0 =
Adds custom lead questions, a visitor confirmation step, custom trigger keywords, and access to the new analytics dashboard with date-range charts and CSV export.

= 1.1.0 =
Adds JavaScript API so you can open the chat widget from any button or link on your site.

= 1.0.1 =
Security and compatibility fixes. Recommended for all users.

= 1.0.0 =
Initial release.