<?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="<?= /* @noEscape */ $block->getViewFileUrl(
                'WriteTextAI_WriteTextAI/images/welcome_bannerv2.png'
            ) ?>" alt="Welcome new version">
        </div>
        <div class="wtai-popup-text">
            <div class="wtai-popup-title">
                <?= /* @noEscape */ __("Welcome to WriteText.ai 4.4") ?>
            </div>
            <div>
                <p class="wtai-popup-text-description">
                    <?= /* @noEscape */ __(
                        'This release brings two major updates:'
                    ) ?>
                </p>
                <p class="wtai-check-item">
                    <span class="wtai-check-icon wtai-check-icon-top" ></span>
                    <span>
                    <?= /* @noEscape */ __(
                        '<strong>Bulk actions for categories</strong>: '
                        . 'Run keyword analysis, generate content, '
                        . 'and transfer for multiple categories at once, fully automated, '
                        . 'using the same workflow available for products.'
                    ) ?>
                    </span>
                </p>
                 <p class="wtai-check-item">
                    <span class="wtai-check-icon wtai-check-icon-top"></span>
                    <span>
                       <?= /* @noEscape */ __(
                           '<strong>Improved keyword analysis</strong>: '
                           . 'Enriched product context helps the AI identify what each product actually is, '
                           . 'producing more accurate seed keywords and competitor extraction.'
                       ) ?>
                    </span>
                </p>
            </div>
            <div class="wtai-popup-buttons">
                <button type="button" class="action-primary primary" data-bind="click: closeNewVersionPopup">
                    <?= $escaper->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": "<?= $escaper->escapeJs($block->getUrl('wtai/settings/popups')) ?>",
                        "showPopupOnLoad": <?= /* @noEscape */ $showPopup ? 'true' : 'false' ?>
                    }
                }
            }
        }
    }
</script>