=== PN Customers Manager ===
Contributors: felixmartinez, hamlet237
Donate link: https://padresenlanube.com/
Tags: crm, crm plugin, contact management, lead management, sales pipeline
Requires at least: 3.0
Tested up to: 7.0
Stable tag: 1.2.46
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
A powerful CRM with AI WhatsApp/Instagram chat, sales funnels, funnel form builder, contact forms, email campaigns, budgets & invoices, social media links, referral system, CTA injection, WooCommerce CTA block, back-in-stock notifications, and WooCommerce integration for WordPress.

== Description ==

PN Customers Manager is a powerful and intuitive Customer Relationship Management plugin designed specifically for WordPress. It helps businesses collect, organize, and manage their leads and customers directly from their website — without relying on external platforms.

With an easy-to-use dashboard and a complete set of sales, marketing, and AI-powered communication tools, PN Customers Manager allows you to centralize all interactions, track workflows, and automate repetitive tasks so you can focus on what matters most: growing your business.

Whether you run an online store, a service-based business, an agency, or a membership site, PN Customers Manager provides everything you need to turn visitors into loyal customers — including AI chatbots that talk to your clients on WhatsApp and Instagram.

= AI-Powered Conversations =

* **WhatsApp AI Integration**: Connect your WhatsApp Business account and let an OpenAI-powered chatbot handle customer conversations automatically. The AI knows your products, prices, shipping zones, and business hours. It can send product photos, process orders, and escalate complex queries — all through the WhatsApp Cloud API.

* **Instagram AI Integration**: Same AI-powered conversation engine for Instagram Direct Messages. Receive DMs, respond automatically with context-aware answers, and manage all conversations from your WordPress dashboard.

* **WooCommerce Product Knowledge**: The AI automatically loads your top 50 best-selling products (with variations, prices, stock status, and images) so it can answer product questions, recommend items, and share add-to-cart links.

* **Guided Product Recommendations**: Enable a multi-step recommendation protocol where the AI asks qualifying questions (budget, category, preferences) before suggesting products — resulting in more relevant recommendations and higher conversion rates.

* **Order Acceptance Protocol**: The AI can take orders directly in chat with a two-step confirmation flow (summary + explicit confirmation), then notify you by email with the order details.

* **Special Order Forwarding**: For requests that cannot be fulfilled through a standard purchase link (B2B, bulk orders, custom products), the AI collects all the details and forwards them by email to a configurable list of internal users and external email addresses.

* **Shipping Zone Awareness**: The AI automatically knows your WooCommerce shipping zones, methods, and costs. It can answer shipping questions instantly, including postal code validation and free shipping thresholds.

* **Blog & Page Context**: Inject your WordPress posts and pages into the AI's knowledge base so it can reference your content and share links with customers.

* **Conversation Management Dashboard**: View, search, close, delete, and reset all WhatsApp and Instagram conversations from your admin panel and from the funnel builder. Full chat history with timestamps and role indicators.

* **Debug Logging**: Enable or disable debug logging independently for WhatsApp AI and Instagram AI from the settings page. Logs are saved to `wp-content/uploads/pn-customers-manager-logs/`.

= WooCommerce Checkout Custom Fields =

* **Product-Specific Fields**: Add custom fields to the checkout page for specific products. Configure different fields for different products based on what information you need to collect.

* **Visual Field Builder**: Intuitive drag-and-drop interface in product edit screen to create, reorder, and configure custom fields. Located in a new "Campos de Checkout" tab before the Calendar tab.

* **Multiple Field Types**: Support for text, textarea, email, phone, number, date, select (dropdown), radio buttons, checkboxes, and file uploads.

* **Field Configuration**: Each field can be configured with:
  * Label and internal name (ID)
  * Placeholder text
  * Options for select/radio/checkbox fields
  * Description/help text
  * Required/optional status

* **Automatic Display**: Fields automatically appear at checkout when customers purchase products with custom fields enabled.

* **Validation**: Built-in validation for required fields and email format. Integrates seamlessly with WooCommerce checkout validation.

* **Order Storage**: Customer responses are saved to order item metadata and visible in:
  * Admin order details page
  * Customer order view (My Account)
  * Order confirmation emails
  * Order item meta display

* **Email Integration**: Custom field data is included in order notification emails with proper formatting and labels.

= WooCommerce QR Tickets =

* **QR Code Generation**: Generate unique QR codes for WooCommerce products that can be used as tickets for physical delivery validation, event entry, or item collection.

* **Product Settings**: Enable QR tickets per product with customizable prefix and customer instructions. Settings available in WooCommerce product data tabs.

* **Order Integration**: QR codes are automatically generated when orders are completed and stored as order item metadata.

* **Customer Display**: Customers who purchased products with QR codes enabled can view their QR codes on product pages (when logged in), order confirmation emails, and My Account order details page.

