<?php
/**
 * @author 1902 Software
 * @copyright Copyright © 2023 1902 Software (https://1902software.com/magento/)
 * @package WriteTextAI_WriteTextAI
 */
?>

<?php
    use WriteTextAI\WriteTextAI\ViewModel\Popups;
?>

<?php
    /** @var Popups $popups */
    $popups = $block->getPopups();
    $showByConfig = $popups->showPopup('welcome_new_version');

    $showPopup = $showByConfig;
?>

<div class="wtai-welcome-new-version-popup-modal" data-bind="scope: 'wtaiWelcomeNewVersionPopup'" style="display: none;">
    <div class="wtai-popup-content">
        <div class="wtai-popup-image">
            <img src="<?= $block->getViewFileUrl('WriteTextAI_WriteTextAI/images/welcome_banner.png') ?>" alt="Welcome new version">
        </div>
        <div class="wtai-popup-text">
            <div class="wtai-popup-title">
                <?= /* @noEscape */ __("Welcome to Version 3.5!") ?>
            </div>
            <div>
                <p>
                    <?= /* @noEscape */ __("WriteText.ai 3.5 brings a complete set of tools to"
                    . " help you scale and optimize content like never before. Build structured"
                    . " layouts with <strong>Templates</strong> and <strong>Custom Prompts</strong>,"
                    . " enrich product pages with <strong>Product Research</strong>,"
                    . " and streamline workflows end-to-end with <strong>Full Automation</strong>.") ?>
                </p>
                <p>
                    <?= /* @noEscape */ __("You’ll also get <strong>advanced keyword analysis with negative"
                    . " keywords</strong> plus <strong>flexible layout and styling options</strong>"
                    . " to adapt content perfectly to your store design. All features work"
                    . " together to deliver richer, search-friendly, and fully customizable ecommerce content.") ?>
                </p>
            </div>
            <div class="wtai-popup-buttons">
                <button type="button" class="action-primary primary" data-bind="click: closeNewVersionPopup">
                    <?= $block->escapeHtml(__('Got it')) ?>
                </button>
            </div>
        </div>
    </div>
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                    "wtaiWelcomeNewVersionPopup": {
                        "component": "WriteTextAI_WriteTextAI/js/popups/welcome-new-version",
                        "saveUrl": "<?= $block->escapeJs($block->getUrl('wtai/settings/popups')) ?>",
                        "showPopupOnLoad": <?= /* @noEscape */ $showPopup ? 'true' : 'false' ?>
                    }
                }
            }
        }
    }
</script>