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

<?php
/** @var WriteTextAI\WriteTextAI\ViewModel\Permissions|null $permissions */
$permissions = $block->getData('permissions');
$isViewerUser = $permissions ? !$permissions->isReviewAllowed() : false;
?>

<div class="wtai-edit-modal-wrapper" data-bind="scope: 'wtaiEditModal'">
    <div class="wtai-edit-modal-content" data-bind="blockLoader: isLoading">
        <?= /* @noEscape */ $block->getChildHtml(); ?>
    </div>
</div>
<script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/block-loader":
                "<?= $escaper->escapeJs($block->getViewFileUrl('images/loader-1.gif')) ?>",
            "Magento_Ui/js/core/app": {
                "components": {
                    "wtaiEditModal": {
                        "component": "WriteTextAI_WriteTextAI/js/edit",
                        "modalSelector": ".wtai-edit-modal-wrapper",
                        "editUrl": "<?= $escaper->escapeJs($block->getUrl('wtai/edit/index')) ?>",
                        "isViewerUser": <?= $isViewerUser ? 'true' : 'false' ?>
                    }
                }
            }
        }
    }
</script>