* **Admin Management Panel**: Complete QR tickets management system with:
  * Interactive table with customer info, products breakdown, and status
  * Clickable rows - tap anywhere on a row to view full QR details
  * Real-time filters by product and status (Pending/Processed)
  * Native popup system for consistent UI experience
  * Detailed modal view with full QR code image and order information
  * QR code scanner using device camera with intelligent camera selection
  * Smart camera detection prioritizes rear camera on mobile devices
  * Camera switching button when multiple cameras are available
  * One-click actions to mark as processed, mark as pending, or delete
  * Confirmation dialogs for all destructive actions
  * Responsive design with scroll and mobile-optimized layout

* **Shortcode Support**: Use `[pn_qr_manager product_id="123"]` to display the QR management panel on any page (admin only).

* **Status Tracking**: Track QR codes as processed or pending with timestamps, user attribution, and processing history.

* **Mobile Optimized**: Responsive design with stacked filters on mobile, icon-only status badges on tablets, and optimized table layout for small screens.

= Budgets & Invoices =

* **Budget Management**: Create professional proposals and quotations with customizable items, phases, tax rates, and discount rates. Budgets support multiple item types (hours, fixed, phase, image), optional items that customers can toggle on/off, and image galleries for visual references.

* **Invoice Management**: Generate invoices linked to organizations with automatic invoice numbering, due dates, status tracking (Draft, Sent, Paid, Cancelled), and payment date recording.

* **Public Sharing via Token**: Share budgets and invoices with customers through secure token-based URLs — no WordPress login required. Clean, standalone templates with company branding, schema.org structured data, and Open Graph meta tags.

* **Customer Acceptance Workflow**: Customers can accept or reject budgets directly from the public view. Non-registered users can provide their email address to confirm acceptance. Acceptance/rejection is timestamped.

* **Optional Items & Phases**: Organize budget items into collapsible phases. Mark individual items or entire phases as optional — customers see a live-updating total as they toggle items on/off with a sticky price bar.

* **PDF Generation**: Generate professional PDF documents from both budgets and invoices directly from the public or admin view.

* **Inline Editing**: Admins can edit budget and invoice items, reorder with drag-and-drop, add new items, and manage status directly from the public-facing template without returning to the admin panel.

* **CSV Import/Export**: Bulk import and export budgets via CSV files. Includes a downloadable template with sample data, a multi-step import wizard with preview, and automatic organization name resolution.

= Core CRM Features =

* **Funnel Management System**: Create and manage sales funnels with customizable stages. Each funnel can include multimedia content (video, audio, images), dates, times, and custom taxonomies for better organization. Funnels support hierarchical structures and can be linked to organizations for complete pipeline tracking.

* **Organization Management**: Comprehensive organization/company management with advanced features including:
  * Owner and collaborator assignment
  * Funnel linking and stage tracking
  * Contact information management (phone, email, website, LinkedIn)
  * Billing information fields
  * Lead source tracking and lifecycle stage management
  * Priority and health scoring
  * Lead scoring system
  * Tags and notes for better organization
  * Geographic data (country, region, city, address, postal code)
  * Industry and segment classification
  * Team size and annual revenue tracking

* **Contact Messages**: A built-in contact form system with inbox management. Messages are organized in Inbox, Spam, and Forms tabs with unread counters, read/unread status, mark as spam, and full sender details including source page and IP address.

* **Akismet Spam Protection**: Contact form submissions are automatically checked against Akismet for spam detection and filtering.

= Email Campaigns =

* **Campaign Management**: Create and send email campaigns directly from WordPress with template support and audience segmentation. Each campaign includes a content preview with a copy button for manual sending.

* **Mail Statistics**: Track email campaign performance with open rates, click rates, bounce rates, and unsubscribe tracking on a dedicated dashboard.

= Business Projections =

* **Automated Data Collection**: Automatic daily, hourly, or weekly snapshots of your CRM metrics, user stats, email performance, and social media followers via scheduled cron jobs.

* **Social Media Tracking**: Connect Instagram Graph API, Facebook Insights, and Twitter/X API v2 to track followers, impressions, reach, and engagement over time.

* **Manual Projections**: Set future targets with expected values and dates. Compare projections vs actual performance with deviation percentage calculations.

* **Visual Dashboard**: Interactive Chart.js line charts with projection overlays, metric selectors, source tabs (CRM, Users, Email, Social Media), and status cards showing active integrations.

= Advanced Form Builder =

A powerful form system that supports multiple field types:

* Text inputs (text, email, url, password, date, time, color, hidden)
* Textarea and rich text editor (WYSIWYG)
* Select dropdowns (single and multiple selection)
* Checkboxes and radio buttons
* Range sliders with custom min/max labels
* Star rating system
* File uploads (images, videos, audio, documents)
* Image galleries with multiple image support
* Audio recorder with transcription capabilities
* Tags input with autocomplete suggestions
* Conditional fields (parent/child relationships)
* Multiple field groups with drag-and-drop reordering
* HTML content blocks
* Form validation and sanitization
* Forms can save data to WordPress users, custom post types, or options

= Funnel Form Builder =

