56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* @package Plumrocket_GlobalPrivacyControl
|
|
* @copyright Copyright (c) 2025 Plumrocket Inc.
|
|
* @license https://plumrocket.com/license End-user License Agreement
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Plumrocket\GlobalPrivacyControl\ViewModel;
|
|
|
|
use Magento\Framework\UrlInterface;
|
|
use Magento\Framework\View\Element\Block\ArgumentInterface;
|
|
use Plumrocket\GlobalPrivacyControl\Helper\Config\Geotargeting as GeotargetingConfig;
|
|
|
|
class Geotargeting implements ArgumentInterface
|
|
{
|
|
/**
|
|
* @var \Plumrocket\GlobalPrivacyControl\Helper\Config\Geotargeting
|
|
*/
|
|
private $geotargetingConfig;
|
|
|
|
/**
|
|
* @var \Magento\Framework\UrlInterface
|
|
*/
|
|
private $urlBuilder;
|
|
|
|
/**
|
|
* @param \Plumrocket\GlobalPrivacyControl\Helper\Config\Geotargeting $geotargetingConfig
|
|
* @param \Magento\Framework\UrlInterface $urlBuilder
|
|
*/
|
|
public function __construct(
|
|
GeotargetingConfig $geotargetingConfig,
|
|
UrlInterface $urlBuilder
|
|
) {
|
|
$this->geotargetingConfig = $geotargetingConfig;
|
|
$this->urlBuilder = $urlBuilder;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function isEnabled(): bool
|
|
{
|
|
return $this->geotargetingConfig->isEnabled();
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getApplicabilityUrl(): string
|
|
{
|
|
return rtrim($this->urlBuilder->getBaseUrl(), '/') . '/rest/V1/pr-global-privacy-control/geo-targeting/is-applicable';
|
|
}
|
|
}
|