=== LinkCheck SEO Revenue-Leak Calculator ===
Contributors: linkcheckapp
Tags: seo, roi, calculator, lead generation, revenue
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Free "Cost of Inaction" SEO revenue-leak calculator for agencies. Embed on any page to capture leads. Requires an active linkcheck.app license.

== Description ==

The LinkCheck SEO Revenue-Leak Calculator is a free WordPress plugin that helps SEO agencies demonstrate the cost of poor rankings to potential clients.

**How it works:**

1. A prospect enters their keyword's monthly search volume, current ranking position, and customer LTV.
2. The calculator runs a conservative, evidence-based formula chain using industry-standard CTR curves.
3. Results show the cumulative 24-month revenue leak — the money they're leaving on the table.
4. To unlock the full tri-state breakdown, prospects enter a work email (captured as a lead).
5. Leads are stored in YOUR WordPress database and routed to your configured destination.

**Agency features:**

* White-labeled public widget with your agency branding and colors.
* Tri-state scenarios: Conservative (primary), Standard, and Optimistic.
* CSS-only gap visualization — no charting library dependencies.
* Encoded URL sharing: every calculation generates a shareable link.
* 2-step input form with progressive disclosure.
* Mobile-optimized, CLS-free widget.
* Gutenberg block and shortcode `[linkcheck_roi_calculator]`.
* Lead management dashboard inside WordPress admin.
* PDF report generation for prospects.

**License model:**

The plugin is free with ongoing updates as long as you maintain a do-follow backlink to linkcheck.app on your published guest post. This is disclosed upfront in the plugin onboarding. If the backlink is removed, the calculator gracefully degrades — it still loads but stops calculating and shows a clear notice. Your site is never broken.

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/linkcheck-roi-calculator/` or install via the WordPress plugin directory.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Go to **LinkCheck ROI Calc → Settings** and configure your agency branding and lead routing.
4. Enter your license key (obtained from linkcheck.app when your guest post with do-follow backlink is published).
5. Place `[linkcheck_roi_calculator]` on any page or add the "LinkCheck ROI Calculator" Gutenberg block.

== Frequently Asked Questions ==

= Does linkcheck.app receive my lead data? =

No. All leads are stored in your WordPress database and routed to your configured destination (email/webhook). linkcheck.app never sees or stores your prospects' information.

= Does the widget show linkcheck.app branding to my visitors? =

No. The public-facing calculator is fully white-labeled with your agency branding. linkcheck.app branding only appears in the WordPress admin dashboard.

= What happens if I remove the backlink? =

The calculator continues to load on your site but stops producing results and shows a non-destructive notice. Your site is never broken. This is clearly disclosed during onboarding.

= Is the math transparent? =

Yes. The formula chain is documented in the plugin. Constants are labeled as conservative internal assumptions pending formal sourcing. No compounding tricks — the 24-month figure is linear.

== Screenshots ==

1. Calculator widget — step 1 input fields (volume, position, LTV).
2. Calculator widget — step 2 with advanced CTR curve settings.
3. Calculator results — tri-state revenue leak breakdown with gate.
4. Calculator results — full unlocked view with calendar CTA.
5. Admin settings — agency branding and lead routing configuration.
6. Admin leads table — captured prospects with export capability.
7. License status page — key management and backlink verification.

== Upgrade Notice ==

= 1.1.0 =
Internationalization support, enhanced security, performance improvements, and UX refinements. Backward-compatible update — existing settings and leads preserved.

= 1.0.0 =
Initial release. SEO revenue-leak calculator with lead capture, tri-state scenarios, PDF export, and license verification.

== Developer Hooks ==

The plugin provides the following WordPress hooks for developers and agencies:

**Filters:**

`lcrc_widget_data_attrs` (string, array)
    Filters the assembled data attributes on the calculator widget host element. Use this to inject custom data attributes without forking the plugin.
    
    Parameters:
    - `$data_attr_string` (string) The assembled HTML data attribute string.
    - `$data_attrs` (array) The associative array of data attributes before assembly.
    
    Example:
    ```
    add_filter('lcrc_widget_data_attrs', function($attrs, $data) {
        return $attrs . ' data-custom-attr="my-value"';
    }, 10, 2);
    ```

**Actions:**

`lcrc_routing_failed` (string, string, array, array)
    Fires when lead routing (email or webhook) fails. Use this for custom logging or fallback routing.
    
    Parameters:
    - `$method` (string) 'email' or 'webhook'.
    - `$email` (string) The prospect's email.
    - `$inputs` (array) Calculator input values.
    - `$outputs` (array) Calculator output values.

== Changelog ==

= 1.1.0 =
* Internationalization (i18n) for all JavaScript display strings via wp_localize_script.
* New: lcrc_widget_data_attrs filter for developer extensibility.
* New: lcrc_routing_failed action for custom logging/fallback on routing errors.
* Security: rate limit transient cleared on successful lead capture.
* Security: server-side range validation on all numeric inputs.
* Performance: register_post_meta moved from activation hook to init.
* Performance: JS templates split into separate file for smaller initial payload.
* UX: loading state on Calculate Revenue Leak button.
* UX: aria-expanded attribute on Advanced Settings toggle.
* UX: agency name now rendered in the widget results area.
* Admin: enhanced uninstall.php to clear all plugin transients.
* Admin: lead routing failures now fire an action hook instead of error_log.

= 1.0.0 =
* Initial release.
* SEO revenue-leak calculator with tri-state scenarios.
* Shadow DOM widget with zero-CLS guarantee.
* Lead capture, storage, and routing.
* License verification with graceful degradation.
* Gutenberg block and shortcode support.
* Encoded URL sharing.
* Mobile-optimized, vanilla JS (no jQuery/React/Chart.js dependency).