* **Visual Form Editor**: Build custom forms inside the funnel builder with a drag-and-drop field editor. Add, remove, and reorder fields with an intuitive interface directly in the node settings popup.

* **Multiple Field Types**: Support for text, email, number, phone, URL, date, textarea, select (dropdown), checkbox, radio, file upload, and informational text blocks.

* **Interactive Option Manager**: Configure select and radio field options with individual value/label inputs, drag-and-drop reordering, and add/remove buttons — no more error-prone textareas.

* **Three Display Modes**: Choose how forms are presented to visitors:
  * **Basic**: All fields displayed at once (default)
  * **Sequential**: One field at a time with progress bar, step counter, and back/next navigation
  * **Fullscreen (Typeform-style)**: Immersive full-screen overlay with custom background color and automatic dark/light text detection

* **Loader Overlay & Feedback**: During AJAX submission, a spinner overlay covers the form. On completion, an animated success or error icon with message is displayed for a few seconds before fading out.

* **Form Submissions Dashboard**: All submissions are stored in a dedicated database table and displayed in a new "Forms" tab within Contact Messages. View submitted data, sender email, source page, user, date, and funnel association. Mark as read, expand details, and delete submissions with live badge counters.

* **Anti-Spam Protection**: Optional honeypot field to catch automated bots without requiring CAPTCHAs.

* **Email Notifications**: Optionally send form submissions to a configurable recipient email address.

* **Shortcode**: Embed any funnel form on any page using `[pn-customers-manager-funnel-form funnel_id="123" node_id="abc"]`.

* **Gutenberg Block**: Native block editor support with live preview for funnel forms.

= Referral System =

* Enable referral tracking for your organizations
* Top referrers ranking display
* Customizable referral share text
* QR code generation with custom logo
* Configurable reminder frequency and limits
* Business card phrases management

= User Management =

* Custom user roles: Administrator, CRM Manager, Commercial, and Client
* CRM Manager role with full access to CRM features (messages, statistics, projections, conversations, commercial agents) without requiring full admin privileges
* User creation and management functions
* User metadata handling
* User login tracking
* User profile management with custom fields

= Social Media Link Display =

* **Linktree-Style Layout**: Display all your social media links and custom URLs in a clean, mobile-friendly, stacked layout similar to Linktree.

* **Multiple Display Styles**: Choose from default (stacked links), grid (2-3 columns), or sidebar (compact with icons only).

* **Button Customization**: Solid or outline button styles with configurable colors and fixed light gray background.

* **15+ Social Networks**: Built-in support for Facebook, Instagram, Twitter/X, LinkedIn, YouTube, TikTok, Snapchat, Pinterest, Reddit, Twitch, Discord, WhatsApp, Telegram, plus email, website, and custom links.

* **Custom Links**: Add unlimited custom links with custom labels and URLs for any platform not in the preset list.

* **Share Functionality**: Integrated share button that opens a popup with native social sharing options (Facebook, Twitter, LinkedIn, WhatsApp, Telegram, email) and a copy-to-clipboard feature.

* **SVG Icon System**: Crisp, scalable vector icons for all platforms with customizable colors.

* **Shortcode & Gutenberg Block**: Use `[pn-customers-manager-social-media]` shortcode or the native Gutenberg block with live preview.

* **Responsive Design**: Automatically adapts to mobile, tablet, and desktop screens with optimized layouts.

= Interactive Tutorial & Onboarding =

* **First-Time User Guidance**: Automatic interactive tutorial that guides new users through the plugin's main features with step-by-step overlays.

* **Spotlight Highlighting**: Visual spotlight effect that highlights the relevant section of the settings page for each tutorial step.

* **5-Step Walkthrough**: Covers Welcome, Marketing & Company Info, Referral System, WooCommerce Integration, and completion.

* **Progress Tracking**: Visual progress bar showing current step out of total steps.

* **Draggable Interface**: Tutorial box can be dragged to any position on screen for better visibility.

* **Auto-Expansion**: Automatically opens collapsed sections when highlighting them in the tutorial.

* **Smart Positioning**: Tutorial box intelligently positions itself next to highlighted elements, or centers on small screens.

* **Skip & Complete Options**: Users can skip the tutorial at any time or mark it as completed, with persistence via AJAX.

= Call to Action (CTA) Injection =

* **Automatic CTA Insertion**: Inject custom HTML content (banners, promotions, signup forms) into any public post type content automatically — no shortcode needed.

* **Flexible Positioning**: Place the CTA at the beginning of the content, at the end, or inside the content after a configurable percentage of paragraphs (e.g., 50% inserts it halfway through).

* **Post Type Targeting**: Select which post types display the CTA from a dynamically generated list of all public post types on your site.

* **WYSIWYG Editor**: Write your CTA content with a rich text editor supporting links, images, formatting, and raw HTML.

* **Settings Integration**: Enable/disable CTA globally, configure position, target post types, and content — all from the Marketing section in plugin settings.

