<?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\CarrierEdit $viewModel */
    $viewModel = $block->getViewModel();
    $info = 'Carrier connections are where you set up your connections with your carriers using your account details.';
    $info.= ' Depending on the carrier, this may be instantly activated,';
    $info.= ' or take up to 2 days to verify the information provided';
?>
<?= $block->escapeHtml(__($info)) ?>
<div id="temando-componentry"
     data-bind="scope:'temando-componentry'"
     data-component-init='[
     {
        "entrypoint":"AvailableCarriers",
        "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()); ?>",
            "locale": "<?= $block->escapeHtml($block->getLocale()) ?>",
            "registerCarrierPageUrlTpl": "<?= $block->escapeUrl($viewModel->getCarrierUrl()->getCarrierRegistrationPageUrl()); ?>?integration_id=--id--"
        }
     }]'
>
    <!-- ko template: getTemplate() --><!-- /ko -->
    <script type="text/x-magento-init">
    {
        "#temando-componentry": {
            "Magento_Ui/js/core/app":  <?= /* @noEscape */ $block->getJsLayout(); ?>
        }
    }
    </script>
</div>
