=== WebLorem Sync for Contact Form 7 with Perfectum CRM ===
Contributors: eugenemazuryk, mazuryk
Tags: contact form 7, crm, perfectum, api, integration
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.4
Requires Plugins: contact-form-7
Stable tag: 4.1.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Synchronizes Contact Form 7 submissions with Perfectum CRM REST API. Admin panel for field mapping included.

== Description ==

This plugin captures form submissions from Contact Form 7 (`wpcf7_mail_sent` hook) and sends structured JSON data to Perfectum CRM API endpoints (e.g. `/leads`).

**Main features:**

* **Admin panel** — map any CF7 form to CRM fields without writing code (Contact → Sync with Perfectum CRM)
* **Field mapping** — CF7 input `name` attributes → CRM field keys
* **Custom fields** — send values into `custom_fields[entity][id]`
* **Static values** — set required Lead Source ID and Status ID per form
* **display_name prefix** — automatically append page title (`page_title`) to a prefix
* **Credentials** — configure API URL/Key in the admin UI, or override via `wp-config.php` constants
* **Legacy filter** — still supports code-based mappers via `wl_perfectum_cf7_form_mappers`
* **Logging** — HTTP status and responses written to `debug.log` when `WP_DEBUG` is enabled
* **i18n** — English UI with Ukrainian translation included

== Installation ==

1. Upload the `weblorem-sync-cf7-perfectum-crm` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Ensure **Contact Form 7** is installed and active
4. Go to **Contact → Sync with Perfectum CRM**
5. Enter API URL and API Key (or define constants in `wp-config.php`)
6. Add a form, map CF7 fields to CRM fields, set Source/Status IDs, and save

== Frequently Asked Questions ==

= Where do I get the API Key? =

In Perfectum CRM: **Settings → System → API Keys**.

= How do I set credentials in wp-config.php? =

Add these constants (they override the admin fields):

    define( 'PERFECTUM_API_URL', 'https://crm.yourdomain.com/api' );
    define( 'PERFECTUM_API_KEY', 'your_actual_api_token_here' );


= What is the CF7 field name? =

It is the `name` attribute of the form control, e.g. `your-name`, `your-email`, `your-phone`. Special value `page_title` is also supported.

= Can I still use PHP mappers? =

Yes. If a form is not configured (or not enabled) in the admin panel, the plugin falls back to the `wl_perfectum_cf7_form_mappers` filter for backwards compatibility.

== Changelog ==

= 4.1.3 =
* Plugin Check compliance (text domain matches slug, sanitization, escaping)
* Fixed readme Stable tag and Tested up to
* Ukrainian translation (PO/MO)

= 4.0.2 =
* Full i18n support
* Security and coding standards fixes

= 4.0.0 =
* Admin UI for form and field mapping
* Custom fields, source/status, display_name prefix

== Upgrade Notice ==

= 4.1.3 =
Recommended update for Plugin Check / security compliance and Ukrainian translation.