= WooCommerce CTA Block =

* **Gutenberg Block**: A dedicated Call to Action Gutenberg block (`pn-customers-manager/woo-cta`) for promoting WooCommerce products, categories, tags, or the shop page directly in the editor.

* **Two Display Styles**: Choose between a Card layout (horizontal with image + content) or a Banner layout (full-width with background image overlay).

* **Dynamic Data**: The block automatically fetches the product/category/tag name, image, and permalink for the selected target. Falls back to the shop page URL for shop-type CTAs.

* **Color Customization**: Native color picker inputs for background, text, button, and button text colors. Defaults to your plugin's brand colors when not customized.

* **Editor Preview**: Live preview in the Gutenberg editor with real-time color and layout updates as you configure the block settings.

= WooCommerce Back in Stock Notifications =

* **Email Subscription Form**: Displays a configurable email subscription form on out-of-stock WooCommerce product pages. Visitors enter their email to be notified when the product is restocked.

* **Automatic Restock Emails**: When a product returns to in-stock status, all pending subscribers automatically receive an email with the product name and a direct link. Supports MAILPN for email delivery when available.

* **CRM Integration**: Each subscription creates a contact message in the CRM Messages inbox and registers the subscriber as a WordPress user (without overwriting existing user data).

* **Admin Notification**: Shop administrators receive an email notification for each new subscription, with subscriber email, product name, and a link to the product.

* **Admin Subscribers Panel**: Administrators see a collapsible subscribers panel on product pages listing all subscriptions with email, status (pending/notified), date, individual delete buttons, and CSV export.

* **Configurable Texts**: Customize the form heading, description, button text, and success message from the WooCommerce section in plugin settings.

= Shortcodes =

* `[pn-customers-manager-funnel]` — Display individual funnels with all their details
* `[pn-customers-manager-funnel-list]` — Display lists of funnels with customizable layouts
* `[pn-customers-manager-organization-list]` — Display lists of organizations
* `[pn-customers-manager-client-form]` — Public client registration form (also available as Gutenberg block)
* `[pn-customers-manager-contact-form]` — Contact form with Akismet spam protection
* `[pn-customers-manager-call-to-action]` — Call-to-action blocks with icons, titles, content, and customizable buttons
* `[pn-customers-manager-button]` — Customizable buttons (solid/outline/transparent, size, color, icon, image) with Gutenberg block support
* `[pn-customers-manager-social-media]` — Social media link display with Linktree-style layout (also available as Gutenberg block)
* `[pn-customers-manager-whatsapp-ai]` — WhatsApp conversations front-end panel (admin only)
* `[pn-customers-manager-instagram-ai]` — Instagram conversations front-end panel (admin only)
* `[pn-customers-manager-funnel-form]` — Funnel form with configurable fields, display modes, and AJAX submission (requires funnel_id and node_id parameters)
* `[pn_qr_manager]` — QR tickets management panel with built-in camera scanner, clickable table rows, and native popup integration (admin only, optional product_id parameter)

= Settings & Configuration =

* Dedicated settings page in WordPress admin
* API configuration for OpenAI, WhatsApp, Instagram, and social media platforms
* Built-in API connection testing tools
* Settings export to JSON and import from JSON
* Recommended plugins discovery with one-click install and activate
* Customizable URL slugs for custom post types
* Plugin activation redirect to settings

= More Features =

* **Popup System**: Modal popups for content display, video popups for embedded media, customizable options (close button, overlay close, ESC key), and a JavaScript API for programmatic control.

* **Template System**: Custom single and archive templates for funnels and organizations with a template override system.

* **Internationalization**: Full translation support with Polylang integration for multilingual sites. Spanish translation included.

* **Security**: Nonce verification, input sanitization, capability-based access control, secure AJAX endpoints, and password strength checking.

* **Developer-Friendly**: Clean object-oriented code, extensible hook system, filter and action hooks throughout, and custom capabilities for fine-grained permissions.

= PN Plugin Ecosystem =

PN Customers Manager is part of a modular plugin ecosystem by Padres en la Nube. Each plugin is independent but designed to work seamlessly together. You can discover, install, and activate companion plugins directly from the Settings page.

**MailPN — Email Marketing & Newsletters**
The shared email engine for the entire ecosystem. Create and schedule email campaigns, personalize content with dynamic fields, track open and click-through rates in real time, set up automated drip campaigns, and connect with popular email services or your own SMTP server. PN Customers Manager uses MailPN as its campaign sending and tracking backend.

**UsersPN — User Management & Registration**
Complete frontend user management: customizable registration and login forms, advanced profile editing with tabbed interface, profile completion tracking, custom avatar system with Gravatar fallback, CSV import/export, and auto-login for support. Includes Google reCAPTCHA v3, honeypot, rate limiting, and Akismet integration. Provides the user layer that feeds contacts into the CRM. Notifications are powered by MailPN.

