ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,29 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
namespace Plumrocket\CookieConsentPro\Api\Data;
use Plumrocket\CookieConsent\Api\Data\ConsentLogInterface as BaseInterface;
/**
* @since 1.0.1
*/
interface ConsentLogInterface extends BaseInterface
{
public const INITIATED_BY = 'initiated_by';
/**
* @return string|null
*/
public function getInitiatedBy();
/**
* @param string $initiatedBy
* @return mixed
*/
public function setInitiatedBy(string $initiatedBy);
}
@@ -0,0 +1,65 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Block\Adminhtml\System\Config\Form\GlobalPrivacyControl;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
/**
* @since 1.0.1
*/
class CookieCategoriesToDecline extends Field
{
/**
* Render element html with disabled essential cookie categories
*
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element): string
{
$html = parent::_getElementHtml($element);
if (! $element->getValues()) {
return $html;
}
$disabledCategories = [];
foreach ($element->getValues() as $option) {
if ($option['isEssential']) {
$disabledCategories[] = $option['value'];
}
}
if (empty($disabledCategories)) {
return $html;
}
$html .= '<script>
require(["jquery", "domReady!"], function($) {
var disabledOptions = ' . json_encode($disabledCategories) . ';
var select = $("#' . $element->getHtmlId() . '");
function disableOptions() {
$.each(disabledOptions, function(index, value) {
select.find("option[value=\'" + value + "\']").prop("disabled", true);
});
}
disableOptions();
select.on("change", function() {
setTimeout(disableOptions, 50);
});
});
</script>';
return $html;
}
}
@@ -0,0 +1,44 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Block\Adminhtml\System\Config\Form\GlobalPrivacyControl;
use Magento\Backend\Block\Widget\Button;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
/**
* @since 1.0.1
*/
class OpenSettingsButton extends Field
{
public function render(AbstractElement $element)
{
$html = '<td class="value" colspan="3">';
$html .= $this->_getElementHtml($element);
$html .= '</td>';
return $html;
}
protected function _getElementHtml(AbstractElement $element)
{
$url = $this->getUrl('*/*/*',['section' => 'pr_gpc']);
/** @var \Magento\Backend\Block\Widget\Button $buttonBlock */
$buttonBlock = $this->getLayout()
->createBlock(Button::class)
->setData([
'id' => $element->getHtmlId(),
'label' => __('Go to GPC Settings'),
'onclick' => "setLocation('" . $url . "')"
]);
return $buttonBlock->toHtml();
}
}
@@ -0,0 +1,81 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Config\Backend\GlobalPrivacyControl;
use Magento\Framework\App\Config\Value;
/**
* @since 1.0.1
*/
class CookieCategoriesToDecline extends Value
{
/**
* @var \Plumrocket\CookieConsentPro\Model\Config\Source\CookieCategories
*/
private $cookieCategories;
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
* @param \Plumrocket\CookieConsentPro\Model\Config\Source\CookieCategories $cookieCategories
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
\Plumrocket\CookieConsentPro\Model\Config\Source\CookieCategories $cookieCategories,
?\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
?\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct(
$context,
$registry,
$config,
$cacheTypeList,
$resource,
$resourceCollection,
$data
);
$this->cookieCategories = $cookieCategories;
}
/**
* Remove essential cookie categories from value before save
*
* @return $this
*/
public function beforeSave()
{
$value = $this->getValue();
if (! is_array($value)) {
$value = explode(',', (string)$value);
}
$disabledCategories = [];
foreach ($this->cookieCategories->toOptionArray() as $option) {
if ($option['isEssential']) {
$disabledCategories[] = $option['value'];
}
}
// Remove essential categories from the value
$value = array_diff($value, $disabledCategories);
$this->setValue($value);
return parent::beforeSave();
}
}
@@ -0,0 +1,32 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Config\Source;
use Plumrocket\Base\Model\OptionSource\AbstractSource;
/**
* @since 1.0.1
*/
class ConsentInitiator extends AbstractSource
{
public const INITIATOR_CUSTOMER = 'customer';
public const INITIATOR_GPC = 'gpc';
/**
* @return array
*/
public function toOptionHash(): array
{
return [
self::INITIATOR_CUSTOMER => __('Customer'),
self::INITIATOR_GPC => __('GPC Signal'),
];
}
}
@@ -0,0 +1,63 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Config\Source;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Data\OptionSourceInterface;
use Plumrocket\CookieConsent\Model\CategoryRepository;
/**
* @since 1.0.1
*/
class CookieCategories implements OptionSourceInterface
{
/**
* @var \Magento\Framework\Api\SearchCriteriaBuilder
*/
private $searchCriteriaBuilder;
/**
* @var \Plumrocket\CookieConsent\Model\CategoryRepository
*/
private $cookieCategoryRepository;
/**
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
* @param \Plumrocket\CookieConsent\Model\CategoryRepository $cookieCategoryRepository
*/
public function __construct(
SearchCriteriaBuilder $searchCriteriaBuilder,
CategoryRepository $cookieCategoryRepository
) {
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->cookieCategoryRepository = $cookieCategoryRepository;
}
/**
* @return array
*/
public function toOptionArray(): array
{
$options = [];
$categories = $this->cookieCategoryRepository
->getList($this->searchCriteriaBuilder->create())
->getItems();
foreach ($categories as $category) {
$options[] = [
'value' => $category->getKey(),
'label' => $category->getName(),
'isEssential' => $category->getIsEssential()
];
}
return $options;
}
}
@@ -0,0 +1,32 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Config\Source\GlobalPrivacyControl;
use Plumrocket\Base\Model\OptionSource\AbstractSource;
/**
* @since 1.0.1
*/
class CookieConsentBehavior extends AbstractSource
{
public const DECLINE_ALL_CATEGORIES = 'decline_all';
public const DECLINE_SPECIFIC_CATEGORIES = 'decline_specific';
/**
* @return array
*/
public function toOptionHash(): array
{
return [
self::DECLINE_ALL_CATEGORIES => __('Decline All Non-Essential Cookies'),
self::DECLINE_SPECIFIC_CATEGORIES => __('Decline Specific Cookie Categories'),
];
}
}
@@ -0,0 +1,50 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Consent;
use Magento\Framework\Model\AbstractModel;
use Plumrocket\CookieConsentPro\Api\Data\ConsentLogInterface;
/**
* @since 1.0.1
*/
class Log extends \Plumrocket\CookieConsent\Model\Consent\Log implements ConsentLogInterface
{
/**
* @inheritDoc
*/
public function getInitiatedBy()
{
return $this->getData(self::INITIATED_BY);
}
/**
* @inheritDoc
*/
public function setInitiatedBy(string $initiatedBy)
{
$this->setData(self::INITIATED_BY, $initiatedBy);
return $this;
}
/**
* @return AbstractModel
*/
public function beforeSave()
{
$initiatedBy = $this->getInitiatedBy();
if (empty($initiatedBy)) {
$this->setInitiatedBy('Сustomer');
}
return parent::beforeSave();
}
}
@@ -0,0 +1,93 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Consent;
use Magento\Customer\Helper\Session\CurrentCustomer;
use Magento\Framework\App\Response\RedirectInterface;
use Magento\Framework\HTTP\Header;
use Magento\Framework\HTTP\PhpEnvironment\RemoteAddress;
use Magento\Framework\Stdlib\DateTime\DateTime;
use Magento\Store\Model\StoreManagerInterface;
use Plumrocket\CookieConsent\Api\Data\ConsentLogInterface;
use Plumrocket\CookieConsent\Api\Data\ConsentLogInterfaceFactory;
use Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog as ConsentLogResource;
use Plumrocket\CookieConsentPro\Api\Data\ConsentLogInterface as ProConsentLogInterface;
use Plumrocket\CookieConsentPro\Model\Config\Source\ConsentInitiator;
use Plumrocket\GlobalPrivacyControl\Api\IsGpcSignalHandledInterface;
/**
* @since 1.0.1
*/
class Logger extends \Plumrocket\CookieConsent\Model\Consent\Logger
{
/**
* @var \Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog
*/
private $consentLogResource;
/**
* @var \Plumrocket\GlobalPrivacyControl\Api\IsGpcSignalHandledInterface
*/
private $isGpcSignalHandled;
/**
* @param \Plumrocket\CookieConsent\Api\Data\ConsentLogInterfaceFactory $consentLogFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $remoteAddress
* @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
* @param \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer
* @param \Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog $consentLogResource
* @param \Magento\Framework\HTTP\Header $httpHeader
* @param \Magento\Framework\App\Response\RedirectInterface $redirect
* @param \Plumrocket\GlobalPrivacyControl\Api\IsGpcSignalHandledInterface $isGpcSignalHandled
*/
public function __construct(
ConsentLogInterfaceFactory $consentLogFactory,
StoreManagerInterface $storeManager,
RemoteAddress $remoteAddress,
DateTime $dateTime,
CurrentCustomer $currentCustomer,
ConsentLogResource $consentLogResource,
Header $httpHeader,
RedirectInterface $redirect,
IsGpcSignalHandledInterface $isGpcSignalHandled
) {
parent::__construct(
$consentLogFactory,
$storeManager,
$remoteAddress,
$dateTime,
$currentCustomer,
$consentLogResource,
$httpHeader,
$redirect
);
$this->consentLogResource = $consentLogResource;
$this->isGpcSignalHandled = $isGpcSignalHandled;
}
/**
* @param array $settings
* @return \Plumrocket\CookieConsent\Api\Data\ConsentLogInterface
* @throws \Magento\Framework\Exception\AlreadyExistsException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function log(array $settings): ConsentLogInterface
{
$consentLog = parent::log($settings);
if ($this->isGpcSignalHandled->execute()) {
$consentLog->setData(ProConsentLogInterface::INITIATED_BY, ConsentInitiator::INITIATOR_GPC);
$this->consentLogResource->save($consentLog);
}
return $consentLog;
}
}
@@ -0,0 +1,113 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Integration;
use Plumrocket\Base\Api\ConfigUtilsInterface;
use Plumrocket\CookieConsent\Helper\Config;
use Plumrocket\GlobalPrivacyControl\Helper\Config as GlobalPrivacyControlConfig;
use Plumrocket\CookieConsentPro\Model\Config\Source\CookieCategories;
use \Plumrocket\CookieConsentPro\Model\Config\Source\GlobalPrivacyControl\CookieConsentBehavior;
/**
* @since 1.0.1
*/
class GlobalPrivacyControl
{
public const XML_PATH_COOKIE_CONSENT_BEHAVIOR = 'pr_gpc/cookie_consent_management/behavior';
public const XML_PATH_COOKIE_CATEGORIES_TO_DECLINE = 'pr_gpc/cookie_consent_management/categories_to_decline';
/**
* @var \Plumrocket\CookieConsent\Helper\Config
*/
private $config;
/**
* @var \Plumrocket\CookieConsentPro\Model\Config\Source\CookieCategories
*/
private $cookieCategories;
/**
* @var \Plumrocket\GlobalPrivacyControl\Helper\Config
*/
private $globalPrivacyControlConfig;
/**
* @var \Plumrocket\Base\Api\ConfigUtilsInterface
*/
private $configUtils;
/**
* @param \Plumrocket\CookieConsent\Helper\Config $config
* @param \Plumrocket\CookieConsentPro\Model\Config\Source\CookieCategories $cookieCategories
* @param \Plumrocket\GlobalPrivacyControl\Helper\Config $globalPrivacyControlConfig
* @param \Plumrocket\Base\Api\ConfigUtilsInterface $configUtils
*/
public function __construct(
Config $config,
CookieCategories $cookieCategories,
GlobalPrivacyControlConfig $globalPrivacyControlConfig,
ConfigUtilsInterface $configUtils
) {
$this->config = $config;
$this->cookieCategories = $cookieCategories;
$this->globalPrivacyControlConfig = $globalPrivacyControlConfig;
$this->configUtils = $configUtils;
}
/**
* @return bool
*/
public function isEnabled(): bool
{
if (! $this->config->isModuleEnabled()) {
return false;
}
if (! $this->globalPrivacyControlConfig->isModuleEnabled())
{
return false;
}
return true;
}
/**
* @param $store
* @return bool
*/
public function shouldDeclineAllCategories($store = null): bool
{
return CookieConsentBehavior::DECLINE_ALL_CATEGORIES === $this->configUtils->getStoreConfig(self::XML_PATH_COOKIE_CONSENT_BEHAVIOR, $store);
}
/**
* Get non-essential cookie categories to decline
*
* @param null $store
* @return array
*/
public function getCategoriesToDecline($store = null): array
{
$categoriesToDecline = $this->shouldDeclineAllCategories()
? array_keys($this->cookieCategories->toOptionHash())
: $this->configUtils->prepareMultiselectValue(
$this->configUtils->getStoreConfig(self::XML_PATH_COOKIE_CATEGORIES_TO_DECLINE, $store)
);
$essentialCategories = [];
foreach ($this->cookieCategories->toOptionArray() as $option) {
if ($option['isEssential']) {
$essentialCategories[] = $option['value'];
}
}
return array_diff($categoriesToDecline, $essentialCategories);
}
}
@@ -0,0 +1,97 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Integration;
use Magento\Framework\Serialize\SerializerInterface;
use Plumrocket\Base\Api\ConfigUtilsInterface;
use Plumrocket\CookieConsent\Helper\Config;
/**
* @since 1.0.0
*/
class MicrosoftAds
{
public const XML_PATH_ENABLED = 'pr_cookie/integrations/microsoft_ads/enabled';
public const XML_PATH_CONSENT_TYPES = 'pr_cookie/integrations/microsoft_ads/consent_types';
/**
* @var \Plumrocket\CookieConsent\Helper\Config
*/
private $config;
/**
* @var \Plumrocket\Base\Api\ConfigUtilsInterface
*/
private $configUtils;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/**
* @param \Plumrocket\CookieConsent\Helper\Config $config
* @param \Plumrocket\Base\Api\ConfigUtilsInterface $configUtils
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/
public function __construct(
Config $config,
ConfigUtilsInterface $configUtils,
SerializerInterface $serializer
) {
$this->config = $config;
$this->configUtils = $configUtils;
$this->serializer = $serializer;
}
/**
* @return bool
*/
public function isEnabled(): bool
{
if (! $this->config->isModuleEnabled()) {
return false;
}
if (! $this->configUtils->isSetFlag(self::XML_PATH_ENABLED)) {
return false;
}
if (! $this->getConsentTypesConfig()) {
return false;
}
return true;
}
/**
* @param $store
* @return array[]
*/
public function getConsentTypesConfig($store = null): array
{
$config = $this->configUtils->getStoreConfig(self::XML_PATH_CONSENT_TYPES, $store);
if (is_string($config)) {
$config = $this->serializer->unserialize($config);
}
$result = [];
foreach ($config as $item) {
$consentType = $item['consent_type'];
$result[$consentType] = [
'cookie_category' => $item['cookie_category'],
'default_status' => $item['status'],
];
}
return $result;
}
}
@@ -0,0 +1,99 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Model\Integration;
use Magento\Framework\Serialize\SerializerInterface;
use Plumrocket\Base\Api\ConfigUtilsInterface;
use Plumrocket\CookieConsent\Helper\Config;
/**
* @since 1.0.0
*/
class MicrosoftClarity
{
public const XML_PATH_ENABLED = 'pr_cookie/integrations/microsoft_clarity/enabled';
public const XML_PATH_CONSENT_TYPES = 'pr_cookie/integrations/microsoft_clarity/consent_types';
/**
* @var \Plumrocket\CookieConsent\Helper\Config
*/
private $config;
/**
* @var \Plumrocket\Base\Api\ConfigUtilsInterface
*/
private $configUtils;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/**
* @param \Plumrocket\CookieConsent\Helper\Config $config
* @param \Plumrocket\Base\Api\ConfigUtilsInterface $configUtils
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/
public function __construct(
Config $config,
ConfigUtilsInterface $configUtils,
SerializerInterface $serializer
) {
$this->config = $config;
$this->configUtils = $configUtils;
$this->serializer = $serializer;
}
/**
* @return bool
*/
public function isEnabled(): bool
{
if (! $this->config->isModuleEnabled()) {
return false;
}
if (! $this->configUtils->isSetFlag(self::XML_PATH_ENABLED)) {
return false;
}
if (! $this->getConsentTypesConfig()) {
return false;
}
return true;
}
/**
* Get consent types config.
*
* @param mixed $store
* @return array
*/
public function getConsentTypesConfig($store = null): array
{
$config = $this->configUtils->getStoreConfig(self::XML_PATH_CONSENT_TYPES, $store);
if (is_string($config)) {
$config = $this->serializer->unserialize($config);
}
$result = [];
foreach ($config as $item) {
$consentType = $item['consent_type'];
$result[$consentType] = [
'cookie_category' => $item['cookie_category'],
'default_status' => $item['status'],
];
}
return $result;
}
}
@@ -0,0 +1 @@
Plumrocket Cookie Consent Pro Extension for M2
@@ -0,0 +1,110 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Setup\Patch\Data;
use Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory;
use Magento\Framework\App\Config\Storage\WriterInterface;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Plumrocket\CookieConsentPro\Model\Integration\MicrosoftClarity as MicrosoftClarityConfig;
/**
* @since 1.1.0
*/
class MigrateMicrosoftClarityConfigToV2 implements DataPatchInterface
{
private const V2_CONSENT_TYPES = [
'item1' => [
'consent_type' => 'ad_Storage',
'status' => 'denied',
'cookie_category' => null,
],
'item2' => [
'consent_type' => 'analytics_Storage',
'status' => 'denied',
'cookie_category' => null,
],
];
/**
* @var \Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory
*/
private $configDataCollectionFactory;
/**
* @var \Magento\Framework\App\Config\Storage\WriterInterface
*/
private $configWriter;
/**
* @var \Magento\Framework\Serialize\Serializer\Json
*/
private $jsonSerializer;
/**
* @param \Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory $configDataCollectionFactory
* @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
* @param \Magento\Framework\Serialize\Serializer\Json $jsonSerializer
*/
public function __construct(
CollectionFactory $configDataCollectionFactory,
WriterInterface $configWriter,
Json $jsonSerializer
) {
$this->configDataCollectionFactory = $configDataCollectionFactory;
$this->configWriter = $configWriter;
$this->jsonSerializer = $jsonSerializer;
}
/**
* @inheritDoc
*/
public function apply()
{
$legacyCategoryConfigs = $this->configDataCollectionFactory->create();
$legacyCategoryConfigs->addFieldToFilter('path', 'pr_cookie/integrations/microsoft_clarity/category');
/** @var \Magento\Framework\App\Config\Value $legacyCategoryConfig */
foreach ($legacyCategoryConfigs as $legacyCategoryConfig) {
$categoryKey = (string) $legacyCategoryConfig->getValue();
if (! $categoryKey) {
continue;
}
$configDataItemValue = self::V2_CONSENT_TYPES;
foreach ($configDataItemValue as $key => $consentType) {
$configDataItemValue[$key]['cookie_category'] = $categoryKey;
}
$this->configWriter->save(
MicrosoftClarityConfig::XML_PATH_CONSENT_TYPES,
$this->jsonSerializer->serialize($configDataItemValue),
$legacyCategoryConfig->getScope(),
(int) $legacyCategoryConfig->getScopeId()
);
}
}
/**
* @inheritDoc
*/
public static function getDependencies()
{
return [];
}
/**
* @inheritDoc
*/
public function getAliases()
{
return [];
}
}
@@ -0,0 +1,78 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Setup\Patch\Data;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog as ConsentLogResource;
use Plumrocket\CookieConsentPro\Api\Data\ConsentLogInterface;
use Plumrocket\CookieConsentPro\Model\Config\Source\ConsentInitiator;
/**
* @since 1.0.1
*/
class UpdateLightVersionConsentLogForPro implements DataPatchInterface
{
/**
* @var \Magento\Framework\Setup\ModuleDataSetupInterface
*/
private $moduleDataSetup;
/**
* @var \Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog
*/
private $consentLogResource;
/**
* @param \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup
* @param \Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog $consentLogResource
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
ConsentLogResource $consentLogResource
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->consentLogResource = $consentLogResource;
}
/**
* @inheritdoc
*/
public function apply()
{
$setup = $this->moduleDataSetup;
$connection = $setup->getConnection();
$setup->startSetup();
$connection->update(
$this->consentLogResource->getMainTable(),
[ConsentLogInterface::INITIATED_BY => ConsentInitiator::INITIATOR_CUSTOMER],
sprintf('%s IS NULL', ConsentLogInterface::INITIATED_BY)
);
$setup->endSetup();
}
/**
* @inheritdoc
*/
public static function getDependencies()
{
return [];
}
/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}
@@ -0,0 +1,63 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\Ui\Component\Listing\Columns;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Ui\Component\Listing\Columns\Column;
use Plumrocket\CookieConsentPro\Model\Config\Source\ConsentInitiator as ConsentInitiatorSource;
/**
* @since 1.0.1
*/
class ConsentInitiator extends Column
{
/**
* @var \Plumrocket\CookieConsentPro\Model\Config\Source\ConsentInitiator
*/
private $consentInitiatorSource;
/**
* @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context
* @param \Magento\Framework\View\Element\UiComponentFactory $uiComponentFactory
* @param \Plumrocket\CookieConsentPro\Model\Config\Source\ConsentInitiator $consentInitiatorSource
* @param array $components
* @param array $data
*/
public function __construct(
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
ConsentInitiatorSource $consentInitiatorSource,
array $components = [],
array $data = []
) {
parent::__construct($context, $uiComponentFactory, $components, $data);
$this->consentInitiatorSource = $consentInitiatorSource;
}
/**
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource): array
{
$columnName = $this->getData('name');
$optionsLabels = $this->consentInitiatorSource->toOptionHash();
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
$originalValue = $item[$columnName];
$item[$columnName] = $optionsLabels[$originalValue] ?? $originalValue;
}
}
return $dataSource;
}
}
@@ -0,0 +1,120 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\ViewModel\Integration;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Plumrocket\CookieConsent\Model\CategoryRepository;
use Plumrocket\CookieConsentPro\Model\Integration\GlobalPrivacyControl as GlobalPrivacyControlIntegrationConfig;
/**
* @since 1.0.1
*/
class GlobalPrivacyControl implements ArgumentInterface
{
/**
* @var \Magento\Framework\Api\SearchCriteriaBuilder
*/
private $searchCriteriaBuilder;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/**
* @var \Plumrocket\CookieConsent\Model\CategoryRepository
*/
private $cookieCategoryRepository;
/**
* @var \Plumrocket\CookieConsentPro\Model\Integration\GlobalPrivacyControl
*/
private $integrationConfig;
/**
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
* @param \Plumrocket\CookieConsent\Model\CategoryRepository $cookieCategoryRepository
* @param GlobalPrivacyControlIntegrationConfig $integrationConfig
*/
public function __construct(
SearchCriteriaBuilder $searchCriteriaBuilder,
SerializerInterface $serializer,
CategoryRepository $cookieCategoryRepository,
GlobalPrivacyControlIntegrationConfig $integrationConfig
) {
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->serializer = $serializer;
$this->cookieCategoryRepository = $cookieCategoryRepository;
$this->integrationConfig = $integrationConfig;
}
/**
* @return bool
*/
public function shouldDeclineAllCategories(): bool
{
return $this->integrationConfig->shouldDeclineAllCategories();
}
/**
* Get prepared list of allowed cookie categories
*
* @return array
*/
public function getAllowedCategories(): array
{
$allowedCategories = [];
$categoriesToDecline = $this->integrationConfig->getCategoriesToDecline();
$categories = $this->cookieCategoryRepository
->getList($this->searchCriteriaBuilder->create())
->getItems();
foreach ($categories as $category) {
if (! $category->isEnabled()) {
continue;
}
if (! $category->isEssential() && in_array($category->getKey(), $categoriesToDecline, true)) {
continue;
}
$allowedCategories[] = $category->getKey();
}
return $allowedCategories;
}
/**
* Get prepared list of allowed cookie categories in JSON format
*
* @return string
*/
public function getAllowedCategoriesJson(): string
{
return $this->serializer->serialize(
$this->getAllowedCategories()
);
}
/**
* Get prepared list cookie categories to decline in JSON format
*
* @return string
*/
public function getCategoriesToDeclineJson()
{
return $this->serializer->serialize(
$this->integrationConfig->getCategoriesToDecline()
);
}
}
@@ -0,0 +1,60 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\ViewModel\Integration;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Plumrocket\CookieConsentPro\Model\Integration\MicrosoftAds as MicrosoftAdsConfigModel;
/**
* @since 1.0.0
*/
class MicrosoftAds implements ArgumentInterface
{
/**
* @var \Plumrocket\CookieConsentPro\Model\Integration\MicrosoftAds
*/
private $microsoftAds;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/**
* @param \Plumrocket\CookieConsentPro\Model\Integration\MicrosoftAds $microsoftAds
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/
public function __construct(
MicrosoftAdsConfigModel $microsoftAds,
SerializerInterface $serializer
) {
$this->microsoftAds = $microsoftAds;
$this->serializer = $serializer;
}
/**
* @return bool
*/
public function isEnabled(): bool
{
return $this->microsoftAds->isEnabled();
}
/**
* @return string
*/
public function getConsentTypesConfigJson(): string
{
return $this->serializer->serialize(
$this->microsoftAds->getConsentTypesConfig()
);
}
}
@@ -0,0 +1,60 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
declare(strict_types=1);
namespace Plumrocket\CookieConsentPro\ViewModel\Integration;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\Framework\View\Element\Block\ArgumentInterface;
use Plumrocket\CookieConsentPro\Model\Integration\MicrosoftClarity as MicrosoftClarityConfigModel;
/**
* @since 1.0.0
*/
class MicrosoftClarity implements ArgumentInterface
{
/**
* @var \Plumrocket\CookieConsentPro\Model\Integration\MicrosoftClarity
*/
private $microsoftClarity;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private $serializer;
/**
* @param \Plumrocket\CookieConsentPro\Model\Integration\MicrosoftClarity $microsoftClarity
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/
public function __construct(
MicrosoftClarityConfigModel $microsoftClarity,
SerializerInterface $serializer
) {
$this->microsoftClarity = $microsoftClarity;
$this->serializer = $serializer;
}
/**
* @return bool
*/
public function isEnabled(): bool
{
return $this->microsoftClarity->isEnabled();
}
/**
* @return string
*/
public function getConsentTypesConfigJson(): string
{
return $this->serializer->serialize(
$this->microsoftClarity->getConsentTypesConfig()
);
}
}
@@ -0,0 +1,22 @@
{
"name": "plumrocket/module-cookie-consent-pro",
"description": "Plumrocket Cookie Consent Pro Extension for Magento 2",
"require": {
"php": ">=7.1",
"plumrocket/module-plumbase": ">=2.11.5",
"plumrocket/module-cookie-consent": ">=2.1.2",
"plumrocket/module-geo-ip-lookup": ">=2.0.4",
"plumrocket/module-extended-admin-ui": ">=1.0.7",
"plumrocket/module-global-privacy-control": ">=1.0.3"
},
"type": "magento2-module",
"version": "1.1.0",
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Plumrocket\\CookieConsentPro\\": ""
}
}
}
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<update id="Plumrocket_CookieConsent::pr_menu" title="Cookie Consent Pro"/>
<update id="Plumrocket_CookieConsent::pr_group_icon_customer" title="Cookie Consent Pro"/>
</menu>
</config>
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="pr_cookie">
<label>Cookie Consent Pro</label>
<group id="toolbox" >
<field id="version">
<attribute type="pr_extension_name">CookieConsentPro</attribute>
</field>
</group>
<group id="general">
<field id="serial" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
<frontend_model>Plumrocket\Base\Block\Adminhtml\System\Config\Form\Serial</frontend_model>
<label>Serial Key</label>
<attribute type="pr_extension_name">CookieConsentPro</attribute>
</field>
</group>
<include path="Plumrocket_CookieConsentPro::system/integrations.xml"/>
</section>
<section id="pr_gpc">
<group id="cookie_consent_management">
<field id="behavior" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Cookie Consent Behavior on GPC Signal</label>
<source_model>Plumrocket\CookieConsentPro\Model\Config\Source\GlobalPrivacyControl\CookieConsentBehavior</source_model>
<comment>Choose the default behavior when GPC is detected.</comment>
</field>
<field id="categories_to_decline" translate="label comment" type="multiselect" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Categories to Decline</label>
<source_model>Plumrocket\CookieConsentPro\Model\Config\Source\CookieCategories</source_model>
<frontend_model>Plumrocket\CookieConsentPro\Block\Adminhtml\System\Config\Form\GlobalPrivacyControl\CookieCategoriesToDecline</frontend_model>
<backend_model>Plumrocket\CookieConsentPro\Model\Config\Backend\GlobalPrivacyControl\CookieCategoriesToDecline</backend_model>
<comment>Select which categories of cookies to decline automatically when GPC is enabled. Please note: essential cookies cannot be selected to be automatically declined, as they are required for the core functionality of the website.</comment>
<depends>
<field id="behavior">decline_specific</field>
</depends>
</field>
<field id="addon_required_notice" showInDefault="0" showInWebsite="0" showInStore="0"/>
</group>
</section>
</system>
</config>
@@ -0,0 +1,65 @@
<?xml version="1.0" ?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="integrations">
<group id="pr_gpc" sortOrder="10">
<label>Global Privacy Control (GPC)</label>
<attribute type="expanded">1</attribute>
<field id="open_settings" type="button" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<frontend_model>Plumrocket\CookieConsentPro\Block\Adminhtml\System\Config\Form\GlobalPrivacyControl\OpenSettingsButton</frontend_model>
</field>
<field id="upgrade_to_pro_notice" showInDefault="0" showInWebsite="0" showInStore="0"/>
</group>
<group id="gtm" sortOrder="20"/>
<group id="no_cookie_youtube" sortOrder="30"/>
<group id="microsoft_ads" sortOrder="40">
<label>Microsoft Ads (UET Consent Mode)</label>
<field id="upgrade_to_pro_notice" showInDefault="0" showInWebsite="0" showInStore="0"/>
<field id="enabled" type="select" sortOrder="10" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="consent_types" translate="label" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Consent Types</label>
<frontend_model>Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\MappingTable</frontend_model>
<backend_model>Plumrocket\CookieConsent\Model\Config\Backend\ConsentTypes</backend_model>
<depends>
<field id="*/*/*/enabled">1</field>
</depends>
<comment><![CDATA[Define the cookie category and default consent status for Microsoft Ads tracking. This setting determines how the UET tag behaves if the user has not yet accepted or denied cookies. Refer to the <a href="https://help.ads.microsoft.com/apex/index/3/en/60119" target="_blank">official Microsoft guide</a> if you need to validate the consent mode implementation.]]></comment>
</field>
</group>
<group id="microsoft_clarity" sortOrder="50">
<label>Microsoft Clarity</label>
<field id="upgrade_to_pro_notice" showInDefault="0" showInWebsite="0" showInStore="0"/>
<field id="enabled" type="select" sortOrder="10" translate="label" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="consent_types" translate="label" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Consent Types</label>
<frontend_model>Plumrocket\CookieConsent\Block\Adminhtml\System\Config\Form\ConsentTypes\MappingTable</frontend_model>
<backend_model>Plumrocket\CookieConsent\Model\Config\Backend\ConsentTypes</backend_model>
<depends>
<field id="*/*/*/enabled">1</field>
</depends>
<comment><![CDATA[To learn more about consent types, please check official <a href="https://learn.microsoft.com/en-us/clarity/setup-and-installation/clarity-consent-api-v2" target="_blank">consent configuration article</a>.]]></comment>
</field>
</group>
<group id="adobe_commerce_data_collection" sortOrder="60"/>
</group>
</include>
@@ -0,0 +1,46 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<pr_cookie>
<integrations>
<microsoft_ads>
<enabled>0</enabled>
<consent_types>
<item1>
<consent_type>ad_storage</consent_type>
<status>denied</status>
<cookie_category>marketing</cookie_category>
</item1>
</consent_types>
</microsoft_ads>
<microsoft_clarity>
<enabled>0</enabled>
<consent_types>
<item1>
<consent_type>ad_Storage</consent_type>
<status>denied</status>
<cookie_category>marketing</cookie_category>
</item1>
<item2>
<consent_type>analytics_Storage</consent_type>
<status>denied</status>
<cookie_category>statistics</cookie_category>
</item2>
</consent_types>
</microsoft_clarity>
</integrations>
</pr_cookie>
<pr_gpc>
<cookie_consent_management>
<behavior>decline_all</behavior>
</cookie_consent_management>
</pr_gpc>
</default>
</config>
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
-->
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
<policies>
<policy id="script-src">
<values>
<value id="clarity.ms" type="host">*.clarity.ms</value>
</values>
</policy>
<policy id="connect-src">
<values>
<value id="clarity.ms" type="host">*.clarity.ms</value>
</values>
</policy>
</policies>
</csp_whitelist>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="pr_cookie_consent_log">
<column xsi:type="varchar" name="initiated_by" nullable="true" length="32" comment="Initiated By"/>
</table>
</schema>
@@ -0,0 +1,7 @@
{
"pr_cookie_consent_log": {
"column": {
"initiated_by": true
}
}
}
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Plumrocket\CookieConsent\Model\Consent\Log" type="Plumrocket\CookieConsentPro\Model\Consent\Log"/>
<preference for="Plumrocket\CookieConsent\Model\Consent\Logger" type="Plumrocket\CookieConsentPro\Model\Consent\Logger"/>
</config>
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Plumrocket_CookieConsentPro" setup_version="1.0.0">
<sequence>
<module name="Plumrocket_CookieConsent"/>
<module name="Plumrocket_GlobalPrivacyControl"/>
</sequence>
</module>
</config>
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<!--
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
-->
<cookies xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Plumrocket_CookieConsent:etc/pr-cookies.xsd">
<cookie name="_clck" category="statistics">
<duration xsi:type="const">Plumrocket\CookieConsent\Model\Cookie\Duration::SESSION</duration>
<description>Persists the Microsoft Clarity User ID and preferences, unique to that site is attributed to the same user ID.</description>
</cookie>
<cookie name="_clsk" category="statistics">
<duration xsi:type="const">Plumrocket\CookieConsent\Model\Cookie\Duration::SESSION</duration>
<description>Connects multiple page views by a user into a single Microsoft Clarity session recording.</description>
</cookie>
<cookie name="CLID" category="statistics" type="third">
<duration xsi:type="const">Plumrocket\CookieConsent\Model\Cookie\Duration::ONE_YEAR</duration>
<description>Identifies the first time Microsoft Clarity saw the current user on any site using the service</description>
</cookie>
<cookie name="MR" category="marketing" type="third">
<duration xsi:type="const">Plumrocket\CookieConsent\Model\Cookie\Duration::ONE_YEAR</duration>
<description>Used by Microsoft to track users for analytics purposes.</description>
</cookie>
<cookie name="MUID" category="marketing" type="third">
<duration xsi:type="const">Plumrocket\CookieConsent\Model\Cookie\Duration::ONE_YEAR</duration>
<description>Identifies unique web browsers visiting Microsoft sites. These cookies are used for advertising, site analytics, and other operational purposes.</description>
</cookie>
</cookies>
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!--
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
-->
<extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Plumrocket_Base:etc/pr_extensions.xsd">
<extension name="CookieConsentPro"
title="Cookie Consent Pro"
config_section="pr_cookie"
is_enabled_path="pr_cookie/general/enabled"
documentation="https://plumrocket.com/docs/magento-cookie-consent-pro/v1"
url="https://plumrocket.com/magento-cookie-consent"
marketplace_url="https://marketplace.magento.com/plumrocket-cookie-consent-pro.html"
>
<customer key="18771d78aa85ca47851fca7fdf3dd545bad4a02358"/>
</extension>
</extensions>
@@ -0,0 +1,10 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
*/
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Plumrocket_CookieConsentPro', __DIR__);
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="pr_system_config_element_notice"/>
</page>
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<columns name="pr_cookie_consent_log_listing_columns">
<column name="initiated_by" class="Plumrocket\CookieConsentPro\Ui\Component\Listing\Columns\ConsentInitiator">
<settings>
<filter>text</filter>
<label translate="true">Initiated By</label>
<visible>true</visible>
</settings>
</column>
</columns>
</listing>
@@ -0,0 +1,17 @@
/**
* Plumrocket Inc.
*
* NOTICE OF LICENSE
*
* This source file is subject to the End-user License Agreement
* that is available through the world-wide-web at this URL:
* http://wiki.plumrocket.net/wiki/EULA
* If you are unable to obtain it through the world-wide-web, please
* send an email to support@plumrocket.com so we can send you a copy immediately.
*
* @package Plumrocket_Extension
* @copyright Copyright (c) 2026 Plumrocket Inc. (http://www.plumrocket.com)
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
*/
var __prinitparam = 'MzM5Njkw';
@@ -0,0 +1,47 @@
<?xml version="1.0"?>
<!--
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://www.plumrocket.com)
* @license https://www.plumrocket.com/license/ End-user License Agreement
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="head.additional">
<block class="Plumrocket\CookieConsent\Block\Html\HeadScripts" name="pr_cookie.microsoft_ads.head_script" before="-" ifconfig="pr_cookie/general/enabled">
<arguments>
<argument name="template" xsi:type="string">Plumrocket_CookieConsentPro::integration/microsoft_ads.phtml</argument>
<argument name="cspNonceViewModel" xsi:type="object">Plumrocket\Base\ViewModel\CspNonce</argument>
<argument name="microsoftAdsViewModel" xsi:type="object">Plumrocket\CookieConsentPro\ViewModel\Integration\MicrosoftAds</argument>
</arguments>
</block>
<block class="Plumrocket\CookieConsent\Block\Html\HeadScripts" name="pr_cookie.microsoft_clarity.head_script" after="pr.cookie.cookie_service" ifconfig="pr_cookie/general/enabled">
<arguments>
<argument name="template" xsi:type="string">Plumrocket_CookieConsentPro::integration/microsoft_clarity.phtml</argument>
<argument name="cspNonceViewModel" xsi:type="object">Plumrocket\Base\ViewModel\CspNonce</argument>
<argument name="microsoftClarityViewModel" xsi:type="object">Plumrocket\CookieConsentPro\ViewModel\Integration\MicrosoftClarity</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="after.body.start">
<block class="Magento\Framework\View\Element\Template" name="pr_cookie.gpc.head" after="pr.gpc.init" ifconfig="pr_gpc/general/enabled">
<arguments>
<argument name="template" xsi:type="string">Plumrocket_CookieConsentPro::integration/global_privacy_control/head_script.phtml</argument>
<argument name="cspNonceViewModel" xsi:type="object">Plumrocket\Base\ViewModel\CspNonce</argument>
<argument name="globalPrivacyControlViewModel" xsi:type="object">Plumrocket\CookieConsentPro\ViewModel\Integration\GlobalPrivacyControl</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="before.body.end">
<block class="Magento\Framework\View\Element\Template" name="pr_cookie.gpc.opt_out_notification" after="-" ifconfig="pr_gpc/general/enabled">
<arguments>
<argument name="template" xsi:type="string">Plumrocket_CookieConsentPro::integration/global_privacy_control/opt_out_notification.phtml</argument>
<argument name="cspNonceViewModel" xsi:type="object">Plumrocket\Base\ViewModel\CspNonce</argument>
<argument name="optOutNotificationViewModel" xsi:type="object">Plumrocket\GlobalPrivacyControl\ViewModel\OptOutNotification</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,9 @@
var config = {
config: {
mixins: {
'Plumrocket_CookieConsent/js/view/notice': {
'Plumrocket_CookieConsentPro/js/mixin/view/notice-mixin': true
}
}
}
};
@@ -0,0 +1,44 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
?>
<?php
/** @var \Magento\Framework\View\Element\Template $block */
/** @var \Plumrocket\Base\ViewModel\CspNonce $cspNonceViewModel */
$cspNonceViewModel = $block->getData('cspNonceViewModel');
/** @var \Plumrocket\GPC\ViewModel\CookieConsentManagement $globalPrivacyControlViewModel */
$globalPrivacyControlViewModel = $block->getData('globalPrivacyControlViewModel');
?>
<script <?= /* @noEscape */ $cspNonceViewModel->getNonce() ?>>
(() => {
const updateConsents = () => {
<?php if ($globalPrivacyControlViewModel->shouldDeclineAllCategories()): ?>
if (! Array.isArray(prCookieConsentApi.consent.get()) || prCookieConsentApi.consent.get().length > 0) {
prCookieConsentApi.consent.declineAll();
}
<?php else: ?>
let categoriesToDecline = <?= /* @noEscape */ $globalPrivacyControlViewModel->getCategoriesToDeclineJson() ?>,
categoriesToAllow = <?= /* @noEscape */ $globalPrivacyControlViewModel->getAllowedCategoriesJson() ?>;
if (! Array.isArray(prCookieConsentApi.consent.get()) || prCookieConsentApi.isAllCategoriesAllowed()) {
prCookieConsentApi.consent.set(categoriesToAllow);
}
for (let i = 0; i < categoriesToDecline.length; i++) {
if (prCookieConsentApi.isAllowedCategory(categoriesToDecline[i])) {
prCookieConsentApi.consent.set(categoriesToAllow);
break;
}
}
<?php endif; ?>
}
prGlobalPrivacyControlApi.signalHandlers.addHandler(updateConsents);
})();
</script>
@@ -0,0 +1,41 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
?>
<?php
/** @var \Magento\Framework\View\Element\Template $block */
/** @var \Plumrocket\Base\ViewModel\CspNonce $cspNonceViewModel */
$cspNonceViewModel = $block->getData('cspNonceViewModel');
/** @var \Plumrocket\GlobalPrivacyControl\ViewModel\OptOutNotification $optOutNotificationViewModel */
$optOutNotificationViewModel = $block->getData('optOutNotificationViewModel');
?>
<script <?= /* @noEscape */ $cspNonceViewModel->getNonce() ?>>
(() => {
const updateSettingBar = () => {
const intervalId = setInterval(() => {
const bar = document.getElementById('pr-cookie-setting-bar');
if (! bar) {
return;
}
clearInterval(intervalId);
bar.querySelectorAll('input[type="checkbox"], button.action')
.forEach(el => el.disabled = true);
<?php if ($optOutNotificationViewModel->isEnabled()): ?>
let notification = '<?= $optOutNotificationViewModel->getNotificationHtml(true) ?>';
bar.querySelector('.pr-cookie-description')
.insertAdjacentHTML('beforebegin', notification);
<?php endif; ?>
}, 400);
}
prGlobalPrivacyControlApi.signalHandlers.addHandler(updateSettingBar);
})();
</script>
@@ -0,0 +1,41 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
?>
<?php
/** @var \Plumrocket\CookieConsent\Block\Html\HeadScripts $block */
/** @var \Plumrocket\CookieConsentPro\ViewModel\Integration\MicrosoftAds $microsoftAdsViewModel */
$microsoftAdsViewModel = $block->getData('microsoftAdsViewModel');
/** @var \Plumrocket\Base\ViewModel\CspNonce $cspNonceViewModel */
$cspNonceViewModel = $block->getData('cspNonceViewModel');
?>
<?php if ($microsoftAdsViewModel->isEnabled()): ?>
<script type="text/javascript" <?= /* @noEscape */ $cspNonceViewModel->getNonce() ?>>
(function(config) {
var defaults = { wait_for_update: 1000 };
for (const [consentType, consentConfig] of Object.entries(config)) {
defaults[consentType] = consentConfig.default_status;
}
window.uetq = window.uetq || [];
window.uetq.push('consent', 'default', defaults);
document.addEventListener('pr-cookie-consent-api:configured', () => {
const updateConsents = () => {
let updated = {};
for (const [consentType, consentConfig] of Object.entries(config)) {
let cookieCategory = consentConfig.cookie_category;
updated[consentType] = prCookieConsentApi.isAllowedCategory(cookieCategory) ? 'granted' : 'denied'
}
window.uetq.push('consent', 'update', updated);
}
updateConsents();
prCookieConsentApi.consent.addCallback(updateConsents);
});
})(JSON.parse("<?= $block->escapeJs($microsoftAdsViewModel->getConsentTypesConfigJson()) ?>"));
</script>
<?php endif; ?>
@@ -0,0 +1,44 @@
<?php
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc.
* @license https://plumrocket.com/license End-user License Agreement
*/
?>
<?php
/** @var \Plumrocket\CookieConsent\Block\Html\HeadScripts $block */
/** @var \Plumrocket\CookieConsentPro\ViewModel\Integration\MicrosoftClarity $microsoftClarityViewModel */
$microsoftClarityViewModel = $block->getData('microsoftClarityViewModel');
/** @var \Plumrocket\Base\ViewModel\CspNonce $cspNonceViewModel */
$cspNonceViewModel = $block->getData('cspNonceViewModel');
?>
<?php if ($microsoftClarityViewModel->isEnabled()): ?>
<script type="text/javascript" <?= /* @noEscape */ $cspNonceViewModel->getNonce() ?>>
(function(config) {
window.clarity = window.clarity || function() {(window.clarity.q = window.clarity.q || []).push(arguments);};
if (! prCookieService.get('pr-cookie-consent')) {
var defaults = {};
for (const [consentType, consentConfig] of Object.entries(config)) {
defaults[consentType] = consentConfig.default_status;
}
window.clarity('consentv2', defaults);
}
document.addEventListener('pr-cookie-consent-api:configured', () => {
const updateConsents = () => {
let updated = {};
for (const [consentType, consentConfig] of Object.entries(config)) {
let cookieCategory = consentConfig.cookie_category;
updated[consentType] = prCookieConsentApi.isAllowedCategory(cookieCategory) ? 'granted' : 'denied'
}
window.clarity('consentv2', updated);
}
updateConsents();
prCookieConsentApi.consent.addCallback(updateConsents);
});
})(JSON.parse("<?= $block->escapeJs($microsoftClarityViewModel->getConsentTypesConfigJson()) ?>"));
</script>
<?php endif; ?>
@@ -0,0 +1,25 @@
/**
* @package Plumrocket_CookieConsentPro
* @copyright Copyright (c) 2025 Plumrocket Inc. (https://plumrocket.com)
* @license https://plumrocket.com/license End-user License Agreement
*/
define([
'prGlobalPrivacyControlApi'
], function (prGlobalPrivacyControlApi) {
'use strict';
return function (target) {
return target.extend({
/**
* @inheritdoc
*/
autoOpen: function () {
if (prGlobalPrivacyControlApi.isConfigured) {
return this._super();
}
document.addEventListener('pr-cookie-consent-api:configured', this._super.bind(this));
}
});
};
});