<?php
/**
 * Where Next presentation for Freemius-owned screens.
 */

if (!defined('ABSPATH')) {
    exit;
}

/**
 * Use the Connector logo anywhere Freemius requests the local plugin icon.
 *
 * @return string
 */
function wnc_freemius_plugin_icon() {
    return WNC_PATH . 'assets/logo.png';
}

wnc_fs()->add_filter('plugin_icon', 'wnc_freemius_plugin_icon');

/**
 * Load branding only on Freemius's Connector pricing screen.
 */
function wnc_enqueue_freemius_pricing_branding() {
    if (!wnc_fs()->is_admin_page('pricing')) {
        return;
    }

    wp_enqueue_style(
        'wnc-freemius-pricing',
        WNC_URL . 'assets/freemius-pricing.css',
        [],
        WNC_VERSION
    );

    wp_enqueue_script(
        'wnc-freemius-pricing',
        WNC_URL . 'assets/freemius-pricing.js',
        [],
        WNC_VERSION,
        true
    );

    wp_localize_script(
        'wnc-freemius-pricing',
        'wncPricingBrand',
        [
            'logoUrl'    => WNC_URL . 'assets/logo.png',
            'heading'    => __('Choose the right Where Next plan', 'where-next-connector'),
            'subheading' => __('Start free, then unlock automation and insights when you are ready.', 'where-next-connector'),
            'highlights' => [
                __('One plugin for Free and Pro', 'where-next-connector'),
                __('Instant licence activation', 'where-next-connector'),
                __('Your settings stay in WordPress', 'where-next-connector'),
            ],
        ]
    );
}

add_action('admin_enqueue_scripts', 'wnc_enqueue_freemius_pricing_branding', 20);