**PN Tasks Manager — Task & Project Management**
Create tasks, assign them to users, track time, and organize workflow with an interactive calendar (day, week, month, year views). Supports recurring tasks, task categories with custom icons and colors, public/joinable tasks, ICS calendar export (Google Calendar, Outlook, Apple Calendar), user rankings based on completed hours, and file attachments. Email notifications powered by MailPN.

**PN Cookies Manager — Cookie Consent & GDPR Compliance**
Lightweight cookie consent plugin supporting GDPR, CCPA, LGPD, and ePrivacy Directive. Three banner layouts (full-width bar, compact box, floating card), a cookie preferences panel with category toggles (Necessary, Functional, Analytics, Performance, Advertising), a cookie registry with quick-add presets for GA4, Google Ads, Facebook Pixel, and more. Built-in Google Consent Mode v2 integration. Ensures your CRM tracking and analytics cookies are properly disclosed and consent is collected.


== Credits ==
This plugin stands on the shoulders of giants

FancyBox v3.5.7
Licensed GPLv3 for open source use or fancyBox Commercial License for commercial use
Copyright 2019 fancyApps
http://fancyapps.com/fancybox/
https://github.com/fancyapps/fancybox/blob/master/dist/jquery.fancybox.js
https://github.com/fancyapps/fancybox/blob/master/dist/jquery.fancybox.css

Owl Carousel v2.3.4
Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
Copyright 2013-2018 David Deutsch
https://owlcarousel2.github.io/OwlCarousel2/
https://github.com/OwlCarousel2/OwlCarousel2/blob/develop/dist/owl.carousel.js

Trumbowyg v2.27.3 - A lightweight WYSIWYG editor
alex-d.github.io/Trumbowyg/
License MIT - Author : Alexandre Demode (Alex-D)
https://github.com/Alex-D/Trumbowyg/blob/develop/src/ui/sass/trumbowyg.scss
https://github.com/Alex-D/Trumbowyg/blob/develop/src/trumbowyg.js

Chart.js
Licensed under the MIT License
https://www.chartjs.org/


== Installation ==

1. Upload the `pn-customers-manager` folder to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Go to the PN Customers Manager settings page to configure your API keys and preferences

== Frequently Asked Questions ==

= How do I install the PN Customers Manager plugin? =

You can either upload the plugin files to the /wp-content/plugins/pn-customers-manager directory, or install the plugin through the WordPress plugins screen directly. After uploading, activate the plugin through the 'Plugins' screen in WordPress.

= How do I set up the WhatsApp AI chatbot? =

Go to PN Customers Manager > Settings > WhatsApp AI section. Enter your WhatsApp Business Access Token, Phone Number ID, and Verify Token. Use the provided Webhook URL to configure your Meta app. You can test the connection with the built-in test buttons.

= How do I set up the Instagram AI chatbot? =

Go to PN Customers Manager > Settings > Instagram AI section. Enter your Instagram Access Token (with instagram_manage_messages permission), Instagram Page ID, and Verify Token. Configure the Webhook URL in your Meta app settings.

= Does the AI chatbot work with WooCommerce? =

Yes. When you enable the WooCommerce integration in the funnel builder, the AI automatically loads your product catalog (up to 50 best-selling products) with prices, variations, images, and stock status. It can recommend products, share add-to-cart links, send product photos, and even take orders.

= Can I customize the AI's behavior? =

Yes. Each funnel node can have its own system prompt, AI model selection (GPT-4o, GPT-4o-mini, GPT-4 Turbo), and temperature setting. You can also add business context, opening hours, shipping information, and knowledge base content that the AI will use in conversations.

= Can I customize the look and feel of my listings? =

Yes, you can customize the appearance of your listings by modifying the CSS styles provided in the plugin. Additionally, you can enqueue your own custom styles to override the default plugin styles.

= Can I use this plugin with any WordPress theme? =

Yes, the PN Customers Manager plugin is designed to be compatible with any WordPress theme. However, some themes may require additional customization to ensure the plugin's styles integrate seamlessly.

= Is the plugin translation-ready? =

Yes, the PN Customers Manager plugin is fully translation-ready. Spanish translation is included. You can use translation plugins such as Loco Translate to translate the plugin into your desired language.

= How do I export and import my settings? =

Use the Export and Import buttons in the settings footer bar. Export saves all your plugin settings as a JSON file. Import lets you restore settings from a previously exported file.

= How do I track my business projections? =

Go to PN Customers Manager > Projections. Connect your social media APIs in Settings, and the plugin will automatically collect snapshots of your CRM metrics, user stats, email performance, and social media data. You can also create manual projections with target values and dates.

= How do I get support for the PN Customers Manager plugin? =

For support, you can visit the plugin's support forum on the WordPress.org website or contact the plugin author directly at info@padresenlanube.com.

= Is the plugin compatible with the latest version of WordPress? =

The PN Customers Manager plugin is tested with the latest version of WordPress. However, it is always a good practice to check for any compatibility issues before updating WordPress or the plugin.

= How do I uninstall the plugin? =

