<?php
if (!defined('ABSPATH')) {
    exit;
}
?>
<div class="wrap upvimeo-pricing-wrap">

    <?php
    // Ensure Freemius SDK exists
    if (!function_exists('upvimeo_fs')) {
        echo '<div class="notice notice-error"><p>' . esc_html__('Freemius SDK not initialized. Cannot load pricing plans.', 'upvimeo-direct-uploads') . '</p></div></div>';
        return;
    }

    // Use Native Freemius Pricing Page Render
    if (method_exists(upvimeo_fs(), '_pricing_page_render')) {
        // Freemius wraps its content but we can just render it here below our custom header.
        upvimeo_fs()->_pricing_page_render();
    } else {
        // Fallback to redirect if method is missing in an older or future SDK version
        $upvimeo_upvimeo_url = upvimeo_fs()->get_upgrade_url();
        wp_enqueue_script('upvimeo-admin');
        wp_add_inline_script('upvimeo-admin', 'window.location.href="' . esc_url($upvimeo_upvimeo_url) . '";');
        /* translators: %s: The pricing url */
        /* translators: %s: [Pricing URL] */
        echo '<div class="notice notice-warning"><p>' . wp_kses_post(sprintf(__('Redirecting to pricing... If you are not redirected, <a href="%s" target="_blank">click here</a>.', 'upvimeo-direct-uploads'), esc_url($upvimeo_upvimeo_url))) . '</p></div>';
    }
    ?>

</div>