<?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\Carrier\CarrierRegistration $viewModel */
    $viewModel = $block->getViewModel();
?>
<div id="temando-componentry"
     data-bind="scope:'temando-componentry'"
     data-component-init='[
     {
        "entrypoint":"CarrierRegistration",
        "assetsUrl":"<?= $block->escapeUrl($block->getAssetsUrl());?>",
        "data" : {
            "temandoApiEndpoint": "<?= $block->escapeUrl($viewModel->getShippingApiAccess()->getApiEndpoint()) ?>",
            "temandoApiToken": "<?= $block->escapeHtml($viewModel->getShippingApiAccess()->getSessionToken()) ?>",
            "temandoApiTokenTtl": "<?= $block->escapeHtml($viewModel->getShippingApiAccess()->getSessionTokenExpiry()) ?>",
            "m2ApiTemandoTokenRefreshEndpoint": "<?= $block->escapeUrl($viewModel->getShippingApiAccess()->getSessionTokenRefreshEndpoint()) ?>",
            "ipAddress": "<?= $block->escapeHtml($block->getIpAddress()) ?>",
            "lang": "<?= $block->escapeHtml($block->getLanguage()) ?>",
            "locale": "<?= $block->escapeHtml($block->getLocale()) ?>",
            "carrierId": "<?= $block->escapeHtml($viewModel->getCarrierIntegrationId()) ?>",
            "availableCarriersPageUrl": "<?= $block->escapeUrl($viewModel->getCarrierUrl()->getNewActionUrl()) ?>",
            "myCarriersPageUrl": "<?= $block->escapeUrl($viewModel->getCarrierUrl()->getListActionUrl()) ?>"
        }
     }]'
>
    <!-- ko template: getTemplate() --><!-- /ko -->
    <script type="text/x-magento-init">
    {
        "#temando-componentry": {
            "Magento_Ui/js/core/app":  <?= /* @noEscape */ $block->getJsLayout(); ?>
        }
    }
    </script>
</div>