Go to the 'Plugins' screen in WordPress, find the PN Customers Manager plugin, and click 'Deactivate'. After deactivating, you can click 'Delete' to remove the plugin and its files from your site. Note that this will not delete your data, but you should back up your data before uninstalling any plugin.


== Changelog ==

= 1.2.46 =

- Add WooCommerce Back in Stock notification system: email subscription form on out-of-stock products with configurable heading, description, button text, and success message
- Add `pn_cm_woo_back_in_stock` database table for tracking product-email subscriptions with status, user association, and notification timestamps
- Add automatic restock notification emails to all pending subscribers when a product returns to in-stock status, with dual hook coverage (`woocommerce_product_set_stock_status` and `woocommerce_product_object_updated_props`) and deduplication
- Add MAILPN integration for both admin notification and subscriber restock emails, falling back to `wp_mail` when MAILPN is not active
- Add CRM contact message insertion when a visitor subscribes to a back-in-stock notification, making the request visible in the Messages inbox
- Add WordPress user creation for new subscriber emails via `pn_customers_manager_user_insert`, with existing user detection to avoid overwriting user data
- Add admin subscribers panel on product pages showing all subscriptions with email, status (pending/notified), date, individual delete buttons, and CSV export
- Add collapsible toggle on the admin subscribers panel using the plugin's standard Material Icons expand/collapse pattern, collapsed by default
- Add Back in Stock settings in the WooCommerce section: enable checkbox with four conditional text fields (heading, description, button text, success message)
- Add the plugin's standard loader animation inside the subscription button during AJAX submission
- Add the global slide-in notification (`get_main_message`) on subscription success/error, with standalone implementation for non-CRM pages
- Add WooCommerce CTA Gutenberg block (`pn-customers-manager/woo-cta`) for creating Call to Action sections linked to WooCommerce products, categories, tags, or the shop page
- Add CTA block with two styles (card and banner), configurable colors (background, text, button, button text), alignment, image toggle, and open-in-new-tab option
- Add CTA block server-side rendering with dynamic product/category/tag data (name, image, permalink) and shop page fallback
- Add CTA block frontend stylesheet registration via `register_block_type` so styles load on pages containing the block, independent of CRM page assets
- Add color picker inputs (native `<input type="color">` combined with hex text input) to the CTA block editor, replacing plain text fields for the four color attributes
- Add CTA block settings in the WooCommerce section with an enable checkbox
- Add loader animation in the Contact Messages tab content area when switching between Inbox, Spam, and Forms tabs during AJAX loading
- Add `style` attribute to KSES whitelist for `table`, `tr`, `th`, and `td` elements
- Add `stopPropagation` to the budget admin "Add phase" button click handler to prevent event bubbling
- Remove the wrapping section around the budget items editor in the admin metabox, rendering items block and totals block as standalone HTML fields
- Add standalone totals display block in the budget admin metabox
- Change budget item description inputs in the admin editor to strip HTML tags via `wp_strip_all_tags` for display in plain text inputs
- Change budget item description sanitization on AJAX add and edit from `wp_kses_post` to `sanitize_text_field`
- Change budget admin "Add phase", "Add item", and "Add image" action elements from `<a>` links to `<button>` elements to prevent default anchor behavior
- Fix input wrapper for HTML fields with hidden inputs collapsing to zero height

= 1.2.45 =

