=== Ordyum Lead Capture ===
Contributors: ordyum
Tags: crm, leads, live chat, contact form 7, woocommerce
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.0.0
WC requires at least: 8.0
License: GPLv2 or later

Sends form submissions and paid WooCommerce orders to Ordyum with their ad attribution. No Zapier needed.

== Description ==

* Forms: Contact Form 7, WPForms, Elementor Pro, Gravity Forms, Ninja Forms and Fluent Forms.
* WooCommerce: paid orders become customers in Ordyum with the campaign that brought them; optionally a won deal per order, which Ordyum sends to Google Ads and Meta as an offline conversion. Compatible with HPOS and the block checkout.
* Captures UTM parameters (including utm_id), Google Ads click ids (gclid, gbraid, wbraid), Meta fbclid and the _fbp/_fbc cookies in first-party cookies (90 days), plus landing page and referrer. Without the Meta pixel, the _fbc cookie is created from fbclid so Meta can still match conversions.
* On every successful submission, maps name, email, phone, company and message automatically (English, Spanish and French labels) and sends the rest as custom fields. Gravity Forms spam entries are skipped.
* If Ordyum is unreachable, the lead or order is queued and retried by WP-Cron with backoff. The same Idempotency-Key is reused, so retries never create duplicates.
* Website chat: one switch shows the Ordyum chat bubble on every page. Conversations land in the Ordyum inbox, the assistant answers from the workspace knowledge base (with the agency's own OpenAI key) and the team can take over at any time. Nothing to copy: the plugin gets the chat token with the site key.

== Installation ==

1. Upload the `ordyum` folder to `/wp-content/plugins/` and activate it.
2. In WordPress: Ordyum (left menu) → Connect with Ordyum.
3. Sign in to Ordyum, choose the workspace and click Connect website. You are sent back to WordPress already connected: Ordyum creates an API key just for this site (named "WordPress · your-domain").

Prefer an API key? Open "Use an API key instead", paste a key with write access (Ordyum → Settings → Integrations → API keys) and click Verify: the key is checked live and only saved if Ordyum accepts it. Agencies running their own Ordyum installation can change the server address there too.

Website chat: turn it on in Ordyum → Settings → Assistant, then switch on "Show the Ordyum chat on this site" in the plugin and save.

The connection is checked every time the panel opens. Disconnect revokes the site's key in Ordyum; the key can also be revoked from Ordyum → Settings → Integrations → Connected websites.

== Developers ==

* `ordyum_should_send( bool $send, array $context, array $fields )` — return false to skip a form.
* `ordyum_lead_payload( array|null $payload, array $context, array $fields )` — adjust the payload or return null to skip.
* `ordyum_should_send_order( bool $send, WC_Order $order )` — return false to skip an order.
* `ordyum_order_payload( array|null $payload, WC_Order $order )` — adjust the order payload (`POST /v1/orders`) or return null to skip.

The previous `ordium_*` filter names still run (before the `ordyum_*` ones).

`$context` contains `integration`, `form_id` and `form_name`.

== Privacy ==

The plugin sends the form fields, the buyer's billing name, email, phone and company, the order lines and the visit attribution to your Ordyum workspace. Password, file, consent and captcha fields are never sent. With the website chat on, visitors' chat messages, the page they write from and the contact details they leave in the chat go to the same workspace. Mention Ordyum as a processor in the site's privacy policy.

== Changelog ==

= 2.0.0 =
* Redesigned settings page with four tabs: Overview (sends, retries, connection and sources at a glance), Settings, Activity (the last 25 sends with contact, source and campaign, plus the retry queue with each error) and System status.
* System status lists the plugin, WordPress, PHP, WooCommerce, WP-Cron and queue details and copies a support report in one click. The report never contains the API key.
* The panel is now available in Arabic and Persian (right to left) as well as Spanish, French, German, Italian, Portuguese, Dutch, Polish and Turkish.

= 1.9.0 =
* Updates now come from Ordyum: WordPress lists new versions under Plugins with the changelog in your language and installs them automatically. Auto-updates are switched on once at install; you can turn them off in Plugins.
* Every download is checked against the SHA-256 checksum published by Ordyum before it is installed, and Ordyum shows which plugin version each connected site runs.

= 1.8.1 =
* Fixed "Connect with Ordyum" failing with "address not found": the default server is now https://ordyum.com. Sites that saved the old app.ordyum.com address are moved to ordyum.com automatically; a self-hosted server address is kept.

= 1.8.0 =
* New "Website chat" card: one switch loads the Ordyum chat on every page, in the language of each page. The card says whether the chat is live, ready, turned off in Ordyum or unreachable, with a link to its settings in Ordyum.
* The chat token is fetched with the site key and cached (12 hours, refreshed on save, connect and disconnect).

= 1.7.1 =
* Smaller Ordyum logo in the panel header (26 px).
* "Setup guide" opens the plugin documentation at ordyum.com/docs/wordpress.

= 1.7.0 =
* The connection card says exactly which Ordyum account the site is connected to: who authorized it (name and email), the workspace with its address, the agency, the site key and when it was connected. A self-hosted server is shown too.
* Existing connections pick up the account details on the next check, without reconnecting.

= 1.6.0 =
* Redesigned panel: the header shows which site you are on and whether it is connected, instead of a marketing banner.
* Recent activity: the last 8 leads and orders sent, with name, masked email, form or order number, campaign and whether they were sent, queued or not sent. A queued lead updates its row once it gets through.
* Connection errors are explained in plain words (address not found, timeout, SSL certificate, connection refused) with who can fix it; the raw cURL message is kept under "Technical details" for your hosting provider.
* Form plugins and WooCommerce options are shown as a simple settings list.

= 1.5.0 =
* Tested end to end on WordPress 7.1 with WooCommerce 11.2 (block checkout) and Contact Form 7 6.2: connection, leads with UTM/gclid and paid orders with their campaign.
* Cleaner panel: only the form plugins installed on this site appear as switches; the others are listed as compatible and keep their setting until you install them.
* WooCommerce options use the full width, and a clear message appears when WooCommerce is not active.
* New "Help and support" card with the setup guide, a link to contact support and what is new in this version.
* Spanish: "clave de API" instead of "API key".

= 1.4.0 =
* Connect with Ordyum: one click, sign in, choose the workspace and come back connected (OAuth 2.0 with PKCE). No API key to copy.
* API keys pasted by hand are verified live and only saved when Ordyum accepts them; read-only keys are flagged.
* New Ordyum menu with a redesigned panel: live connection status, connected workspace and agency, open in Ordyum, disconnect (revokes the site's key), counters of sent leads and the retry queue.
* Old Settings → Ordyum links redirect to the new menu. Translations: Spanish, French, German, Italian, Portuguese (Brazil), Dutch, Polish and Turkish.

= 1.3.0 =
* Ordium is now Ordyum. Installing this version deactivates the previous "Ordium Lead Capture" plugin and keeps its settings, status and pending queue.
* Attribution cookies and ordium_* filters written before the rename keep working.

= 1.2.0 =
* Gravity Forms, Ninja Forms and Fluent Forms.
* WooCommerce: paid orders (attribution saved at checkout), optional won deal per order, HPOS and block checkout compatible.
* utm_id is captured as the campaign id; the _fbc cookie is created from fbclid when the Meta pixel is not installed.

= 1.1.0 =
* When the agency's plan is full (HTTP 402) leads stay queued for a few more days and are sent once the plan is upgraded; the status table explains why.

= 1.0.0 =
* First release: Contact Form 7, WPForms and Elementor Pro, attribution cookies, retry queue, ES/FR translations.
