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

<?php
/**
 * @var \WriteTextAI\WriteTextAI\Block\Adminhtml\ReviewNotice $block
 */

use WriteTextAI\WriteTextAI\ViewModel\Premium;

$premiumViewModel = $block->getPremium();
$membershipType = $premiumViewModel->getMembershipType();
?>

<div data-bind="scope: 'wtaiNotice'">
    <div data-bind="visible: isVisible" style="display: none;">
        <div class="messages">
            <?php if ($membershipType === Premium::MEMBERSHIP_TYPE_FREE_TRIAL): ?>
                <div class="message message-notice notice">
                    <div data-ui-id="messages-message-notice"><?= /** @noEscape */ $block->getBookNotice() ?></div>
                </div>
            <?php else: ?>
                <div class="message message-notice notice">
                    <div data-ui-id="messages-message-notice"><?= /** @noEscape */ $block->getNoticeMessage() ?></div>
                    <span class="action-close" data-bind="click: dismissNotice"></span>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>

<script type="text/x-magento-init">
{
    "*": {
        "Magento_Ui/js/core/app": {
            "components": {
                "wtaiNotice": {
                    "component": "WriteTextAI_WriteTextAI/js/review-notice",
                    "dismissUrl": "<?= $block->escapeJs($block->getDismissUrl()) ?>",
                    "isVisible": "<?= /** @noEscape */ $block->isVisible() ?>"
                }
            }
        }
    }
}
</script> 