- Add funnel form builder: new form node type in the funnel builder with a visual drag-and-drop field editor supporting text, email, number, tel, URL, date, textarea, select, checkbox, radio, file upload, and informational text block field types
- Add interactive option manager for select and radio fields with individual value/label inputs per row, drag-and-drop reordering, and add/remove buttons, replacing the previous textarea-based editor
- Add three form display modes: Basic (all fields at once), Sequential (one field at a time with progress bar, step counter, and back/next navigation), and Fullscreen (Typeform-style immersive overlay with configurable background color and automatic dark/light text detection based on luminance)
- Add loader overlay during AJAX form submission with a spinner covering the form, replaced on completion by an animated success (green checkmark) or error (red X) icon with message, visible for a few seconds before fade-out
- Add form submissions dashboard as a new "Formularios" tab in Contact Messages with table listing, expandable detail rows showing all submitted field data, read/unread status tracking, mark as read, and delete functionality
- Add unread form submissions badge counter in the Forms tab header and admin menu, updated in real time via AJAX alongside existing inbox and spam counters
- Add `pn_cm_funnel_form_submissions` database table for storing form submissions with funnel/node association, submitted data (JSON), sender email, source URL/title, IP address, user ID, read/spam status, and timestamps
- Add `[pn-customers-manager-funnel-form]` shortcode with `funnel_id` and `node_id` parameters to embed funnel forms on any page, with corresponding Gutenberg block registration
- Add shortcode quick-copy display with copy button in the right sidebar props panel for both button and form nodes, so users can copy shortcodes without opening the settings popup
- Add "View submissions" button in the props panel for form nodes that opens the Forms dashboard tab in a new browser tab
- Add form settings fields: title, description, submit button text, success message, recipient email, and honeypot anti-spam toggle
- Add AJAX nopriv handler for public funnel form submissions and admin AJAX handlers for marking form submissions as read and deleting them
- Add file upload input support across the forms infrastructure: new `upload` option renders a native `<input type="file">` element with `accept` attribute for allowed file types
- Add section label type with configurable background color and colored section support with CSS custom properties across the forms infrastructure (input_wrapper_builder and input_display_wrapper)
- Add `accept` attribute support and file type value skip in the default input case to prevent invalid HTML on file inputs
- Add button type width handling in input_wrapper_builder so button inputs render at full width like submit inputs
- Add `required`, `accept`, `tabindex`, and `autocomplete` to the allowed HTML attributes whitelist (KSES)
- Add method_exists safety check for get_ai_providers in the funnel builder to prevent errors when the WhatsApp AI class is not fully loaded
- Add Call to Action (CTA) injection system: automatically insert custom HTML content into any public post type at configurable positions (before, after, or inside content at a given paragraph percentage)
- Add CTA settings in the Marketing section with enable toggle, post type multi-select, position selector, percentage input, and WYSIWYG content editor
- Add `PN_CUSTOMERS_MANAGER_CTA` class with `the_content` filter that injects CTA HTML on singular front-end views for selected post types
- Add quick-access public URL block at the top of the budget admin metabox with "View public budget" link and "Copy URL" button
- Add WYSIWYG editor (Trumbowyg) for budget item descriptions in both edit and add item popup forms, replacing the plain text input and textarea
- Add edit button to budget item rows and phase rows in the WP Admin items editor, opening the same popup-based editing form used on the public page
- Add delete button with AJAX removal to budget item rows in the WP Admin items editor, with fade-out animation and totals recalculation
- Add Trumbowyg WYSIWYG initialization for AJAX-loaded popup forms via `initPopupEditors()` helper, with `getEditorValue()` to extract HTML content from the editor
- Add budget CSS and admin JS enqueue directly in the metabox render function so the admin items editor works independently of the front-end page context
- Add admin totals display with unique IDs (`pn-cm-budget-admin-subtotal`, `pn-cm-budget-admin-discount`, `pn-cm-budget-admin-tax`, `pn-cm-budget-admin-total`) for reliable JS-driven recalculation, with show/hide logic for discount and tax rows
- Add styled admin totals section with background, border-radius, and visual separation between subtotal, discount, tax, and total rows
- Add styled quick-link block CSS for the admin metabox with "View public budget" and "Copy URL" buttons
- Add styled admin item row action buttons (edit and delete) with hover states and icon sizing
- Add CSS rule to reset `<p>` margins inside `.pn-cm-budget-col-phase` so WYSIWYG-generated HTML in phase titles renders without extra spacing
- Add Trumbowyg button exclusion in popup CSS so `.trumbowyg-button-group button` elements are not overridden by the popup's generic button styles (budget and invoice)
- Move footer image from before the totals section to after the totals section on the public budget page
- Move popup-based edit, save, and delete handlers from public-page-only scope to shared scope so they work on both the public page and the WP Admin items editor
- Render budget item and phase descriptions as HTML (`wp_kses_post`) instead of escaped text (`esc_html`) in the public budget template so WYSIWYG-formatted content displays correctly
- Render phase titles as HTML (`.html()` instead of `.text()`) in the admin JS when building or updating phase rows
- Change budget item description sanitization on save from `sanitize_text_field` to `wp_kses_post` to preserve HTML formatting from the WYSIWYG editor
- Change public budget page to be fully self-contained for assets: explicitly enqueue popups, material icons, Trumbowyg CSS/JS, and budget-admin JS with all dependencies inside the template when admin is viewing
- Change script cleanup on public budget page from a strict handle whitelist to a source-URL-based approach that keeps all WP core scripts (`/wp-includes/` and `/wp-admin/`) for admins, ensuring `wp.media` and its full dependency tree remain intact
- Change `pn_customers_manager_is_crm_page()` to return `false` for budget and invoice token-based public pages, preventing common.php from enqueuing unneeded scripts (aux.js, selector.js, owl.js, public.js) that caused console errors
- Change phase toggle switch to only appear when all items in the phase are optional, instead of when any item is optional
- Change phase toggle to only affect optional items (those with a toggle checkbox) instead of all items in the phase, in both public and admin JS
- Change optional item checkboxes to always be interactive regardless of budget status or user login state, removing the `disabled` attribute restriction
- Rename settings section from "Social Media Links" to "Marketing" and update its description to include CTA
- Rename settings subsection from "OpenAI" references to "AI Providers" where applicable
- Remove the Totals section from the budget WP Admin metabox (static display replaced by the live-updating totals in the items editor)
- Remove the Financial Management module entirely: delete `class-pn-customers-manager-financial.php`, its admin and front-end CSS, its admin and front-end JS, all financial AJAX handlers, settings section, hook registrations, and asset enqueue calls
- Remove `pn-customers-manager-public` script and style from the public budget page to prevent `owlCarousel is not a function` console error
- Remove Trumbowyg from the always-remove list on the public budget page for admin users so the WYSIWYG editor loads correctly
- Fix settings popup save button not persisting data to server — the save button now calls saveCanvas() after closing the popup
- Fix select fields in the funnel builder settings popup not saving: the custom pn_customers_manager_Selector jQuery plugin fires jQuery .trigger('change') events which native addEventListener('change') cannot capture; changed to jQuery(el).on('change') for SELECT elements
- Fix select/radio options appearing concatenated as a single option: changed storage format from newline-separated string to JSON array of {value, label} objects to prevent data loss during JSON serialization, with backward-compatible parsing for the legacy string format
- Fix sequential form navigation layout jumping when buttons are hidden/shown: back button is now disabled instead of hidden on the first step, and next button is disabled on the last step, maintaining consistent layout
- Fix tutorial completion not being saved: store 'completed' or 'skipped' string values instead of boolean to prevent WordPress from storing false as an empty string, which caused the tutorial to re-appear
- Remove URL and API Endpoint common fields from funnel node settings, keeping only Notes as the first common field

