<?php
/**
 * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
 */
?>
<?php // @codingStandardsIgnoreFile ?>
<?php
    /** @var \Temando\Shipping\Block\Adminhtml\ComponentContainer $block */
    /** @var \Temando\Shipping\ViewModel\Rma\ReturnShip $viewModel */
    $viewModel = $block->getViewModel();
?>
<div id="temando-componentry"
     data-bind="scope:'temando-componentry'"
     data-component-init='[
     {
        "entrypoint": "ReturnShip",
        "assetsUrl":"<?= $block->escapeUrl($block->getAssetsUrl()); ?>",
        "elements": {
            "main": "domElement",
            "m2PageActionsButtonsId": "temando-page-actions-buttons"
        },
        "data": {
            "defaultCurrency": "<?= $block->escapeHtml($viewModel->getDefaultCurrency()); ?>",
            "defaultDimensionsUnit": "<?= $block->escapeHtml($viewModel->getDefaultDimensionsUnit()); ?>",
            "defaultWeightUnit": "<?= $block->escapeHtml($viewModel->getDefaultWeightUnit()); ?>",
            "ipAddress": "<?= $block->escapeHtml($block->getIpAddress()); ?>",
            "lang": "<?= $block->escapeHtml($block->getLanguage()); ?>",
            "locale": "<?= $block->escapeHtml($block->getLocale()); ?>",
            "m2ApiAccessToken": "<?= $block->escapeHtml($viewModel->getCoreApiAccess()->getAccessToken()); ?>",
            "m2ApiAccessTokenTtl" : <?= /* @noEscape */ $viewModel->getCoreApiAccess()->getSessionExpirationTime(); ?>,
            "m2ApiReturnShippedEndpoint": "<?= $block->escapeUrl($viewModel->getSaveShipmentIdsEndpoint()); ?>",
            "m2ReturnData": <?= /* @noEscape */ str_replace("'", '\u0027', $viewModel->getReturnData()); ?>,
            "m2ReturnDataVersion": "1",
            "orderId": "<?= $block->escapeHtml($viewModel->getExtOrderId()); ?>",
            "orderMeta": <?= /* @noEscape */ $viewModel->getOrderMeta() ?>,
            "returnShipmentPageUrlTpl": "<?= $block->escapeUrl($viewModel->getRmaShipmentPageUrl()); ?>",
            "temandoApiEndpoint": "<?= $block->escapeUrl($viewModel->getShippingApiAccess()->getApiEndpoint()); ?>",
            "temandoApiToken": "<?= $block->escapeHtml($viewModel->getShippingApiAccess()->getSessionToken()); ?>",
            "temandoApiTokenTtl": "<?= $block->escapeHtml($viewModel->getShippingApiAccess()->getSessionTokenExpiry()); ?>"
        }
     }]'
>
    <!-- ko template: getTemplate() --><!-- /ko -->
    <script type="text/x-magento-init">
    {
        "#temando-componentry": {
            "Magento_Ui/js/core/app":  <?= /* @noEscape */ $block->getJsLayout(); ?>
        }
    }
    </script>
</div>