= 1.1.113 =

* **WooCommerce Checkout Custom Fields**: New product feature that allows adding custom fields to the checkout page per product. Configure fields with a visual interface in the product edit screen, supporting text, textarea, email, phone, number, date, select, radio, checkbox, and file upload field types. Fields are displayed at checkout, validated, and saved to order item metadata. Customer responses are visible in order details (admin and customer views) and included in order notification emails.
* **Checkout Fields Admin Interface**: Intuitive drag-and-drop field manager in WooCommerce product data tabs (before Calendar tab). Add, remove, and reorder fields with collapsible rows. Configure field type, label, internal name, placeholder, options (for select/radio/checkbox), description, and required status for each field.
* **Dynamic Field Rendering**: Fields automatically appear in checkout when customers add products with custom fields enabled. Supports all standard form validation and integrates seamlessly with WooCommerce checkout flow.
* **Order Integration**: Field data is stored in order item meta and displayed in order details pages, admin order view, customer order view, and order emails with proper formatting and labels.

= 1.1.105 =

* **Budgets**: Full budget/proposal system with item management, phases, optional items, tax and discount rates, public token-based sharing, customer acceptance workflow, inline editing, PDF generation, and CSV import/export.
* **Invoices**: Invoice management system with automatic numbering, due dates, payment tracking, status lifecycle (Draft → Sent → Paid/Cancelled), public token-based sharing, inline editing, and PDF generation.
* **Data Migration**: Safe one-time migration tool for budget items from legacy database table to post meta storage.
* **WhatsApp AI – Duplicate Gallery Fix**: Fixed a bug where gallery photos were sent twice when requesting additional product images.
* **WhatsApp AI – Improved Postal Code Response**: Removed overly effusive greeting from shipping zone postal code confirmations.
* **Dashboard Conversation Popups**: WhatsApp and Instagram conversation popups in the funnel builder now use the plugin's standard popup system with close, reset, and delete actions.
* **Debug Log Settings**: Independent settings to enable/disable debug logging for WhatsApp AI and Instagram AI. Logs are saved to `wp-content/uploads/pn-customers-manager-logs/` only when enabled.
* **CRM Manager Role**: Added CRM Manager user role with access to messages, statistics, projections, conversations, and commercial agents without full admin privileges.
* **WooCommerce QR Tickets**: Complete QR code ticketing system for WooCommerce products with unique code generation, customizable prefixes, and customer instructions. QR codes are automatically generated on order completion and displayed to customers on product pages (when logged in), in order completion emails, and in My Account order details.
* **QR Admin Management Panel**: Comprehensive admin panel for QR ticket management with compact table view, product and status filters, click-to-view detailed popup with QR image and order information, and action buttons to process, mark as pending, or delete tickets. Includes real-time status tracking with visual indicators (processed/pending). Entire table rows are clickable for improved usability.
* **QR Scanner**: Built-in QR code scanner using device camera for quick ticket validation with intelligent camera selection. Automatically prioritizes rear camera on mobile devices and provides camera switching button when multiple cameras are available. Detects already-processed codes and provides confirmation dialogs for all status changes.
* **QR Popup System**: Both scanner and detail view popups use the plugin's native popup system for consistent UI/UX across all plugin features. Includes proper overlay handling, ESC key support, and callback hooks.
* **QR Shortcode**: New `[pn_qr_manager]` shortcode to display the QR management panel on any page (admin only). Supports optional `product_id` parameter to filter by specific product. All required scripts and styles are automatically enqueued.
* **QR Mobile Optimization**: Fully responsive QR interface with stacked filters on mobile, icon-only status badges on tablets and phones, and optimized table layout. Admin panel includes scrollable container with max-height for long ticket lists.

= 1.0.0 =

Hello world!
