diff --git a/Controller.php b/Controller.php index 15aab1b3b..a7586b106 100644 --- a/Controller.php +++ b/Controller.php @@ -11,6 +11,7 @@ use Piwik\API\Request; use Piwik\Common; +use Piwik\Container\StaticContainer; use Piwik\DataTable\Filter\SafeDecodeLabel; use Piwik\Filechecks; use Piwik\Menu\MenuTop; @@ -21,6 +22,7 @@ use Piwik\Plugins\TagManager\Input\AccessValidator; use Piwik\Plugins\TagManager\Model\Container; use Piwik\Plugins\TagManager\Model\Environment; +use Piwik\Plugins\TagManager\Model\Tag; use Piwik\Site; use Piwik\Url; use Piwik\View; @@ -29,6 +31,7 @@ class Controller extends \Piwik\Plugin\Controller { public const COPY_CONTAINER_NONCE = 'TagManager.copyContainer'; + public const COPY_TAG_NONCE = 'TagManager.copyTag'; /** * @var AccessValidator @@ -385,15 +388,58 @@ public function copyContainer() 'idSite' => $idDestinationSite, 'idContainer' => $idContainerNew ]); - $successMessage = Piwik::translate('TagManager_ContainerCopySuccess', ['', '']); - $notification = new Notification($successMessage); - $notification->raw = true; - $notification->context = Notification::CONTEXT_SUCCESS; - $notification->type = Notification::TYPE_TRANSIENT; - Notification\Manager::notify('containerCopied', $notification); - - // Once the copy is done, we should be able to redirect to the manage screen - $this->redirectToIndex('TagManager', 'manageContainers', $this->idSite); + + return json_encode(['isSuccess' => true, 'urlToNewCopy' => $url]); + } + + public function copyTagDialog() + { + $this->accessValidator->checkWriteCapability($this->idSite); + $this->accessValidator->checkUseCustomTemplatesCapability($this->idSite); + + $request = \Piwik\Request::fromRequest(); + $idTag = $request->getIntegerParameter('idTag'); + $idSourceContainer = $request->getStringParameter('idContainer'); + $idContainerVersion = $request->getIntegerParameter('idContainerVersion'); + + $view = new View("@TagManager/copyDialog"); + $view->defaultSiteDecoded = [ + 'id' => $this->idSite, + 'name' => Common::unsanitizeInputValue(Site::getNameFor($this->idSite)), + ]; + $view->idToCopy = $idTag; + $view->copyType = 'tag'; + $view->idSourceContainer = $idSourceContainer; + $view->idContainerVersion = $idContainerVersion; + $view->copyNonce = Nonce::getNonce(self::COPY_TAG_NONCE); + return $view->render(); + } + + public function copyTag() + { + $this->accessValidator->checkWriteCapability($this->idSite); + $this->accessValidator->checkUseCustomTemplatesCapability($this->idSite); + Nonce::checkNonce(self::COPY_TAG_NONCE); + + $request = \Piwik\Request::fromRequest(); + $idDestinationSite = $request->getIntegerParameter('idDestinationSite'); + $idDestinationContainer = $request->getStringParameter('idDestinationContainer'); + // Confirm tha the user has permission to copy to the selected site + $this->accessValidator->checkWriteCapability($idDestinationSite); + $idTag = $request->getIntegerParameter('idTag'); + $idContainerVersion = $request->getIntegerParameter('idContainerVersion'); + + $idTagNew = StaticContainer::get(Tag::class)->copyTag($this->idSite, $idContainerVersion, $idTag, $idDestinationSite, $idDestinationContainer); + + $url = 'index.php?module=TagManager&action=manageTags&' + . Url::getQueryStringFromParameters([ + 'idSite' => $idDestinationSite, + 'idContainer' => $idDestinationContainer + ]) . '#?' . Url::getQueryStringFromParameters([ + 'idTag' => $idTagNew, + ]); + + return json_encode(['isSuccess' => true, 'urlToNewCopy' => $url]); } protected function renderTemplate($template, array $variables = array()) @@ -411,7 +457,7 @@ protected function renderTemplate($template, array $variables = array()) $view->topMenu = MenuTop::getInstance()->getMenu(); $view->tagManagerMenu = MenuTagManager::getInstance()->getMenu(); - list($defaultAction, $defaultParameters) = Menu::getDefaultAction(); + [$defaultAction, $defaultParameters] = Menu::getDefaultAction(); $view->tagAction = $defaultAction; foreach ($variables as $key => $value) { diff --git a/Dao/BaseDao.php b/Dao/BaseDao.php index 5125d586c..210f24ed8 100644 --- a/Dao/BaseDao.php +++ b/Dao/BaseDao.php @@ -12,6 +12,7 @@ use Piwik\Common; use Piwik\Date; use Piwik\Db; +use Piwik\Plugins\TagManager\Input\Name; abstract class BaseDao { @@ -73,8 +74,91 @@ public function updateEntity($columns, $whereColumns) } } + /** + * Make sure that the name is unique. This means appending a number at the end, or if there's already been a number + * appended, increment the previous number. This way, when copying a tag/trigger/variable to the same site, we don't + * get an error that the name is already in use. + * + * @param int $idSite + * @param string $name + * @param null|int $idContainerVersion Optional ID of the container version. It's only optional since containers + * don't need it. + * @return string + * @throws \Exception Throws an exception if it's a Tag, Trigger, or Variable and doesn't have a idContainerVersion + */ + public function makeCopyNameUnique(int $idSite, string $name, ?int $idContainerVersion = null): string + { + $requireVersion = [ + 'Piwik\Plugins\TagManager\Dao\TagsDao', + 'Piwik\Plugins\TagManager\Dao\TriggersDao', + 'Piwik\Plugins\TagManager\Dao\VariablesDao', + 'Piwik\Plugins\TagManager\Dao\ContainerVersionsDao', + ]; + if (in_array(get_class($this), $requireVersion) && $idContainerVersion === null) { + throw new \Exception('The idContainerVersion is required for Tags, Triggers, and Variables'); + } + + // If the name isn't already in use, simply return it + if (!$this->isNameAlreadyUsed($idSite, $name, $idContainerVersion)) { + return $name; + } + + $newName = $this->incrementNameWithNumber($name); + + // Make sure that the new name doesn't already exist + // Call this method recursively until we have a unique name + if ($this->isNameAlreadyUsed($idSite, $newName, $idContainerVersion)) { + $newName = $this->makeCopyNameUnique($idSite, $newName, $idContainerVersion); + } + + return $newName; + } + + /** + * Check if the name is already in use. If it's a container, the idContainerVersion isn't needed. It's required for + * tags, triggers, and variables. + * + * @param int $idSite + * @param string $name + * @param null|int $idContainerVersion Optional ID of the container version. It's only optional since containers + * don't need it. + * @return bool Indicating whether the name is already in use + */ + abstract protected function isNameAlreadyUsed(int $idSite, string $name, ?int $idContainerVersion = null): bool; + protected function getCurrentDateTime() { return Date::now()->getDatetime(); } + + /** + * Update the provided name with a number suffix. It will either add a suffix or increment the number in the suffix. + * + * @param string $name The name that needs to be updated with a number suffix. If no suffix exists, one will be + * added. If one already exists, the number in the suffix will be incremented. + * @return string Name with the updated number suffix + */ + protected function incrementNameWithNumber(string $name): string + { + $newName = $name; + + // First check if the name already has a number suffix + $matches = []; + $number = 1; + if (preg_match('/ \(\d+\)$/', $name, $matches)) { + // Increment the number in the name suffix + $number = intval(str_replace(['(', ')'], '', $matches[0])); + ++$number; + $newName = str_replace($matches[0], '', $name); + } + + // Make sure that we don't exceed the max length the name fields + if (strlen($newName . " ($number)") > Name::MAX_LENGTH) { + $newName = substr($newName, 0, (Name::MAX_LENGTH - 3) - strlen((string) $number)); + } + + $newName .= " ($number)"; + + return $newName; + } } diff --git a/Dao/ContainerReleaseDao.php b/Dao/ContainerReleaseDao.php index e6e552e69..e007e8cf8 100644 --- a/Dao/ContainerReleaseDao.php +++ b/Dao/ContainerReleaseDao.php @@ -168,6 +168,12 @@ public function deleteNoLongerExistingEnvironmentReleases($availableEnvironments return $query->rowCount(); } + protected function isNameAlreadyUsed(int $idSite, string $name, ?int $idContainerVersion = null): bool + { + // This is hard coded since releases don't have a name and therefore don't use this method + return true; + } + private function enrichReleases($releases) { if (empty($releases)) { diff --git a/Dao/ContainerVersionsDao.php b/Dao/ContainerVersionsDao.php index f1f8a65de..d8eb218bc 100644 --- a/Dao/ContainerVersionsDao.php +++ b/Dao/ContainerVersionsDao.php @@ -207,6 +207,19 @@ public function deleteVersion($idSite, $idContainerVersion, $deletedDate) Db::query($query, $bind); } + protected function isNameAlreadyUsed(int $idSite, string $name, ?int $idContainerVersion = null): bool + { + // Look up the container ID using the version ID + $bind = array(self::STATUS_ACTIVE, $idSite, $idContainerVersion); + $table = $this->tablePrefixed; + $version = Db::fetchRow("SELECT idcontainer FROM $table WHERE status = ? AND idsite = ? AND idcontainerversion = ? LIMIT 1", $bind); + if (empty($version['idcontainer'])) { + return false; + } + + return $this->isNameInUse($idSite, $version['idcontainer'], $name); + } + private function enrichVersions($containers) { if (empty($containers)) { diff --git a/Dao/ContainersDao.php b/Dao/ContainersDao.php index ce161bbdf..01b17ca59 100644 --- a/Dao/ContainersDao.php +++ b/Dao/ContainersDao.php @@ -205,42 +205,9 @@ public function deleteContainer($idSite, $idContainer, $deletedDate) Db::query($query, $bind); } - /** - * Make sure that the container name is unique. This means appending a number at the end, or if there's already been - * a number appended, increment the previous number. This way, when copying a container to the same site, we don't - * get an error that the name is already in use. - * - * @param int $idSite - * @param string $containerName - * @return string - */ - public function makeCopyNameUnique(int $idSite, string $containerName): string + protected function isNameAlreadyUsed(int $idSite, string $name, ?int $idContainerVersion = null): bool { - // If the name isn't already in use, simply return it - if (!$this->isNameInUse($idSite, $containerName)) { - return $containerName; - } - - $newContainerName = $containerName; - - // First check if the container name has already been automatically updated during copy process - $matches = []; - $number = 1; - if (preg_match('/ \(\d+\)$/', $containerName, $matches)) { - // Increment the number in the name - $number = intval(str_replace(['(', ')'], '', $matches[0])); - ++$number; - $newContainerName = str_replace($matches[0], '', $containerName); - } - $newContainerName .= " ($number)"; - - // Make sure that the new name doesn't already exist - // Call this method recursively until we have a unique name - if ($this->isNameInUse($idSite, $newContainerName)) { - $newContainerName = $this->makeCopyNameUnique($idSite, $newContainerName); - } - - return $newContainerName; + return $this->isNameInUse($idSite, $name); } private function enrichContainers($containers) diff --git a/Dao/TagsDao.php b/Dao/TagsDao.php index c6b9e2be3..05f822cb6 100644 --- a/Dao/TagsDao.php +++ b/Dao/TagsDao.php @@ -60,6 +60,11 @@ private function isNameInUse($idSite, $idContainerVersion, $name, $exceptIdTag = return !empty($idSite); } + protected function isNameAlreadyUsed(int $idSite, string $name, ?int $idContainerVersion = null): bool + { + return $this->isNameInUse($idSite, $idContainerVersion, $name); + } + public function createTag($idSite, $idContainerVersion, $type, $name, $parameters, $fireTriggerIds, $blockTriggerIds, $fireLimit, $fireDelay, $priority, $startDate, $endDate, $createdDate, $description = '', $status = '') { if ($this->isNameInUse($idSite, $idContainerVersion, $name)) { diff --git a/Dao/TriggersDao.php b/Dao/TriggersDao.php index 66ddba0a6..de90cb5c9 100644 --- a/Dao/TriggersDao.php +++ b/Dao/TriggersDao.php @@ -144,6 +144,24 @@ public function getContainerTrigger($idSite, $idContainerVersion, $idTrigger) return $this->enrichTrigger($trigger); } + /** + * Look up the trigger using its name + * + * @param int $idSite + * @param int $idContainerVersion + * @param string $triggerName + * @return array|false + * @throws \Exception + */ + public function findTriggerByName(int $idSite, int $idContainerVersion, string $triggerName) + { + $table = $this->tablePrefixed; + $bind = array($idSite, $idContainerVersion, self::STATUS_ACTIVE, $triggerName); + $trigger = Db::fetchRow("SELECT * FROM $table WHERE idsite = ? AND idcontainerversion = ? AND status = ? AND `name` = ?", $bind); + + return $this->enrichTrigger($trigger); + } + /** * @param int $idSite * @param string $deletedDate @@ -174,6 +192,11 @@ public function deleteContainerTrigger($idSite, $idContainerVersion, $idTrigger, Db::query($query, $bind); } + protected function isNameAlreadyUsed(int $idSite, string $name, ?int $idContainerVersion = null): bool + { + return $this->isNameInUse($idSite, $idContainerVersion, $name); + } + private function enrichTriggers($triggers) { if (empty($triggers)) { diff --git a/Dao/VariablesDao.php b/Dao/VariablesDao.php index acf91f7e0..c9496043d 100644 --- a/Dao/VariablesDao.php +++ b/Dao/VariablesDao.php @@ -207,6 +207,11 @@ public function getContainerVariableIdsByType($idSite, $idContainerVersion, $var return is_array($variables) && count($variables) ? array_column($variables, 'idvariable') : []; } + protected function isNameAlreadyUsed(int $idSite, string $name, ?int $idContainerVersion = null): bool + { + return $this->isNameInUse($idSite, $idContainerVersion, $name); + } + private function enrichVariables($variables) { if (empty($variables)) { diff --git a/Model/Tag.php b/Model/Tag.php index 30da6745c..d5776a6a1 100644 --- a/Model/Tag.php +++ b/Model/Tag.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\TagManager\Model; +use Piwik\Container\StaticContainer; use Piwik\Date; use Piwik\Piwik; use Piwik\Plugins\TagManager\Dao\TagsDao; @@ -127,7 +128,7 @@ public function updateParameters($idSite, $idContainerVersion, $idTag, $paramete if (!empty($tag)) { $parameters = $this->formatParameters($tag['type'], $parameters); $this->updateTagColumns($idSite, $idContainerVersion, $idTag, array( - 'parameters' => $parameters + 'parameters' => $parameters, )); } } @@ -182,6 +183,88 @@ public function getContainerTag($idSite, $idContainerVersion, $idTag) return $this->enrichTag($tag); } + /** + * Make a copy of a tag. This can either be within the same container or to a different site/container. If within + * the same container, only the tag is copied and it uses the same triggers and variables. If it's going to a + * different container, it will make copies of all the triggers and variables that the tag references so that the + * copy will have the same triggers and variables available. + * + * @param int $idSite + * @param int $idContainerVersion + * @param int $idTag ID of the tag to make a copy of + * @param int|null $idDestinationSite Optional ID of the site to copy to the tag to. If not provided the copy goes + * to the source site and container + * @param string|null $idDestinationContainer Optional ID of the container to copy the tag to. If not provided the + * copy goes to the source site and container + * @return int ID of the newly created Tag + * @throws \Exception + */ + public function copyTag(int $idSite, int $idContainerVersion, int $idTag, ?int $idDestinationSite = null, ?string $idDestinationContainer = null): int + { + $tag = $this->getContainerTag($idSite, $idContainerVersion, $idTag); + + $idDestinationVersion = $idContainerVersion; + if ($idDestinationSite !== null && !empty($idDestinationContainer)) { + $idDestinationVersion = $this->copyReferencedVariablesAndTriggers($tag, $idSite, $idContainerVersion, $idDestinationSite, $idDestinationContainer); + } + // If the destination site isn't set, simply use the source site + $idDestinationSite = $idDestinationSite ?? $idSite; + + $newName = $this->dao->makeCopyNameUnique($idDestinationSite, $tag['name'], $idDestinationVersion); + + return $this->addContainerTag( + $idDestinationSite, + $idDestinationVersion, + $tag['type'], + $newName, + $tag['parameters'], + $tag['fire_trigger_ids'], + $tag['block_trigger_ids'], + $tag['fire_limit'], + $tag['fire_delay'], + $tag['priority'], + $tag['start_date'], + $tag['end_date'], + $tag['description'], + $tag['status'] + ); + } + + private function copyReferencedVariablesAndTriggers(array &$tag, int $idSite, int $idContainerVersion, int $idDestinationSite, string $idDestinationContainer): int + { + $container = StaticContainer::get(Container::class); + $destinationContainer = $container->getContainer($idDestinationSite, $idDestinationContainer); + if (empty($destinationContainer)) { + throw new \Exception(Piwik::translate('TagManager_ErrorContainerDoesNotExist', [$idDestinationContainer])); + } + + // Copy the new tag to the draft version of the destination container + $idDestinationVersion = $destinationContainer['draft']['idcontainerversion'] ?? null; + // Make sure that the version is set and is an integer value + if (empty($idDestinationVersion) || !(is_int($idDestinationVersion) || (is_string($idDestinationVersion) && ctype_digit($idDestinationVersion)))) { + throw new \Exception(Piwik::translate('TagManager_ErrorContainerVersionDoesNotExist')); + } + // Make sure that the type is int + $idDestinationVersion = intval($idDestinationVersion); + + // Copy all the referenced variables and triggers and replace those references with references to the newly copied ones + StaticContainer::get(Variable::class)->copyReferencedVariables($tag, $idSite, $idContainerVersion, $idDestinationSite, $idDestinationVersion); + $tag['fire_trigger_ids'] = $this->copyReferencedTriggers($idSite, $idContainerVersion, $tag['fire_trigger_ids'], $idDestinationSite, $idDestinationVersion); + $tag['block_trigger_ids'] = $this->copyReferencedTriggers($idSite, $idContainerVersion, $tag['block_trigger_ids'], $idDestinationSite, $idDestinationVersion); + + return $idDestinationVersion; + } + + private function copyReferencedTriggers(int $idSite, int $idContainerVersion, array $triggerIds, int $idDestinationSite, int $idDestinationVersion): array + { + $newTriggerIds = []; + foreach ($triggerIds as $triggerId) { + $newTriggerIds[] = StaticContainer::get(Trigger::class)->copyTriggerIfNoEquivalent($idSite, $idContainerVersion, $triggerId, $idDestinationSite, $idDestinationVersion); + } + + return $newTriggerIds; + } + private function updateTagColumns($idSite, $idContainerVersion, $idTag, $columns) { if (!isset($columns['updated_date'])) { diff --git a/Model/Trigger.php b/Model/Trigger.php index adfc40793..58cef8524 100644 --- a/Model/Trigger.php +++ b/Model/Trigger.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\TagManager\Model; +use Piwik\Container\StaticContainer; use Piwik\Piwik; use Piwik\Plugins\TagManager\API\TagReference; use Piwik\Plugins\TagManager\Dao\TriggersDao; @@ -140,6 +141,58 @@ public function getContainerTrigger($idSite, $idContainerVersion, $idTrigger) return $this->enrichTrigger($trigger); } + /** + * Look up a trigger by its name. + * + * @param int $idSite + * @param int $idContainerVersion + * @param string $triggerName + * @return array|false + */ + public function findTriggerByName(int $idSite, int $idContainerVersion, string $triggerName) + { + $trigger = $this->dao->findTriggerByName($idSite, $idContainerVersion, $triggerName); + return $this->enrichTrigger($trigger); + } + + /** + * Make a copy of the trigger and return the ID. If a matching trigger already exists in the destination container, + * simply return the ID of that trigger so that we're not unintentionally creating a bunch of duplicates. + * + * @param int $idSite + * @param int $idContainerVersion + * @param int $idTrigger + * @param null|int $idDestinationSite Optional ID of the site to which to copy the trigger. If empty, isSite is used + * @param null|int $idDestinationVersion Optional ID of the version to which to copy the trigger. If empty, + * idContainerVersion is used + * @return int ID of the newly created trigger or the ID of an existing trigger than matches the trigger to be copied + */ + public function copyTriggerIfNoEquivalent(int $idSite, int $idContainerVersion, int $idTrigger, ?int $idDestinationSite = 0, ?int $idDestinationVersion = 0): int + { + $idDestinationSite = $idDestinationSite ?: $idSite; + $idDestinationVersion = $idDestinationVersion ?: $idContainerVersion; + + $trigger = $this->getContainerTrigger($idSite, $idContainerVersion, $idTrigger); + $existingTrigger = $this->findTriggerByName($idDestinationSite, $idDestinationVersion, $trigger['name']); + // If there's already a trigger that matches, simply use it + if (is_array($existingTrigger) && $existingTrigger['parameters'] == $trigger['parameters'] && $existingTrigger['conditions'] == $trigger['conditions']) { + return $existingTrigger['idtrigger']; + } + + StaticContainer::get(Variable::class)->copyReferencedVariables($trigger, $idSite, $idContainerVersion, $idDestinationSite, $idDestinationVersion); + + $newName = $this->dao->makeCopyNameUnique($idDestinationSite, $trigger['name'], $idDestinationVersion); + return $this->addContainerTrigger( + $idDestinationSite, + $idDestinationVersion, + $trigger['type'], + $newName, + $trigger['parameters'], + $trigger['conditions'], + $trigger['description'] + ); + } + private function updateTriggerColumns($idSite, $idContainerVersion, $idTrigger, $columns) { if (!isset($columns['updated_date'])) { diff --git a/Model/Variable.php b/Model/Variable.php index 790a0ea21..8837f3b5e 100644 --- a/Model/Variable.php +++ b/Model/Variable.php @@ -280,9 +280,7 @@ private function replaceVariableNameInParameters($entity, $oldVarName, $newVarNa foreach ($entity['typeMetadata']['parameters'] as $parameter) { $paramName = $parameter['name']; if ( - ((isset($parameter['component']) - && in_array($parameter['component'], [BaseTemplate::FIELD_VARIABLE_COMPONENT, BaseTemplate::FIELD_VARIABLE_TYPE_COMPONENT]) - ) || ($entity['type'] === 'CustomJsFunction' && $paramName === 'jsFunction')) + $this->canParameterContainVariables($parameter, $entity['type']) && isset($parameters[$paramName]) && is_string($parameters[$paramName]) && strpos($parameters[$paramName], $oldVarNameTemplate) !== false @@ -296,6 +294,53 @@ private function replaceVariableNameInParameters($entity, $oldVarName, $newVarNa } } + private function canParameterContainVariables(array $parameterMetadata, string $entityType) + { + // If the parameter is for a variable component, or it's the jsFunction param of a CustomJsFunction variable + return ( + ( + isset($parameterMetadata['component']) + && in_array($parameterMetadata['component'], [ + BaseTemplate::FIELD_VARIABLE_COMPONENT, + BaseTemplate::FIELD_VARIABLE_TYPE_COMPONENT + ]) + ) + || ($entityType === 'CustomJsFunction' && $parameterMetadata['name'] === 'jsFunction') + || ($entityType === 'CustomHtml' && $parameterMetadata['name'] === 'customHtml') + ); + } + + /** + * Check the Tag/Trigger/Variable for references to variables. Return a list of variable names that were found. + * + * @param array $entity The array of the Tag/Trigger/Variable built when loading the entry from the database + * @return array List of names found referenced by the provided entity. + */ + public function listVariableNamesInParameters(array $entity): array + { + $variables = []; + $parameters = $entity['parameters']; + foreach ($entity['typeMetadata']['parameters'] as $parameter) { + $paramName = $parameter['name']; + if ( + $this->canParameterContainVariables($parameter, $entity['type']) + && isset($parameters[$paramName]) + && is_string($parameters[$paramName]) + && strpos($parameters[$paramName], '{{') !== false + ) { + // Use regex to get the list of all the variable names + $matches = []; + preg_match_all('/{{.[^}]+}}/', $parameters[$paramName], $matches); + $matches = array_unique($matches[0]); + $variables = array_map(function ($value) { + return trim(str_replace(['{{', '}}'], '', $value)); + }, $matches); + } + } + + return array_unique($variables); + } + public function convertVariableNameToTemplateVar($variableName) { return '{{' . $variableName . '}}'; @@ -327,6 +372,136 @@ public function findVariableByName($idSite, $idContainerVersion, $variableName) return $this->enrichVariable($variable); } + /** + * Check the Tag/Trigger/Variable for references to variables. If any are found, update the names in the parameters + * to reference the copies. For triggers, do the same for the conditions. + * + * @param array $entity The array of the Tag/Trigger/Variable built when loading the entry from the database. Copied + * by reference so that the variable references within the entity can be updated with the new variable names. + * @param int $idSite ID of the source site from which the variables are being copied + * @param int $idContainerVersion ID of the source container version from which the variables are being copied + * @param null|int $idDestinationSite Optional ID of the site to which the variables are being copied. In not + * specified, the idSite is used + * @param null|int $idDestinationVersion Optional ID of the container version to which the variables are being + * copied. If not specified, the idContainerVersion is used + * @return void + * @throws \Exception + */ + public function copyReferencedVariables(array &$entity, int $idSite, int $idContainerVersion, ?int $idDestinationSite = 0, ?int $idDestinationVersion = 0): void + { + $idDestinationSite = $idDestinationSite ?: $idSite; + $idDestinationVersion = $idDestinationVersion ?: $idContainerVersion; + + $variableNameList = $this->listVariableNamesInParameters($entity); + $variableNameMap = []; + foreach ($variableNameList as $variableName) { + $newVarName = $this->copyVariableByNameIfNoEquivalent($variableName, $idSite, $idContainerVersion, $idDestinationSite, $idDestinationVersion); + // This might be empty if it's a preconfigured variable and doesn't exist in the DB. So, just skip it + if (empty($newVarName)) { + continue; + } + + // Update the references in parameters with the new variable name + $entity['parameters'] = $this->replaceVariableNameInParameters($entity, $variableName, $newVarName); + + // Map out the original name to the new one + $variableNameMap[$variableName] = $newVarName; + } + + // If the entity is not a trigger, we're done + if (empty($entity['idtrigger']) || !is_array($entity['conditions'])) { + return; + } + + // If the entity is a trigger, copy any variables in its conditions + foreach ($entity['conditions'] as $index => $condition) { + if (empty($condition['actual'])) { + continue; + } + + // If the variable was already copied above, simply use the name of the new variable copy + if (in_array($condition['actual'], $variableNameList)) { + $entity['conditions'][$index]['actual'] = $variableNameMap[$condition['actual']]; + continue; + } + + $newVarName = $this->copyVariableByNameIfNoEquivalent($condition['actual'], $idSite, $idContainerVersion, $idDestinationSite, $idDestinationVersion); + // This might be empty if it's a preconfigured variable and doesn't exist in the DB. So, just skip it + if (empty($newVarName)) { + continue; + } + + // Replace the old variable name with the new one + $entity['conditions'][$index]['actual'] = $newVarName; + } + } + + private function copyVariableByNameIfNoEquivalent(string $variableName, int $idSite, int $idContainerVersion, int $idDestinationSite, int $idDestinationContainerVersion): string + { + $variable = $this->findVariableByName($idSite, $idContainerVersion, $variableName); + // This might be empty if it's a preconfigured variable and doesn't exist in the DB. So, just skip it + if (empty($variable)) { + return ''; + } + + // If the site and container version are the same, we already know that the variable exists, so return its name + if ($idSite === $idDestinationSite && $idContainerVersion === $idDestinationContainerVersion) { + return $variableName; + } + + // If no variable with that name is found, call the method to make a copy + $existingVariable = $this->findVariableByName($idDestinationSite, $idDestinationContainerVersion, $variableName); + if (empty($existingVariable)) { + return $this->copyVariableByName($variable, $idSite, $idContainerVersion, $idDestinationSite, $idDestinationContainerVersion); + } + + // If a duplicate variable already exists in the destination container, just use that variable + if ( + $variable['type'] === $existingVariable['type'] + && $variable['parameters'] == $existingVariable['parameters'] + && $variable['lookup_table'] == $existingVariable['lookup_table'] + && $variable['default_value'] == $existingVariable['default_value'] + ) { + return $variableName; + } + + // Since no existing duplicate was found, make a copy of the variable + return $this->copyVariableByName($variable, $idSite, $idContainerVersion, $idDestinationSite, $idDestinationContainerVersion); + } + + private function copyVariableByName(array $variable, int $idSite, int $idContainerVersion, int $idDestinationSite, int $idDestinationContainerVersion): string + { + if ( + empty($variable) + || empty($variable['type']) + || empty($variable['name']) + || empty($variable['parameters']) + || !isset($variable['default_value']) + || !isset($variable['lookup_table']) + || !isset($variable['description']) + ) { + throw new \Exception('Variable name cannot be empty'); + } + + $variableName = $variable['name']; + + + // Insert the new variable + $newVarName = $this->dao->makeCopyNameUnique($idDestinationSite, $variableName, $idDestinationContainerVersion); + $this->addContainerVariable( + $idDestinationSite, + $idDestinationContainerVersion, + $variable['type'], + $newVarName, + $variable['parameters'], + $variable['default_value'], + $variable['lookup_table'], + $variable['description'] + ); + + return $newVarName; + } + private function updateVariableColumns($idSite, $idContainerVersion, $idVariable, $columns) { if (!isset($columns['updated_date'])) { diff --git a/TagManager.php b/TagManager.php index 1a0969b8f..74d6a7d2c 100644 --- a/TagManager.php +++ b/TagManager.php @@ -949,6 +949,11 @@ public function getClientSideTranslationKeys(&$result) $result[] = 'TagManager_VariableLowercase'; $result[] = 'TagManager_ChooseWebsite'; $result[] = 'TagManager_CopyContainerNote'; + $result[] = 'TagManager_CopyXSuccess'; + $result[] = 'TagManager_ContainerLowercase'; + $result[] = 'TagManager_TagLowercase'; + $result[] = 'TagManager_TriggerLowercase'; + $result[] = 'TagManager_VariableLowercase'; } public function getStylesheetFiles(&$stylesheets) diff --git a/lang/en.json b/lang/en.json index dd13f7fac..3b7f5a192 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1111,6 +1111,6 @@ "CopyContainerDescription": "Select the website to copy this container to. This will create an exact copy of all settings, tags, triggers, and variables in the chosen site.", "CopyContainerNote": "%1$sNote:%2$s The copied container may need adjustments if it includes custom code or references specific to the original website. Review settings to ensure compatibility.", "CopyXDescription": "To duplicate this %1$s, select the website and container you’d like to add the %1$s to. This will create an exact copy of all settings of the %1$s.", - "ContainerCopySuccess": "A copy was successfully created. Click %1$shere%2$s to navigate to the new container." + "CopyXSuccess": "A copy was successfully created. %1$sNavigate to the new %2$s now%3$s." } } diff --git a/stylesheets/manageList.less b/stylesheets/manageList.less index e0c2c3a79..b735204bd 100644 --- a/stylesheets/manageList.less +++ b/stylesheets/manageList.less @@ -15,6 +15,10 @@ th.action, td.action { width: 200px; } + + td.action.hasCopyAction { + width: 215px; + } } .preconfiguredVariablesHelp { diff --git a/templates/copyDialog.twig b/templates/copyDialog.twig index 0d3442558..2df07a25b 100644 --- a/templates/copyDialog.twig +++ b/templates/copyDialog.twig @@ -4,4 +4,6 @@ copy-type="{{ copyType }}" id-to-copy="{{ idToCopy }}" copy-nonce="{{ copyNonce }}" + id-source-container="{{ idSourceContainer|default('') }}" + id-container-version="{{ idContainerVersion|default(0) }}" > \ No newline at end of file diff --git a/tests/Integration/Dao/TagsDaoTest.php b/tests/Integration/Dao/TagsDaoTest.php index 7ae609a19..44b7defae 100644 --- a/tests/Integration/Dao/TagsDaoTest.php +++ b/tests/Integration/Dao/TagsDaoTest.php @@ -12,6 +12,7 @@ use Piwik\Common; use Piwik\DbHelper; use Piwik\Plugins\TagManager\Dao\TagsDao; +use Piwik\Plugins\TagManager\Input\Name; use Piwik\Plugins\TagManager\Model\Tag; use Piwik\Tests\Framework\TestCase\IntegrationTestCase; @@ -663,6 +664,81 @@ public function test_deleteContainerTag_shouldOnlyDeleteGivenTag() $this->assertSame(null, $tags[2]['deleted_date']); } + public function testMakeCopyNameUniqueNoContainerVersion() + { + $this->expectException(\Exception::class); + $this->dao->makeCopyNameUnique(1, 'FooTag'); + } + + /** + * @dataProvider getMakeCopyNameUniqueTestData + * @param string $name + * @param array $tags + * @param string $expected + * @return void + */ + public function testMakeCopyNameUnique(string $name, array $tags, string $expected) + { + $idSite = 1; + $idContainerVersion = 5; + foreach ($tags as $number) { + $tempName = "FooTag ($number)"; + if ($number < 1) { + $tempName = "FooTag"; + } + + if ($tags == [0] && strpos($name, 'FooTag') === false) { + $tempName = $name; + } + $this->createTag($idSite, $idContainerVersion, $tempName); + } + + $updatedName = $this->dao->makeCopyNameUnique($idSite, $name, $idContainerVersion); + $maxChars = Name::MAX_LENGTH; + $this->assertLessThanOrEqual($maxChars, strlen($updatedName), "The name should not exceed the {$maxChars} characters"); + $this->assertSame($expected, $updatedName); + } + + public function getMakeCopyNameUniqueTestData(): array + { + return [ + ['FooTag', [], 'FooTag'], + ['FooTag (1)', [], 'FooTag (1)'], + ['FooTag', [0], 'FooTag (1)'], + ['FooTag (1)', [0], 'FooTag (1)'], + ['FooTag', [1], 'FooTag'], + ['FooTag', [1, 2], 'FooTag'], + ['FooTag', [1, 2, 3], 'FooTag'], + ['FooTag (1)', [1], 'FooTag (2)'], + ['FooTag (1)', [1, 2], 'FooTag (3)'], + ['FooTag (1)', [1, 2, 3], 'FooTag (4)'], + ['FooTag (2)', [1], 'FooTag (2)'], + ['FooTag (2)', [1, 2], 'FooTag (3)'], + ['FooTag (2)', [1, 2, 3], 'FooTag (4)'], + ['FooTag (3)', [1], 'FooTag (3)'], + ['FooTag (3)', [1, 2], 'FooTag (3)'], + ['FooTag (3)', [1, 2, 3], 'FooTag (4)'], + ['FooTag(1)', [1, 2, 3], 'FooTag(1)'], + ['SomeOtherName', [1, 2, 3], 'SomeOtherName'], + ['SomeOtherName (1)', [1, 2, 3], 'SomeOtherName (1)'], + [ + 'Test tag with a really long name. Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcde', + [0], + 'Test tag with a really long name. Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890A (1)' + ], + [ + 'Test tag with a really long name. Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890A (9)', + [0], + 'Test tag with a really long name. Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890 (10)' + ], + [ + 'Test tag with a really long name. Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890 (99)', + [0], + 'Test tag with a really long name. Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz1234567890Abcdefghijklmnopqrstuvwxyz123456789 (100)' + ], + ]; + } + private function createTag($idSite = 1, $idContainerVersion = 5, $name = 'FooTag') { $type = 'CustomFoo'; diff --git a/tests/Integration/Model/TagTest.php b/tests/Integration/Model/TagTest.php index 1ce58a65b..e92b08546 100644 --- a/tests/Integration/Model/TagTest.php +++ b/tests/Integration/Model/TagTest.php @@ -10,12 +10,17 @@ namespace Piwik\Plugins\TagManager\tests\Integration\Model; use Piwik\Container\StaticContainer; +use Piwik\Plugins\TagManager\Context\WebContext; use Piwik\Plugins\TagManager\Dao\TagsDao; use Piwik\Plugins\TagManager\Input\Name; +use Piwik\Plugins\TagManager\Model\Container; use Piwik\Plugins\TagManager\Model\Tag; +use Piwik\Plugins\TagManager\Model\Trigger; +use Piwik\Plugins\TagManager\Model\Variable; use Piwik\Plugins\TagManager\TagManager; use Piwik\Plugins\TagManager\Template\Tag\CustomHtmlTag; use Piwik\Plugins\TagManager\Template\Trigger\WindowLoadedTrigger; +use Piwik\Plugins\TagManager\Template\Variable\DataLayerVariable; use Piwik\Plugins\TagManager\tests\Framework\TestCase\IntegrationTestCase; use Piwik\Tests\Framework\Fixture; use Piwik\Url; @@ -983,6 +988,136 @@ public function testUpdateParametersValidatesParameters() $this->model->updateParameters($this->idSite, $this->containerVersion1, $this->idTag1, $parameters = ['customHtml' => '']); } + public function testCopyTag() + { + $idNewTag = $this->model->copyTag($this->idSite, $this->containerVersion1, $this->idTag1); + + $tag1 = $this->model->getContainerTag($this->idSite, $this->containerVersion1, $this->idTag1); + $newTag = $this->model->getContainerTag($this->idSite, $this->containerVersion1, $idNewTag); + + // Make sure that the name is different and then clear it + $this->assertNotSame($tag1['name'], $newTag['name']); + unset($tag1['name']); + unset($newTag['name']); + unset($tag1['idtag']); + unset($newTag['idtag']); + + $this->assertEquals($tag1, $newTag); + } + + public function testCopyTagDifferentContainer() + { + $containerModel = StaticContainer::get(Container::class); + $context = WebContext::ID; + $description = 'My description'; + + $idContainer = $containerModel->addContainer($this->idSite, $context, 'FooContainer', $description, 0, 0, 0); + $container = $containerModel->getContainer($this->idSite, $idContainer); + $idContainerVersion = $container['draft']['idcontainerversion']; + + $triggerModel = StaticContainer::get(Trigger::class); + $this->assertCount(0, $triggerModel->getContainerTriggers($this->idSite, $idContainerVersion), 'There should be no triggers in this container.'); + + $idNewTag = $this->model->copyTag($this->idSite, $this->containerVersion1, $this->idTag1, $this->idSite, $idContainer); + + $this->assertCount(1, $triggerModel->getContainerTriggers($this->idSite, $idContainerVersion), 'The trigger should have been copied to the new container.'); + + $tag1 = $this->model->getContainerTag($this->idSite, $this->containerVersion1, $this->idTag1); + $newTag = $this->model->getContainerTag($this->idSite, $idContainerVersion, $idNewTag); + + // Clear the values that won't match + $this->assertNotSame($tag1['idcontainerversion'], $newTag['idcontainerversion']); + unset($tag1['idcontainerversion']); + unset($newTag['idcontainerversion']); + $this->assertCount(1, $tag1['fire_trigger_ids']); + $this->assertCount(1, $newTag['fire_trigger_ids']); + // Make sure that the trigger IDs are different and then clear them + $this->assertNotSame($tag1['fire_trigger_ids'][0], $newTag['fire_trigger_ids'][0]); + unset($tag1['fire_trigger_ids']); + unset($newTag['fire_trigger_ids']); + unset($tag1['idtag']); + unset($newTag['idtag']); + + $this->assertEquals($tag1, $newTag); + + // Copy again to make sure that copying multiple times to the same container works correctly + $idNewTag2 = $this->model->copyTag($this->idSite, $this->containerVersion1, $this->idTag1, $this->idSite, $idContainer); + + $this->assertCount(1, $triggerModel->getContainerTriggers($this->idSite, $idContainerVersion), 'The trigger should have been copied to the new container.'); + + $tag1 = $this->model->getContainerTag($this->idSite, $this->containerVersion1, $this->idTag1); + $newTag = $this->model->getContainerTag($this->idSite, $idContainerVersion, $idNewTag); + $newTag2 = $this->model->getContainerTag($this->idSite, $idContainerVersion, $idNewTag2); + + // Make sure that the name is different and then clear it + $this->assertNotSame($tag1['name'], $newTag2['name']); + $this->assertNotSame($newTag['name'], $newTag2['name']); + unset($tag1['name']); + unset($newTag2['name']); + $this->assertNotSame($tag1['idcontainerversion'], $newTag2['idcontainerversion']); + unset($tag1['idcontainerversion']); + unset($newTag2['idcontainerversion']); + $this->assertCount(1, $tag1['fire_trigger_ids']); + $this->assertCount(1, $newTag2['fire_trigger_ids']); + // Make sure that the trigger IDs are different and then clear them + $this->assertNotSame($tag1['fire_trigger_ids'][0], $newTag2['fire_trigger_ids'][0]); + unset($tag1['fire_trigger_ids']); + unset($newTag2['fire_trigger_ids']); + unset($tag1['idtag']); + unset($newTag2['idtag']); + + $this->assertEquals($tag1, $newTag2); + } + + public function testCopyTagDifferentContainerReferencingVariables() + { + // Create a tag which references a variable + $variableName = 'TestVariableToReference'; + $variableModel = StaticContainer::get(Variable::class); + $variableModel->addContainerVariable($this->idSite, $this->containerVersion1, DataLayerVariable::ID, $variableName, ['dataLayerName' => 'myVariable'], '', []); + $this->idTag1 = $this->addContainerTag($this->idSite, $this->containerVersion1, null, 'TagReferencingVariable', ['customHtml' => '

Hello {{' . $variableName . '}}

']); + + $containerModel = StaticContainer::get(Container::class); + $context = WebContext::ID; + $description = 'My description'; + + $idContainer = $containerModel->addContainer($this->idSite, $context, 'FooContainer', $description, 0, 0, 0); + $container = $containerModel->getContainer($this->idSite, $idContainer); + $idContainerVersion = $container['draft']['idcontainerversion']; + + // Update trigger to reference variable + $tag1 = $this->model->getContainerTag($this->idSite, $this->containerVersion1, $this->idTag1); + $this->assertCount(1, $tag1['fire_trigger_ids']); + $triggerModel = StaticContainer::get(Trigger::class); + $trigger = $triggerModel->getContainerTrigger($this->idSite, $this->containerVersion1, $tag1['fire_trigger_ids'][0]); + $variableName2 = 'AnotherVariableToReference'; + $variableModel->addContainerVariable($this->idSite, $this->containerVersion1, DataLayerVariable::ID, $variableName2, ['dataLayerName' => 'myVariable'], '', []); + $conditions = [['comparison' => 'equals', 'actual' => $variableName2, 'expected' => 'someValue']] ; + $triggerModel->updateContainerTrigger($this->idSite, $this->containerVersion1, $tag1['fire_trigger_ids'][0], $trigger['name'], $trigger['parameters'], $conditions, $trigger['description']); + + $this->assertCount(0, $variableModel->getContainerVariables($this->idSite, $idContainerVersion), 'There should be no variables in the container.'); + + $idNewTag = $this->model->copyTag($this->idSite, $this->containerVersion1, $this->idTag1, $this->idSite, $idContainer); + + $this->assertCount(2, $variableModel->getContainerVariables($this->idSite, $idContainerVersion), 'The variables should have been copied to the new container.'); + + $newTag = $this->model->getContainerTag($this->idSite, $idContainerVersion, $idNewTag); + + // Clear the values that won't match + $this->assertNotSame($tag1['idcontainerversion'], $newTag['idcontainerversion']); + unset($tag1['idcontainerversion']); + unset($newTag['idcontainerversion']); + $this->assertCount(1, $newTag['fire_trigger_ids']); + // Make sure that the trigger IDs are different and then clear them + $this->assertNotSame($tag1['fire_trigger_ids'][0], $newTag['fire_trigger_ids'][0]); + unset($tag1['fire_trigger_ids']); + unset($newTag['fire_trigger_ids']); + unset($tag1['idtag']); + unset($newTag['idtag']); + + $this->assertEquals($tag1, $newTag); + } + private function addContainerTag($idSite, $idContainerVersion = 5, $type = null, $name = 'MyName', $parameters = [], $fireTriggerIds = [1], $blockTriggerIds = [], $fireLimit = null, $fireDelay = 0, $priority = 9999, $startDate = null, $endDate = null, $description = '', $status = '') { if (!isset($type)) { diff --git a/tests/Integration/Model/TriggerTest.php b/tests/Integration/Model/TriggerTest.php index 051c0ac32..ffdc2fac9 100644 --- a/tests/Integration/Model/TriggerTest.php +++ b/tests/Integration/Model/TriggerTest.php @@ -15,10 +15,12 @@ use Piwik\Plugins\TagManager\Model\Comparison; use Piwik\Plugins\TagManager\Model\Tag; use Piwik\Plugins\TagManager\Model\Trigger; +use Piwik\Plugins\TagManager\Model\Variable; use Piwik\Plugins\TagManager\TagManager; use Piwik\Plugins\TagManager\Template\Tag\CustomHtmlTag; use Piwik\Plugins\TagManager\Template\Trigger\CustomEventTrigger; use Piwik\Plugins\TagManager\Template\Trigger\WindowLoadedTrigger; +use Piwik\Plugins\TagManager\Template\Variable\DataLayerVariable; use Piwik\Plugins\TagManager\Template\Variable\PreConfigured\ErrorUrlVariable; use Piwik\Plugins\TagManager\tests\Framework\TestCase\IntegrationTestCase; use Piwik\Tests\Framework\Fixture; @@ -579,6 +581,59 @@ public function testGetTriggerReferencesWithReferences() $this->assertSame($expected, $this->model->getTriggerReferences($this->idSite, $this->containerVersion1, $idTrigger4)); } + public function testCopyTriggerIfNoEquivalent() + { + $this->assertSame($this->idTrigger1, $this->model->copyTriggerIfNoEquivalent($this->idSite, $this->containerVersion1, $this->idTrigger1), 'The ID should be the same'); + } + + public function testCopyTriggerIfNoEquivalentDifferentContainer() + { + $idNewTrigger = $this->model->copyTriggerIfNoEquivalent($this->idSite, $this->containerVersion1, $this->idTrigger1, $this->idSite, $this->containerVersion2); + $this->assertNotSame($this->idTrigger1, $idNewTrigger, 'The ID should be the same'); + + $trigger1 = $this->model->getContainerTrigger($this->idSite, $this->containerVersion1, $this->idTrigger1); + $trigger2 = $this->model->getContainerTrigger($this->idSite, $this->containerVersion2, $idNewTrigger); + + unset($trigger1['idtrigger']); + unset($trigger2['idtrigger']); + unset($trigger1['idcontainerversion']); + unset($trigger2['idcontainerversion']); + + $this->assertEquals($trigger1, $trigger2, 'The triggers should match'); + + // Confirm that when trying to copy again, the matching trigger is used instead of creating a new copy + $idSecondTrigger = $this->model->copyTriggerIfNoEquivalent($this->idSite, $this->containerVersion1, $this->idTrigger1, $this->idSite, $this->containerVersion2); + $this->assertSame($idNewTrigger, $idSecondTrigger, 'The ID should be the same'); + } + + public function testCopyTriggerIfNoEquivalentReferencesVariable() + { + $trigger1 = $this->model->getContainerTrigger($this->idSite, $this->containerVersion1, $this->idTrigger1); + + $variableName = 'TestVariableToReference'; + $variableModel = StaticContainer::get(Variable::class); + $variableModel->addContainerVariable($this->idSite, $this->containerVersion1, DataLayerVariable::ID, $variableName, ['dataLayerName' => 'myVariable'], '', []); + $conditions = [['comparison' => 'equals', 'actual' => $variableName, 'expected' => 'someValue']] ; + $this->model->updateContainerTrigger($this->idSite, $this->containerVersion1, $this->idTrigger1, $trigger1['name'], $trigger1['parameters'], $conditions, $trigger1['description']); + + $this->assertCount(0, $variableModel->getContainerVariables($this->idSite, $this->containerVersion2), 'There should be no variables in the container.'); + + $idNewTrigger = $this->model->copyTriggerIfNoEquivalent($this->idSite, $this->containerVersion1, $this->idTrigger1, $this->idSite, $this->containerVersion2); + $this->assertNotSame($this->idTrigger1, $idNewTrigger, 'The ID should be the same'); + + $this->assertCount(1, $variableModel->getContainerVariables($this->idSite, $this->containerVersion2), 'The variable should have been copied to the new container.'); + + $trigger2 = $this->model->getContainerTrigger($this->idSite, $this->containerVersion2, $idNewTrigger); + + unset($trigger1['idtrigger']); + unset($trigger2['idtrigger']); + unset($trigger1['idcontainerversion']); + unset($trigger2['idcontainerversion']); + $trigger1['conditions'] = $conditions; + + $this->assertEquals($trigger1, $trigger2, 'The triggers should match'); + } + private function updateContainerTrigger($idSite, $idContainerVersion, $idTrigger, $name = 'MyName', $parameters = [], $conditions = [], $description = '') { return $this->model->updateContainerTrigger($idSite, $idContainerVersion, $idTrigger, $name, $parameters, $conditions, $description); diff --git a/tests/Integration/Model/VariableTest.php b/tests/Integration/Model/VariableTest.php index 23db85e27..a221907c0 100644 --- a/tests/Integration/Model/VariableTest.php +++ b/tests/Integration/Model/VariableTest.php @@ -14,8 +14,10 @@ use Piwik\Plugins\TagManager\Input\Name; use Piwik\Plugins\TagManager\Model\Comparison; use Piwik\Plugins\TagManager\Model\Tag; +use Piwik\Plugins\TagManager\Model\Trigger; use Piwik\Plugins\TagManager\Model\Variable; use Piwik\Plugins\TagManager\TagManager; +use Piwik\Plugins\TagManager\Template\Tag\CustomHtmlTag; use Piwik\Plugins\TagManager\Template\Tag\MatomoTag; use Piwik\Plugins\TagManager\Template\Trigger\WindowLoadedTrigger; use Piwik\Plugins\TagManager\Template\Variable\CustomJsFunctionVariable; @@ -441,6 +443,54 @@ public function testUpdateContainerVariableNameReferencesInCustomJsVariable() $this->assertSame('function () { return {{NewVariableName}}; }', $referencingVariable['parameters']['jsFunction']); } + public function testListVariableNamesInParameters() + { + $idVariable = $this->addContainerVariable($this->idSite, $this->containerVersion1, DataLayerVariable::ID, 'MyName', $parameters = ['dataLayerName' => 'fooBar'], 'myDefault'); + $this->assertSame(2, $idVariable); + + $variable = $this->model->getContainerVariable($this->idSite, $this->containerVersion1, $idVariable); + + $trigger = StaticContainer::get('Piwik\Plugins\TagManager\Model\Trigger'); + $idTrigger1 = $trigger->addContainerTrigger($this->idSite, $this->containerVersion1, WindowLoadedTrigger::ID, 'MyTrigger1', [], []); + $this->assertSame(1, $idTrigger1); + $tagParameters = ['matomoConfig' => "{{{$variable['name']}}}", 'trackingType' => 'pageview']; + $idTag = $this->tagModel->addContainerTag($this->idSite, $this->containerVersion1, MatomoTag::ID, 'Tag1Name', $tagParameters, [$idTrigger1], [], Tag::FIRE_LIMIT_UNLIMITED, 0, 9999, $this->now, $this->now); + $this->assertSame(1, $idTag); + + $tag = $this->tagModel->getContainerTag($this->idSite, $this->containerVersion1, $idTag); + $variableList = $this->model->listVariableNamesInParameters($tag); + $this->assertCount(1, $variableList); + $this->assertSame([$variable['name']], $variableList); + } + + /** + * @dataProvider getListVariableNamesInParametersInCustomJsVariableTestData + * @param string $functionString + * @param array $expectedList + * @return void + */ + public function testListVariableNamesInParametersInCustomJsVariable(string $functionString, array $expectedList) + { + $variableParams = ['jsFunction' => $functionString]; + $idVariable = $this->addContainerVariable($this->idSite, $this->containerVersion1, CustomJsFunctionVariable::ID, 'TestVariable', $variableParams); + $this->assertSame(2, $idVariable); + + $variable = $this->model->getContainerVariable($this->idSite, $this->containerVersion1, $idVariable); + $variableList = $this->model->listVariableNamesInParameters($variable); + $this->assertSame($expectedList, $variableList); + } + + public function getListVariableNamesInParametersInCustomJsVariableTestData() + { + return [ + ['function () { return 12345; }', []], + ['function () { return {{TestVariable}}; }', ['TestVariable']], + ['function () { return {{TestVariable}} {{AnotherTestVariable}}; }', ['TestVariable', 'AnotherTestVariable']], + ['function () { return {{TestVariable}} {{AnotherTestVariable}} {{ThirdTestVariable}}; }', ['TestVariable', 'AnotherTestVariable', 'ThirdTestVariable']], + ['function () { return {{TestVariable}} {{AnotherTestVariable}} {{ThirdTestVariable}} {{TestVariable}} {{AnotherTestVariable}}; }', ['TestVariable', 'AnotherTestVariable', 'ThirdTestVariable']], + ]; + } + public function testGetContainer() { // no need to create new test for this @@ -585,6 +635,48 @@ public function testGetVariableReferencesWhenNoReferences() $this->assertSame([], $this->model->getContainerVariableReferences($this->idSite, $this->containerVersion1, $this->idVariable1)); } + public function testCopyReferencedVariables() + { + $variable = $this->model->getContainerVariable($this->idSite, $this->containerVersion1, $this->idVariable1); + $variableName = $variable['name']; + $trigger = StaticContainer::get(Trigger::class); + $idTrigger1 = $trigger->addContainerTrigger($this->idSite, $this->containerVersion1, WindowLoadedTrigger::ID, 'MyTrigger1', [], []); + $tagModel = StaticContainer::get(Tag::class); + $idTag = $tagModel->addContainerTag($this->idSite, $this->containerVersion1, CustomHtmlTag::ID, 'TagReferencingVariable', ['customHtml' => '

Hello {{' . $variableName . '}}

'], [$idTrigger1], [], Tag::FIRE_LIMIT_UNLIMITED, 0, 9999, $this->now, $this->now); + $initialTag = $tagModel->getContainerTag($this->idSite, $this->containerVersion1, $idTag); + $tag = $tagModel->getContainerTag($this->idSite, $this->containerVersion1, $idTag); + + $this->assertCount(1, $this->model->getContainerVariables($this->idSite, $this->containerVersion1), 'There should be one variable.'); + + $this->model->copyReferencedVariables($tag, $this->idSite, $this->containerVersion1); + + $this->assertCount(1, $this->model->getContainerVariables($this->idSite, $this->containerVersion1), 'There should be one variable.'); + $this->assertEquals($initialTag, $tag, 'The tag should still be the same'); + } + + public function testCopyReferencedVariablesToDifferentContainer() + { + $variable = $this->model->getContainerVariable($this->idSite, $this->containerVersion1, $this->idVariable1); + $variableName = $variable['name']; + $trigger = StaticContainer::get(Trigger::class); + $idTrigger1 = $trigger->addContainerTrigger($this->idSite, $this->containerVersion1, WindowLoadedTrigger::ID, 'MyTrigger1', [], []); + $tagModel = StaticContainer::get(Tag::class); + $idTag = $tagModel->addContainerTag($this->idSite, $this->containerVersion1, CustomHtmlTag::ID, 'TagReferencingVariable', ['customHtml' => '

Hello {{' . $variableName . '}}

'], [$idTrigger1], [], Tag::FIRE_LIMIT_UNLIMITED, 0, 9999, $this->now, $this->now); + $initialTag = $tagModel->getContainerTag($this->idSite, $this->containerVersion1, $idTag); + $tag = $tagModel->getContainerTag($this->idSite, $this->containerVersion1, $idTag); + + $this->assertCount(0, $this->model->getContainerVariables($this->idSite, $this->containerVersion2), 'There should be no variables yet.'); + + $this->model->copyReferencedVariables($tag, $this->idSite, $this->containerVersion1, $this->idSite, $this->containerVersion2); + $this->assertCount(1, $this->model->getContainerVariables($this->idSite, $this->containerVersion2), 'There should be one variable.'); + $this->assertEquals($initialTag, $tag, 'The tag should still be the same'); + + // Test that running copy again doesn't result in another copy + $this->model->copyReferencedVariables($tag, $this->idSite, $this->containerVersion1, $this->idSite, $this->containerVersion2); + $this->assertEquals($initialTag, $tag, 'The tag should still be the same'); + $this->assertCount(1, $this->model->getContainerVariables($this->idSite, $this->containerVersion2), 'There should be one variable.'); + } + private function addContainerVariable($idSite, $idContainerVersion = 5, $type = null, $name = 'MyName', $parameters = [], $defaultValue = '', $lookupTable = [], $description = '') { if (!isset($type)) { diff --git a/tests/UI/ContainerTag_spec.js b/tests/UI/ContainerTag_spec.js index cad9bcffc..cd4293d9a 100644 --- a/tests/UI/ContainerTag_spec.js +++ b/tests/UI/ContainerTag_spec.js @@ -536,4 +536,47 @@ describe("ContainerTag", function () { await page.mouse.move(-10, -10); await capture.page(page, 'save_updated_with_custom_dimensions'); }); + + it('should show dialog to copy tag', async function () { + await page.goto(container1Base); + await clickFirstRowTableAction('icon-content-copy', 3); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTag'); + expect(await pageWrap.screenshot()).to.matchImage('copy_tag_dialog'); + }); + + it('should show list of containers to copy tag to', async function () { + await page.evaluate(() => $('div.matomo-field-select div.select-wrapper input.dropdown-trigger')[0].click()); + await page.waitForTimeout(250); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTag'); + expect(await pageWrap.screenshot()).to.matchImage('copy_tag_container_select'); + }); + + it('should select container to copy tag to', async function () { + await page.evaluate(() => $('div.matomo-field-select ul li:first').click()); + await page.waitForTimeout(250); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTag'); + expect(await pageWrap.screenshot()).to.matchImage('copy_tag_container_selected'); + }); + + it('should show list of sites to copy tag to', async function () { + await page.click('#destinationSite'); + await page.waitForTimeout(250); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTag'); + expect(await pageWrap.screenshot()).to.matchImage('copy_tag_site_select'); + }); + + it('should select site to copy tag to', async function () { + await page.evaluate(() => $('#destinationSite ul li:first').click()); + await page.waitForTimeout(250); + pageWrap = await page.waitForSelector('div.ui-dialog.mtmCopyTag'); + expect(await pageWrap.screenshot()).to.matchImage('copy_tag_site_selected'); + }); + + it('should be able to copy tag', async function () { + await page.goto(container1Base); + await clickFirstRowTableAction('icon-content-copy', 3); + await page.evaluate(() => $('div.copyMtmObjectDialog button.btn').click()); + await page.waitForNetworkIdle(); + await capture.page(page, 'copy_tag_success'); + }); }); diff --git a/tests/UI/expected-screenshots/ContainerTag_confirm_delete_tag_confirmed.png b/tests/UI/expected-screenshots/ContainerTag_confirm_delete_tag_confirmed.png index fd6f6adbc..82b86ad42 100644 --- a/tests/UI/expected-screenshots/ContainerTag_confirm_delete_tag_confirmed.png +++ b/tests/UI/expected-screenshots/ContainerTag_confirm_delete_tag_confirmed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f6bcda1dd62e37df45cf98388770b097b6622b7ad6990351740d613c8b289147 -size 120158 +oid sha256:ed31c27b4c99843228a7bc1ddf10fb960a079aee7227c81607072e9db5966841 +size 121249 diff --git a/tests/UI/expected-screenshots/ContainerTag_confirm_delete_tag_declined.png b/tests/UI/expected-screenshots/ContainerTag_confirm_delete_tag_declined.png index 6deef9b5f..a95383100 100644 --- a/tests/UI/expected-screenshots/ContainerTag_confirm_delete_tag_declined.png +++ b/tests/UI/expected-screenshots/ContainerTag_confirm_delete_tag_declined.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7f261041077e933a859365a6a8d845a2d012e88fdd0d7eef20806e89462ed95b -size 126227 +oid sha256:86e554d7b9871c7b84b3b5c742d07f52490a97cdc2432e0a2277c4674688955f +size 127746 diff --git a/tests/UI/expected-screenshots/ContainerTag_confirm_pause_tag_confirmed.png b/tests/UI/expected-screenshots/ContainerTag_confirm_pause_tag_confirmed.png index 6177c1500..60a7f2664 100644 --- a/tests/UI/expected-screenshots/ContainerTag_confirm_pause_tag_confirmed.png +++ b/tests/UI/expected-screenshots/ContainerTag_confirm_pause_tag_confirmed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2ba056764d5d68f340003bc306216e1741590d3ed8e7836c0505b61990a623b -size 137716 +oid sha256:83938ac8034844d719b1b440a4bbedbc2be16783d078a6ea8ace4e1ab7f87d49 +size 139038 diff --git a/tests/UI/expected-screenshots/ContainerTag_confirm_paused_tag_declined.png b/tests/UI/expected-screenshots/ContainerTag_confirm_paused_tag_declined.png index 6deef9b5f..a95383100 100644 --- a/tests/UI/expected-screenshots/ContainerTag_confirm_paused_tag_declined.png +++ b/tests/UI/expected-screenshots/ContainerTag_confirm_paused_tag_declined.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7f261041077e933a859365a6a8d845a2d012e88fdd0d7eef20806e89462ed95b -size 126227 +oid sha256:86e554d7b9871c7b84b3b5c742d07f52490a97cdc2432e0a2277c4674688955f +size 127746 diff --git a/tests/UI/expected-screenshots/ContainerTag_confirm_resume_tag_confirmed.png b/tests/UI/expected-screenshots/ContainerTag_confirm_resume_tag_confirmed.png index 4d636e467..72cf4d05d 100644 --- a/tests/UI/expected-screenshots/ContainerTag_confirm_resume_tag_confirmed.png +++ b/tests/UI/expected-screenshots/ContainerTag_confirm_resume_tag_confirmed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17a5fcbc69ce633a8c782530bbd0c80255215dd7c19c2825b2654f0bfa2f0e3a -size 137722 +oid sha256:cc78215ec27c4259d3b259907177b2cecd82a8ca3c1462ea098266bf91fa7bb2 +size 139037 diff --git a/tests/UI/expected-screenshots/ContainerTag_confirm_resume_tag_declined.png b/tests/UI/expected-screenshots/ContainerTag_confirm_resume_tag_declined.png index eb9cbec90..2770279d0 100644 --- a/tests/UI/expected-screenshots/ContainerTag_confirm_resume_tag_declined.png +++ b/tests/UI/expected-screenshots/ContainerTag_confirm_resume_tag_declined.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2498953963405a94fc748d43b3d1e59726f6c5f20453d9b5f55ed64e4dd369c0 -size 126355 +oid sha256:3a38b5c0e0855d6b8197ecd7479ae2ccaa01f07a8c53994f3c1274bb73f99867 +size 127871 diff --git a/tests/UI/expected-screenshots/ContainerTag_copy_tag_container_select.png b/tests/UI/expected-screenshots/ContainerTag_copy_tag_container_select.png new file mode 100644 index 000000000..34f2971ba --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTag_copy_tag_container_select.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:241530de692a7a3db2b8ef0c7cfd45c33baa29c02b60cbb95e2bff66ee5bcdf2 +size 20069 diff --git a/tests/UI/expected-screenshots/ContainerTag_copy_tag_container_selected.png b/tests/UI/expected-screenshots/ContainerTag_copy_tag_container_selected.png new file mode 100644 index 000000000..ea719009d --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTag_copy_tag_container_selected.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0d2805f50afd973cccfa8841e84f5a5baa5f9fff506737c4867677e9dc5be93 +size 28006 diff --git a/tests/UI/expected-screenshots/ContainerTag_copy_tag_dialog.png b/tests/UI/expected-screenshots/ContainerTag_copy_tag_dialog.png new file mode 100644 index 000000000..b2cf60e49 --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTag_copy_tag_dialog.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c32767f60549f47903996ac7e75a2635427bfb4adf39e8a5835686e0fc278cf1 +size 26277 diff --git a/tests/UI/expected-screenshots/ContainerTag_copy_tag_site_select.png b/tests/UI/expected-screenshots/ContainerTag_copy_tag_site_select.png new file mode 100644 index 000000000..028c4f467 --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTag_copy_tag_site_select.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25e2901fe7d3d517c70dfa6ea1cd167c8692874065867d5a7cb217210f15e96c +size 30071 diff --git a/tests/UI/expected-screenshots/ContainerTag_copy_tag_site_selected.png b/tests/UI/expected-screenshots/ContainerTag_copy_tag_site_selected.png new file mode 100644 index 000000000..0b75f21b3 --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTag_copy_tag_site_selected.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:304c74661a041a8b5c6b302cc1923d859188c7196eae5b6122a29c52e89dcf65 +size 26782 diff --git a/tests/UI/expected-screenshots/ContainerTag_copy_tag_success.png b/tests/UI/expected-screenshots/ContainerTag_copy_tag_success.png new file mode 100644 index 000000000..f388683b7 --- /dev/null +++ b/tests/UI/expected-screenshots/ContainerTag_copy_tag_success.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32a028324d5a16fde5266571e3d2afd4a2bbb6db4ca7800bdc4bf6a4accf59b9 +size 157663 diff --git a/tests/UI/expected-screenshots/ContainerTag_create_advanced_verified.png b/tests/UI/expected-screenshots/ContainerTag_create_advanced_verified.png index 118fc6654..22e334556 100644 --- a/tests/UI/expected-screenshots/ContainerTag_create_advanced_verified.png +++ b/tests/UI/expected-screenshots/ContainerTag_create_advanced_verified.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c5d41c94cdd26ecb2e7c0503f0cdce6543b674835430d30557a1cafabdcacab -size 74960 +oid sha256:cb5713fc22f218f09ae636cd12edc42cfc5ea769f16cdc43a2905e1c90d6f78c +size 75816 diff --git a/tests/UI/expected-screenshots/ContainerTag_create_new_long_name.png b/tests/UI/expected-screenshots/ContainerTag_create_new_long_name.png index 38b1f9f09..57c426e57 100644 --- a/tests/UI/expected-screenshots/ContainerTag_create_new_long_name.png +++ b/tests/UI/expected-screenshots/ContainerTag_create_new_long_name.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1b5a263e2fa99eddabaa72e3f6cbd9608a31c27dd8cd4c1587c8ffcbff69d6be -size 142032 +oid sha256:be65bbcfc2b9bdffed59df3c6768a965c0ba921518021b6c90ec521fa9e52f62 +size 143190 diff --git a/tests/UI/expected-screenshots/ContainerTag_create_new_shown_in_list.png b/tests/UI/expected-screenshots/ContainerTag_create_new_shown_in_list.png index 928293b3f..f785f0711 100644 --- a/tests/UI/expected-screenshots/ContainerTag_create_new_shown_in_list.png +++ b/tests/UI/expected-screenshots/ContainerTag_create_new_shown_in_list.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c0f477b0a7fafaddd709b5a2cf7a53d40bcd2762f70b6fd7f9866cc308a19a7b -size 135259 +oid sha256:d665f45362f09b74794b48ff102f37c8b39c25a3da2ec6a80db2b9d05cf6279c +size 137050 diff --git a/tests/UI/expected-screenshots/ContainerTag_edit_updated_back_to_list.png b/tests/UI/expected-screenshots/ContainerTag_edit_updated_back_to_list.png index ad77b24cc..55babfbd4 100644 --- a/tests/UI/expected-screenshots/ContainerTag_edit_updated_back_to_list.png +++ b/tests/UI/expected-screenshots/ContainerTag_edit_updated_back_to_list.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:04dc5ae386f637d16204aabddef3961592a8c307ebd81c05c26712e436e2652b -size 137300 +oid sha256:595b9955f457df925381a20a9538fdb3c1a006876a12e46f18ed9a7afa6cd99a +size 138574 diff --git a/tests/UI/expected-screenshots/ContainerTag_save_new_with_custom_dimensions.png b/tests/UI/expected-screenshots/ContainerTag_save_new_with_custom_dimensions.png index 00566735e..a72c9f23b 100644 --- a/tests/UI/expected-screenshots/ContainerTag_save_new_with_custom_dimensions.png +++ b/tests/UI/expected-screenshots/ContainerTag_save_new_with_custom_dimensions.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de0fd721e1f75b6464524505cb527d1b94377b6d012385b5496cd05405428c26 -size 149656 +oid sha256:27928f98d78d900a59f2e1c50263893c341bdd82b0f101d5feb08f3b022dedf9 +size 152080 diff --git a/tests/UI/expected-screenshots/ContainerTag_tag_search_by_status_active.png b/tests/UI/expected-screenshots/ContainerTag_tag_search_by_status_active.png index 6a5b1c0a7..fb697f33f 100644 --- a/tests/UI/expected-screenshots/ContainerTag_tag_search_by_status_active.png +++ b/tests/UI/expected-screenshots/ContainerTag_tag_search_by_status_active.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d82bd7d145da00c2b03c060e65bb7ebbf3e7618fa2ae41b639c9a4ac3470728e -size 119507 +oid sha256:10033bf6c931f29accb4fe5a4fbd450c149905437b486a2cb99706a9ef0c9b86 +size 120265 diff --git a/tests/UI/expected-screenshots/ContainerTag_tag_search_custom_html_content.png b/tests/UI/expected-screenshots/ContainerTag_tag_search_custom_html_content.png index c32787856..3bb1be5bc 100644 --- a/tests/UI/expected-screenshots/ContainerTag_tag_search_custom_html_content.png +++ b/tests/UI/expected-screenshots/ContainerTag_tag_search_custom_html_content.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24158a747300f8809f67ce64008e347614ad4f0d33a3185e5f163cbd29378f1d -size 102502 +oid sha256:a40551193e2aa688dfacbb6d19fb05daf544838fa68597f636e7175706a40f2d +size 102750 diff --git a/tests/UI/expected-screenshots/ContainerTag_tag_search_description.png b/tests/UI/expected-screenshots/ContainerTag_tag_search_description.png index 1a687c0d1..58d0c12d8 100644 --- a/tests/UI/expected-screenshots/ContainerTag_tag_search_description.png +++ b/tests/UI/expected-screenshots/ContainerTag_tag_search_description.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1fd50bda17519bd2bf13740d4312a98abf41d6513512f5720d04662a9874b643 -size 108242 +oid sha256:86d174fdb224aac71d60624c089cb609cb8abbc69feab3d9072f3979fd0f33bd +size 108181 diff --git a/tests/UI/expected-screenshots/ContainerTag_tag_search_name.png b/tests/UI/expected-screenshots/ContainerTag_tag_search_name.png index 41a01bd0b..e7c475c52 100644 --- a/tests/UI/expected-screenshots/ContainerTag_tag_search_name.png +++ b/tests/UI/expected-screenshots/ContainerTag_tag_search_name.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8149a9a5a9bf6234bec4cd61f2fd3ac3f02d2c330fea7bc9ff360debdac00a2a -size 106661 +oid sha256:888756d413f168fe2d725801e5f014e6a92c42557353ec2cfd2c930b97c3b594 +size 106584 diff --git a/tests/UI/expected-screenshots/ContainerTag_tag_search_trigger_result.png b/tests/UI/expected-screenshots/ContainerTag_tag_search_trigger_result.png index feebd75e7..1a0ea117c 100644 --- a/tests/UI/expected-screenshots/ContainerTag_tag_search_trigger_result.png +++ b/tests/UI/expected-screenshots/ContainerTag_tag_search_trigger_result.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:85de3ccbaee1f72303d7064092ae48b0d5afd786de6324a85fff1be67eb25f22 -size 112497 +oid sha256:31471693a337548f8baf1e0d5fe8f3f9f5c761474f6bea76979328b1a80584df +size 112718 diff --git a/tests/UI/expected-screenshots/ContainerTag_tag_search_trigger_result_multiple.png b/tests/UI/expected-screenshots/ContainerTag_tag_search_trigger_result_multiple.png index 86267cba4..451ba658e 100644 --- a/tests/UI/expected-screenshots/ContainerTag_tag_search_trigger_result_multiple.png +++ b/tests/UI/expected-screenshots/ContainerTag_tag_search_trigger_result_multiple.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:db7f318565b4fea643be998c95f1812998e41264f6d82e8194e1cf1b1acf8b23 -size 105255 +oid sha256:1a394086834bc8761eaff1a9920ed65b20e48974fe1ae3f6088b0abaf26a341a +size 105057 diff --git a/tests/UI/expected-screenshots/ContainerTag_tag_search_type.png b/tests/UI/expected-screenshots/ContainerTag_tag_search_type.png index afeffb329..4b0cfda0d 100644 --- a/tests/UI/expected-screenshots/ContainerTag_tag_search_type.png +++ b/tests/UI/expected-screenshots/ContainerTag_tag_search_type.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59719afa0e4aee71e31663bccd37aac60c9c4fb54a3bc0070dea2ba3d593f40c -size 112295 +oid sha256:fefe727a7b089e8e2369cb06e4a2a3a1559b1cbd97041818b525e21fb5b93202 +size 112516 diff --git a/tests/UI/expected-screenshots/ContainerTag_tag_some_exist.png b/tests/UI/expected-screenshots/ContainerTag_tag_some_exist.png index 3fefbd169..222997ec0 100644 --- a/tests/UI/expected-screenshots/ContainerTag_tag_some_exist.png +++ b/tests/UI/expected-screenshots/ContainerTag_tag_some_exist.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b075aabefb1c6f99e61ccb87265b8f7ac5c08e0cabfc94b6557a1372885bd95a -size 118743 +oid sha256:0276f48c33c780c5b4826fe56e8d3b947fad84d158732f81c04c489b34584776 +size 119543 diff --git a/vue/dist/TagManager.umd.js b/vue/dist/TagManager.umd.js index 602469476..d911415bf 100644 --- a/vue/dist/TagManager.umd.js +++ b/vue/dist/TagManager.umd.js @@ -5428,83 +5428,81 @@ var TagEditvue_type_script_lang_ts_notificationId = 'tagtagmanagement'; TagEditvue_type_script_lang_ts.render = TagEditvue_type_template_id_527741a0_render /* harmony default export */ var TagEdit = (TagEditvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/TagManager/vue/src/Tag/TagList.vue?vue&type=template&id=5feac3f8 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/TagManager/vue/src/Tag/TagList.vue?vue&type=template&id=63d6d123 -var TagListvue_type_template_id_5feac3f8_hoisted_1 = { +var TagListvue_type_template_id_63d6d123_hoisted_1 = { class: "tagManagerManageList tagManagerTagList" }; -var TagListvue_type_template_id_5feac3f8_hoisted_2 = { +var TagListvue_type_template_id_63d6d123_hoisted_2 = { class: "tagSearchFilter" }; -var TagListvue_type_template_id_5feac3f8_hoisted_3 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_4 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_5 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_6 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_7 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_8 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_9 = { +var TagListvue_type_template_id_63d6d123_hoisted_3 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_4 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_5 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_6 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_7 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_8 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_9 = { colspan: "6" }; -var TagListvue_type_template_id_5feac3f8_hoisted_10 = { +var TagListvue_type_template_id_63d6d123_hoisted_10 = { class: "loadingPiwik" }; -var TagListvue_type_template_id_5feac3f8_hoisted_11 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +var TagListvue_type_template_id_63d6d123_hoisted_11 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); -var TagListvue_type_template_id_5feac3f8_hoisted_12 = { +var TagListvue_type_template_id_63d6d123_hoisted_12 = { colspan: "6" }; -var TagListvue_type_template_id_5feac3f8_hoisted_13 = ["id"]; -var TagListvue_type_template_id_5feac3f8_hoisted_14 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_15 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_16 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_17 = { +var TagListvue_type_template_id_63d6d123_hoisted_13 = ["id"]; +var TagListvue_type_template_id_63d6d123_hoisted_14 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_15 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_16 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_17 = { class: "triggers" }; -var TagListvue_type_template_id_5feac3f8_hoisted_18 = ["onClick", "title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_19 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_20 = ["onClick", "title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_21 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_22 = ["title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_23 = { - class: "action" -}; -var TagListvue_type_template_id_5feac3f8_hoisted_24 = ["onClick", "title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_25 = ["onClick", "title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_26 = ["onClick", "title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_27 = ["onClick", "title"]; -var TagListvue_type_template_id_5feac3f8_hoisted_28 = { +var TagListvue_type_template_id_63d6d123_hoisted_18 = ["onClick", "title"]; +var TagListvue_type_template_id_63d6d123_hoisted_19 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_20 = ["onClick", "title"]; +var TagListvue_type_template_id_63d6d123_hoisted_21 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_22 = ["title"]; +var TagListvue_type_template_id_63d6d123_hoisted_23 = ["onClick", "title"]; +var TagListvue_type_template_id_63d6d123_hoisted_24 = ["onClick", "title"]; +var TagListvue_type_template_id_63d6d123_hoisted_25 = ["onClick", "title"]; +var TagListvue_type_template_id_63d6d123_hoisted_26 = ["onClick", "title"]; +var TagListvue_type_template_id_63d6d123_hoisted_27 = ["onClick", "title"]; +var TagListvue_type_template_id_63d6d123_hoisted_28 = { class: "tableActionBar" }; -var TagListvue_type_template_id_5feac3f8_hoisted_29 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +var TagListvue_type_template_id_63d6d123_hoisted_29 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "icon-add" }, " ", -1); -var TagListvue_type_template_id_5feac3f8_hoisted_30 = { +var TagListvue_type_template_id_63d6d123_hoisted_30 = { class: "ui-confirm", id: "confirmDeleteTag", ref: "confirmDeleteTag" }; -var TagListvue_type_template_id_5feac3f8_hoisted_31 = ["value"]; -var TagListvue_type_template_id_5feac3f8_hoisted_32 = ["value"]; -var TagListvue_type_template_id_5feac3f8_hoisted_33 = { +var TagListvue_type_template_id_63d6d123_hoisted_31 = ["value"]; +var TagListvue_type_template_id_63d6d123_hoisted_32 = ["value"]; +var TagListvue_type_template_id_63d6d123_hoisted_33 = { class: "ui-confirm", id: "confirmPauseTag", ref: "confirmPauseTag" }; -var TagListvue_type_template_id_5feac3f8_hoisted_34 = ["value"]; -var TagListvue_type_template_id_5feac3f8_hoisted_35 = ["value"]; -var TagListvue_type_template_id_5feac3f8_hoisted_36 = { +var TagListvue_type_template_id_63d6d123_hoisted_34 = ["value"]; +var TagListvue_type_template_id_63d6d123_hoisted_35 = ["value"]; +var TagListvue_type_template_id_63d6d123_hoisted_36 = { class: "ui-confirm", id: "confirmResumeTag", ref: "confirmResumeTag" }; -var TagListvue_type_template_id_5feac3f8_hoisted_37 = ["value"]; -var TagListvue_type_template_id_5feac3f8_hoisted_38 = ["value"]; -function TagListvue_type_template_id_5feac3f8_render(_ctx, _cache, $props, $setup, $data, $options) { +var TagListvue_type_template_id_63d6d123_hoisted_37 = ["value"]; +var TagListvue_type_template_id_63d6d123_hoisted_38 = ["value"]; +function TagListvue_type_template_id_63d6d123_render(_ctx, _cache, $props, $setup, $data, $options) { var _this = this; var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); @@ -5513,13 +5511,13 @@ function TagListvue_type_template_id_5feac3f8_render(_ctx, _cache, $props, $setu var _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", TagListvue_type_template_id_5feac3f8_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", TagListvue_type_template_id_63d6d123_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { feature: "Tag Manager", "content-title": _ctx.translate('TagManager_ManageX', _ctx.translate('TagManager_Tags')), "help-text": _ctx.tagsHelpText }, { default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_TagUsageBenefits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_5feac3f8_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_TagUsageBenefits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_63d6d123_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "text", name: "tagSearch", title: _ctx.translate('General_Search'), @@ -5530,22 +5528,22 @@ function TagListvue_type_template_id_5feac3f8_render(_ctx, _cache, $props, $setu }, null, 8, ["title", "modelValue"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.tags.length > 0]])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("table", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { class: "name", title: _ctx.nameTranslatedText - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 9, TagListvue_type_template_id_5feac3f8_hoisted_3), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 9, TagListvue_type_template_id_63d6d123_hoisted_3), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { class: "description", title: _ctx.descriptionTranslatedText - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Description')), 9, TagListvue_type_template_id_5feac3f8_hoisted_4), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Description')), 9, TagListvue_type_template_id_63d6d123_hoisted_4), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { class: "type", title: _ctx.typeTranslatedText - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_Type')), 9, TagListvue_type_template_id_5feac3f8_hoisted_5), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_Type')), 9, TagListvue_type_template_id_63d6d123_hoisted_5), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { class: "triggers", title: _ctx.triggersTranslatedText - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_Triggers')), 9, TagListvue_type_template_id_5feac3f8_hoisted_6), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_Triggers')), 9, TagListvue_type_template_id_63d6d123_hoisted_6), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { class: "lastUpdated", title: _ctx.lastUpdatedTranslatedText - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_LastUpdated')), 9, TagListvue_type_template_id_5feac3f8_hoisted_7), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_LastUpdated')), 9, TagListvue_type_template_id_63d6d123_hoisted_7), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", { class: "action", title: _ctx.actionTranslatedText - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Actions')), 9, TagListvue_type_template_id_5feac3f8_hoisted_8), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasWriteAccess]])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", TagListvue_type_template_id_5feac3f8_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", TagListvue_type_template_id_5feac3f8_hoisted_10, [TagListvue_type_template_id_5feac3f8_hoisted_11, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading || _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", TagListvue_type_template_id_5feac3f8_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_NoTagsFound')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Actions')), 9, TagListvue_type_template_id_63d6d123_hoisted_8), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasWriteAccess]])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", TagListvue_type_template_id_63d6d123_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", TagListvue_type_template_id_63d6d123_hoisted_10, [TagListvue_type_template_id_63d6d123_hoisted_11, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading || _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", TagListvue_type_template_id_63d6d123_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_NoTagsFound')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { class: "createContainerTagNow", onClick: _cache[1] || (_cache[1] = function ($event) { return _ctx.createTag(); @@ -5558,13 +5556,13 @@ function TagListvue_type_template_id_5feac3f8_render(_ctx, _cache, $props, $setu }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { class: "name", title: tag.name - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(tag.name, 50)), 9, TagListvue_type_template_id_5feac3f8_hoisted_14), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(tag.name, 50)), 9, TagListvue_type_template_id_63d6d123_hoisted_14), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { class: "description", title: tag.description - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(tag.description, 75)), 9, TagListvue_type_template_id_5feac3f8_hoisted_15), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(tag.description, 75)), 9, TagListvue_type_template_id_63d6d123_hoisted_15), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { class: "type", title: tag.typeMetadata.description - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(tag.typeMetadata.name), 9, TagListvue_type_template_id_5feac3f8_hoisted_16), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", TagListvue_type_template_id_5feac3f8_hoisted_17, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(tag.fire_trigger_ids, function (fireTriggerId, fireTriggerIndex) { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(tag.typeMetadata.name), 9, TagListvue_type_template_id_63d6d123_hoisted_16), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", TagListvue_type_template_id_63d6d123_hoisted_17, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(tag.fire_trigger_ids, function (fireTriggerId, fireTriggerIndex) { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { key: fireTriggerIndex, style: { @@ -5582,11 +5580,11 @@ function TagListvue_type_template_id_5feac3f8_render(_ctx, _cache, $props, $setu return _ctx.editTrigger(fireTriggerId); }, ["prevent"]), title: _this.triggers[fireTriggerId] - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(_this.triggers[fireTriggerId], _ctx.triggerTruncateLength)), 9, TagListvue_type_template_id_5feac3f8_hoisted_18)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.hasWriteAccess ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(_this.triggers[fireTriggerId], _ctx.triggerTruncateLength)), 9, TagListvue_type_template_id_63d6d123_hoisted_18)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.hasWriteAccess ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { key: 1, class: "chip", title: _this.triggers[fireTriggerId] - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(_this.triggers[fireTriggerId], _ctx.triggerTruncateLength)), 9, TagListvue_type_template_id_5feac3f8_hoisted_19)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]); + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(_this.triggers[fireTriggerId], _ctx.triggerTruncateLength)), 9, TagListvue_type_template_id_63d6d123_hoisted_19)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]); }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_Except')) + ": ", 1), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(tag.block_trigger_ids, function (blockTriggerId, index) { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { key: index, @@ -5600,74 +5598,82 @@ function TagListvue_type_template_id_5feac3f8_render(_ctx, _cache, $props, $setu return _ctx.editTrigger(blockTriggerId); }, ["prevent"]), title: _this.triggers[blockTriggerId] - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(_this.triggers[blockTriggerId], _ctx.triggerTruncateLength)), 9, TagListvue_type_template_id_5feac3f8_hoisted_20), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasWriteAccess]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(_this.triggers[blockTriggerId], _ctx.triggerTruncateLength)), 9, TagListvue_type_template_id_63d6d123_hoisted_20), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasWriteAccess]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "chip", title: _this.triggers[blockTriggerId] - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(_this.triggers[blockTriggerId], _ctx.triggerTruncateLength)), 9, TagListvue_type_template_id_5feac3f8_hoisted_21), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.hasWriteAccess]])]); + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncateText(_this.triggers[blockTriggerId], _ctx.triggerTruncateLength)), 9, TagListvue_type_template_id_63d6d123_hoisted_21), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.hasWriteAccess]])]); }), 128))], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], tag.block_trigger_ids.length]])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { class: "lastUpdated", title: _ctx.translate('TagManager_CreatedOnX', tag.created_date_pretty) - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(tag.updated_date_pretty), 1)], 8, TagListvue_type_template_id_5feac3f8_hoisted_22), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", TagListvue_type_template_id_5feac3f8_hoisted_23, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(tag.updated_date_pretty), 1)], 8, TagListvue_type_template_id_63d6d123_hoisted_22), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(_ctx.getActionClasses) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { class: "table-action icon-pause", onClick: function onClick($event) { return _ctx.pauseTag(tag); }, title: _ctx.translate('TagManager_PauseX', _ctx.translate('TagManager_Tag')) - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_24), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], tag.status === 'active']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_23), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], tag.status === 'active']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { class: "table-action icon-play", onClick: function onClick($event) { return _ctx.resumeTag(tag); }, title: _ctx.translate('TagManager_ResumeX', _ctx.translate('TagManager_Tag')) - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_25), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], tag.status === 'paused']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_24), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], tag.status === 'paused']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { class: "table-action icon-edit", onClick: function onClick($event) { return _ctx.editTag(tag.idtag, tag.type); }, title: _ctx.translate('TagManager_EditTag') - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_26), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_25), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { class: "table-action icon-delete", onClick: function onClick($event) { return _ctx.deleteTag(tag); }, title: _ctx.translate('TagManager_DeleteX', _ctx.translate('TagManager_Tag')) - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_27)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasWriteAccess]])], 8, TagListvue_type_template_id_5feac3f8_hoisted_13); - }), 128))])], 512), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_5feac3f8_hoisted_28, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_26), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-content-copy", + onClick: function onClick($event) { + return _ctx.openCopyDialog(tag); + }, + title: _ctx.translate('TagManager_CopyX', _ctx.translate('TagManager_Tag')) + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_27), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasPublishCapability()]])], 2), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasWriteAccess]])], 8, TagListvue_type_template_id_63d6d123_hoisted_13); + }), 128))])], 512), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_63d6d123_hoisted_28, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { class: "createNewTag", value: "", onClick: _cache[2] || (_cache[2] = function ($event) { return _ctx.createTag(); }) - }, [TagListvue_type_template_id_5feac3f8_hoisted_29, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_CreateNewTag')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasWriteAccess]])]; + }, [TagListvue_type_template_id_63d6d123_hoisted_29, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_CreateNewTag')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hasWriteAccess]])]; }), _: 1 - }, 8, ["content-title", "help-text"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_5feac3f8_hoisted_30, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_DeleteTagConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, 8, ["content-title", "help-text"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_63d6d123_hoisted_30, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_DeleteTagConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "yes", type: "button", value: _ctx.translate('General_Yes') - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_31), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_31), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "no", type: "button", value: _ctx.translate('General_No') - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_32)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_5feac3f8_hoisted_33, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_PauseTagConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_32)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_63d6d123_hoisted_33, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_PauseTagConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "yes", type: "button", value: _ctx.translate('General_Yes') - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_34), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_34), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "no", type: "button", value: _ctx.translate('General_No') - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_35)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_5feac3f8_hoisted_36, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_ResumeTagConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_35)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", TagListvue_type_template_id_63d6d123_hoisted_36, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_ResumeTagConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "yes", type: "button", value: _ctx.translate('General_Yes') - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_37), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_37), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "no", type: "button", value: _ctx.translate('General_No') - }, null, 8, TagListvue_type_template_id_5feac3f8_hoisted_38)], 512)]); + }, null, 8, TagListvue_type_template_id_63d6d123_hoisted_38)], 512)]); } -// CONCATENATED MODULE: ./plugins/TagManager/vue/src/Tag/TagList.vue?vue&type=template&id=5feac3f8 +// CONCATENATED MODULE: ./plugins/TagManager/vue/src/Tag/TagList.vue?vue&type=template&id=63d6d123 // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/TagManager/vue/src/Tag/TagList.vue?vue&type=script&lang=ts function TagListvue_type_script_lang_ts_toConsumableArray(arr) { return TagListvue_type_script_lang_ts_arrayWithoutHoles(arr) || TagListvue_type_script_lang_ts_iterableToArray(arr) || TagListvue_type_script_lang_ts_unsupportedIterableToArray(arr) || TagListvue_type_script_lang_ts_nonIterableSpread(); } @@ -5820,6 +5826,17 @@ var TagListvue_type_script_lang_ts_notificationId = 'tagtagmanagementlist'; setTimeout(function () { external_CoreHome_["NotificationsStore"].scrollToNotification(instanceId); }, 200); + }, + openCopyDialog: function openCopyDialog(tag) { + var url = external_CoreHome_["MatomoUrl"].stringify({ + module: 'TagManager', + action: 'copyTagDialog', + idSite: tag.idsite, + idContainer: this.idContainer, + idTag: tag.idtag, + idContainerVersion: this.idContainerVersion + }); + window.Piwik_Popover.createPopupAndLoadUrl(url, '', 'mtmCopyTag'); } }, computed: { @@ -5898,6 +5915,10 @@ var TagListvue_type_script_lang_ts_notificationId = 'tagtagmanagementlist'; }, actionTranslatedText: function actionTranslatedText() { return this.translate('TagManager_TagsActionDescription'); + }, + getActionClasses: function getActionClasses() { + var copyClass = this.hasPublishCapability() ? ' hasCopyAction' : ''; + return "action".concat(copyClass); } } })); @@ -5907,7 +5928,7 @@ var TagListvue_type_script_lang_ts_notificationId = 'tagtagmanagementlist'; -TagListvue_type_script_lang_ts.render = TagListvue_type_template_id_5feac3f8_render +TagListvue_type_script_lang_ts.render = TagListvue_type_template_id_63d6d123_render /* harmony default export */ var TagList = (TagListvue_type_script_lang_ts); // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/TagManager/vue/src/Tag/TagManage.vue?vue&type=template&id=02e1fe94 @@ -10720,21 +10741,18 @@ function getCircularReplacer() { Debuggingvue_type_script_lang_ts.render = Debuggingvue_type_template_id_1ae9acce_render /* harmony default export */ var Debugging = (Debuggingvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/TagManager/vue/src/CopyDialog/CopyDialog.vue?vue&type=template&id=8772cafa +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/TagManager/vue/src/CopyDialog/CopyDialog.vue?vue&type=template&id=7e821988 -var CopyDialogvue_type_template_id_8772cafa_hoisted_1 = { +var CopyDialogvue_type_template_id_7e821988_hoisted_1 = { class: "copyMtmObjectDialog" }; -var CopyDialogvue_type_template_id_8772cafa_hoisted_2 = ["innerHTML"]; -var CopyDialogvue_type_template_id_8772cafa_hoisted_3 = ["href"]; -function CopyDialogvue_type_template_id_8772cafa_render(_ctx, _cache, $props, $setup, $data, $options) { +var CopyDialogvue_type_template_id_7e821988_hoisted_2 = ["innerHTML"]; +function CopyDialogvue_type_template_id_7e821988_render(_ctx, _cache, $props, $setup, $data, $options) { var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); - var _component_ContainerSelector = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContainerSelector"); - var _directive_form = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("form"); - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", CopyDialogvue_type_template_id_8772cafa_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.getCopyDialogTitle), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.getCopyDescription), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", CopyDialogvue_type_template_id_7e821988_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.getCopyDialogTitle), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.getCopyDescription), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "site", name: "destinationSite", title: _ctx.translate('TagManager_ChooseWebsite'), @@ -10742,10 +10760,8 @@ function CopyDialogvue_type_template_id_8772cafa_render(_ctx, _cache, $props, $s "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { return _ctx.site = $event; }) - }, null, 8, ["title", "modelValue"]), _ctx.copyType.toLowerCase() !== 'container' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_ContainerSelector, { - key: 0 - })) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.copyType.toLowerCase() !== 'container' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_Field, { - key: 1, + }, null, 8, ["title", "modelValue"]), _ctx.copyType.toLowerCase() !== 'container' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_Field, { + key: 0, uicontrol: "select", name: "idDestinationContainer", options: _ctx.containerOptions, @@ -10757,21 +10773,26 @@ function CopyDialogvue_type_template_id_8772cafa_render(_ctx, _cache, $props, $s return _ctx.idDestinationContainer = $event; }) }, null, 8, ["options", "disabled", "title", "modelValue"])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.copyType.toLowerCase() === 'container' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", { - key: 2, + key: 1, class: "copyNote", innerHTML: _ctx.$sanitize(_ctx.getCopyContainerNote) - }, null, 8, CopyDialogvue_type_template_id_8772cafa_hoisted_2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - href: _ctx.getCopyUrl, - class: "btn" - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Copy')), 9, CopyDialogvue_type_template_id_8772cafa_hoisted_3)], 512), [[_directive_form]])]); + }, null, 8, CopyDialogvue_type_template_id_7e821988_hoisted_2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", { + class: "btn", + onClick: _cache[2] || (_cache[2] = function () { + return _ctx.performCopy && _ctx.performCopy.apply(_ctx, arguments); + }) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Copy')), 1)], 512), [[_directive_form]])]); } -// CONCATENATED MODULE: ./plugins/TagManager/vue/src/CopyDialog/CopyDialog.vue?vue&type=template&id=8772cafa +// CONCATENATED MODULE: ./plugins/TagManager/vue/src/CopyDialog/CopyDialog.vue?vue&type=template&id=7e821988 // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/TagManager/vue/src/CopyDialog/CopyDialog.vue?vue&type=script&lang=ts + + + /* harmony default export */ var CopyDialogvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { defaultSite: { @@ -10790,14 +10811,23 @@ function CopyDialogvue_type_template_id_8772cafa_render(_ctx, _cache, $props, $s idToCopy: { type: [String, Number], required: true + }, + idSourceContainer: { + type: String, + required: false, + default: '' + }, + idContainerVersion: { + type: Number, + required: false, + default: 0 } }, directives: { Form: external_CorePluginsAdmin_["Form"] }, components: { - Field: external_CorePluginsAdmin_["Field"], - ContainerSelector: ContainerSelector + Field: external_CorePluginsAdmin_["Field"] }, data: function data() { return { @@ -10808,6 +10838,7 @@ function CopyDialogvue_type_template_id_8772cafa_render(_ctx, _cache, $props, $s }, created: function created() { this.onSiteChange(); + this.idDestinationContainer = this.idSourceContainer; }, watch: { site: function site() { @@ -10860,6 +10891,141 @@ function CopyDialogvue_type_template_id_8772cafa_render(_ctx, _cache, $props, $s }); }); }); + }, + performCopy: function performCopy() { + var _this$site2, + _this2 = this; + + var requestParams = { + module: 'TagManager', + action: '', + idSite: this.defaultSite.id, + idDestinationSite: (_this$site2 = this.site) !== null && _this$site2 !== void 0 && _this$site2.id ? this.site.id : 0, + nonce: this.copyNonce, + idDestinationContainer: '', + idSourceContainer: '', + idContainerVersion: 0, + idContainer: 0, + idTag: 0, + idTrigger: 0, + idVariable: 0 + }; + + switch (this.copyType.toLowerCase()) { + case 'container': + requestParams.action = 'copyContainer'; + requestParams.idContainer = this.idToCopy; + break; + + case 'tag': + requestParams.action = 'copyTag'; + requestParams.idTag = this.idToCopy; + break; + + case 'trigger': + requestParams.action = 'copyTrigger'; + requestParams.idTrigger = this.idToCopy; + break; + + case 'variable': + requestParams.action = 'copyVariable'; + requestParams.idVariable = this.idToCopy; + break; + + default: + throw Error('Unrecognised copy object type.'); + } + + if (this.idDestinationContainer) { + requestParams.idDestinationContainer = this.idDestinationContainer; + } + + if (this.idSourceContainer) { + requestParams.idSourceContainer = this.idSourceContainer; + } + + if (this.idContainerVersion > 0) { + requestParams.idContainerVersion = this.idContainerVersion; + } + + external_CoreHome_["AjaxHelper"].fetch(requestParams).then(function (response) { + // If there was an issue with the response, display a generic error + if (!response || !response.isSuccess || !response.urlToNewCopy) { + var message = Object(external_CoreHome_["translate"])('General_ErrorRequest', '', ''); + var notificationInstanceId = external_CoreHome_["NotificationsStore"].show({ + message: message, + id: 'CopyDialogResultNotification', + context: 'error', + type: 'transient' + }); + external_CoreHome_["NotificationsStore"].scrollToNotification(notificationInstanceId); + window.Piwik_Popover.close(); + return; + } // Close the modal, reload the store, and display notification + + + _this2.reloadEntityStore(); + + _this2.displaySuccessNotification(response.urlToNewCopy); + + window.Piwik_Popover.close(); + }); + }, + reloadEntityStore: function reloadEntityStore() { + switch (this.copyType.toLowerCase()) { + case 'container': + Containers_store.reload(); + break; + + case 'tag': + Tags_store.reload(this.idSourceContainer, this.idContainerVersion); + break; + + case 'trigger': + Triggers_store.fetchTriggers(this.idSourceContainer, this.idContainerVersion); + break; + + case 'variable': + Variables_store.fetchVariables(this.idSourceContainer, this.idContainerVersion); + break; + + default: + throw Error('Unrecognised copy object type.'); + } + }, + displaySuccessNotification: function displaySuccessNotification(urlToNewCopy) { + var mainTranslation = 'TagManager_CopyXSuccess'; + var typeTranslation = ''; + + switch (this.copyType.toLowerCase()) { + case 'container': + typeTranslation = 'TagManager_ContainerLowercase'; + break; + + case 'tag': + typeTranslation = 'TagManager_TagLowercase'; + break; + + case 'trigger': + typeTranslation = 'TagManager_TriggerLowercase'; + break; + + case 'variable': + typeTranslation = 'TagManager_VariableLowercase'; + break; + + default: + throw Error('Unrecognised copy object type.'); + } + + var message = Object(external_CoreHome_["translate"])(mainTranslation, [""), Object(external_CoreHome_["translate"])(typeTranslation), '']); + var notificationInstanceId = external_CoreHome_["NotificationsStore"].show({ + message: message, + id: 'CopyDialogResultNotification', + context: 'success', + type: 'transient' + }); + external_CoreHome_["NotificationsStore"].scrollToNotification(notificationInstanceId); } }, computed: { @@ -10919,45 +11085,60 @@ function CopyDialogvue_type_template_id_8772cafa_render(_ctx, _cache, $props, $s return Object(external_CoreHome_["translate"])('TagManager_CopyContainerNote', '', ''); }, getCopyUrl: function getCopyUrl() { - var _this$site2; + var _this$site3; - var actionName = ''; + var requestParams = { + module: 'TagManager', + action: '', + idSite: this.defaultSite.id, + idDestinationSite: (_this$site3 = this.site) !== null && _this$site3 !== void 0 && _this$site3.id ? this.site.id : 0, + nonce: this.copyNonce, + idDestinationContainer: '', + idSourceContainer: '', + idContainerVersion: 0, + idContainer: 0, + idTag: 0, + idTrigger: 0, + idVariable: 0 + }; switch (this.copyType.toLowerCase()) { case 'container': - actionName = 'copyContainer'; + requestParams.action = 'copyContainer'; + requestParams.idContainer = this.idToCopy; break; case 'tag': - actionName = 'copyTag'; + requestParams.action = 'copyTag'; + requestParams.idTag = this.idToCopy; break; case 'trigger': - actionName = 'copyTrigger'; + requestParams.action = 'copyTrigger'; + requestParams.idTrigger = this.idToCopy; break; case 'variable': - actionName = 'copyVariable'; + requestParams.action = 'copyVariable'; + requestParams.idVariable = this.idToCopy; break; default: throw Error('Unrecognised copy object type.'); } - var requestParams = { - module: 'TagManager', - action: actionName, - idSite: this.defaultSite.id, - idDestinationSite: (_this$site2 = this.site) === null || _this$site2 === void 0 ? void 0 : _this$site2.id, - idContainer: this.idToCopy, - nonce: this.copyNonce, - idDestinationContainer: '' - }; - if (this.idDestinationContainer) { requestParams.idDestinationContainer = this.idDestinationContainer; } + if (this.idSourceContainer) { + requestParams.idSourceContainer = this.idSourceContainer; + } + + if (this.idContainerVersion > 0) { + requestParams.idContainerVersion = this.idContainerVersion; + } + return "?".concat(external_CoreHome_["MatomoUrl"].stringify(requestParams)); } } @@ -10968,7 +11149,7 @@ function CopyDialogvue_type_template_id_8772cafa_render(_ctx, _cache, $props, $s -CopyDialogvue_type_script_lang_ts.render = CopyDialogvue_type_template_id_8772cafa_render +CopyDialogvue_type_script_lang_ts.render = CopyDialogvue_type_template_id_7e821988_render /* harmony default export */ var CopyDialog = (CopyDialogvue_type_script_lang_ts); // CONCATENATED MODULE: ./plugins/TagManager/vue/src/index.ts diff --git a/vue/dist/TagManager.umd.min.js b/vue/dist/TagManager.umd.min.js index 1e5384c41..a73c85394 100644 --- a/vue/dist/TagManager.umd.min.js +++ b/vue/dist/TagManager.umd.min.js @@ -1,34 +1,34 @@ -(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["TagManager"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["TagManager"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="plugins/TagManager/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},a5a2:function(e,t){e.exports=n},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"ImportVersion",(function(){return p})),n.d(t,"VariableSelect",(function(){return G})),n.d(t,"VariableSelectType",(function(){return ne})),n.d(t,"FieldTextareaVariable",(function(){return ue})),n.d(t,"FieldVariableTemplate",(function(){return Te})),n.d(t,"FieldVariableTypeTemplate",(function(){return Ne})),n.d(t,"VariableEdit",(function(){return Et})),n.d(t,"VariableList",(function(){return Tn})),n.d(t,"VariableManage",(function(){return Sn})),n.d(t,"TriggerEdit",(function(){return Ea})),n.d(t,"TriggerList",(function(){return mi})),n.d(t,"TriggerManage",(function(){return fi})),n.d(t,"TagEdit",(function(){return So})),n.d(t,"TagList",(function(){return Vl})),n.d(t,"TagManage",(function(){return wl})),n.d(t,"VersionEdit",(function(){return Hc})),n.d(t,"VersionList",(function(){return Bs})),n.d(t,"VersionManage",(function(){return Hs})),n.d(t,"ContainerEdit",(function(){return bd})),n.d(t,"ContainerList",(function(){return Yd})),n.d(t,"ContainerManage",(function(){return tu})),n.d(t,"ContainerDashboard",(function(){return Ku})),n.d(t,"ContainerSelector",(function(){return cg})),n.d(t,"ManageInstallTagCode",(function(){return Xg})),n.d(t,"TrackingCodeCommon",(function(){return Cm})),n.d(t,"TrackingCodePage",(function(){return Mm})),n.d(t,"TrackingSPAPage",(function(){return ab})),n.d(t,"Debugging",(function(){return yp})),n.d(t,"CopyDialog",(function(){return kp})),"undefined"!==typeof window){var a=window.document.currentScript,i=a&&a.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var r=n("8bbf"),o={class:"tagManagerImportVersion"},l={class:"ui-confirm",id:"confirmImportContainerVersion",ref:"confirmImportContainerVersion"},c=["value"],s=["value"];function d(e,t,n,a,i,d){var u=Object(r["resolveComponent"])("ActivityIndicator"),g=Object(r["resolveComponent"])("Field"),m=Object(r["resolveComponent"])("SaveButton"),b=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",o,[Object(r["createVNode"])(b,{"content-title":e.translate("TagManager_ImportVersion")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VersionImportInfo")),1),Object(r["createVNode"])(u,{loading:e.isUpdating,"loading-message":e.translate("TagManager_UpdatingData")},null,8,["loading","loading-message"]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(g,{uicontrol:"text",modelValue:e.backupName,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.backupName=t}),name:"backupName",placeholder:" ",title:e.backupNameTitle,"inline-help":e.translate("TagManager_BackupVersionNameHelp")},null,8,["modelValue","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(g,{uicontrol:"textarea",modelValue:e.importContent,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.importContent=t}),name:"importContent",placeholder:" ","full-width":!0,title:e.translate("TagManager_VersionImportContentTitle")},null,8,["modelValue","title"])]),Object(r["createVNode"])(m,{class:"importVersion",disabled:!e.importContent,onConfirm:t[2]||(t[2]=function(t){return e.importVersion(e.backupName,e.importContent)}),value:e.translate("TagManager_VersionImportOverwriteContent")},null,8,["disabled","value"])]})),_:1},8,["content-title"]),Object(r["createElementVNode"])("div",l,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfirmImportContainerVersion")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,c),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,s)],512)])}var u=n("19dc"),g=n("a5a2"),m="importContainerVersion",b=Object(r["defineComponent"])({props:{idContainer:{type:String,required:!0}},components:{ContentBlock:u["ContentBlock"],ActivityIndicator:u["ActivityIndicator"],Field:g["Field"],SaveButton:g["SaveButton"]},data:function(){return{isUpdating:!1,backupName:"",importContent:""}},methods:{showNotification:function(e,t){var n=u["NotificationsStore"].show({message:e,context:t,type:"transient",id:m});setTimeout((function(){u["NotificationsStore"].scrollToNotification(n)}),200)},importVersion:function(e,t){var n=this;if(t){var a;try{a=JSON.parse(t)}catch(i){return void this.showNotification(Object(u["translate"])("TagManager_ErrorInvalidContainerImportFormat"),"error")}"tags"in a&&"triggers"in a&&"variables"in a&&"idcontainer"in a&&"context"in a?u["Matomo"].helper.modalConfirm(this.$refs.confirmImportContainerVersion,{yes:function(){n.isUpdating=!0;var e={exportedContainerVersion:t};u["AjaxHelper"].post({method:"TagManager.importContainerVersion",idContainer:n.idContainer,backupName:n.backupName},e).then((function(){n.showNotification(Object(u["translate"])("TagManager_VersionImportSuccess"),"success"),n.isUpdating=!1,window.location.reload()})).catch((function(){n.isUpdating=!1}))}}):this.showNotification(Object(u["translate"])("TagManager_ErrorContainerVersionImportIncomplete"),"error")}}},computed:{backupNameTitle:function(){return"".concat(Object(u["translate"])("TagManager_BackupVersionName")," (").concat(Object(u["translate"])("General_Recommended"),")")}}});b.render=d;var p=b,h={class:"tagManagerManageSelect tagManagerVariableSelect"},f={class:"tableActionBar"},v=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),j={class:"collection with-header"},O={class:"collection-header"},T=["onClick"],y={class:"title"},V={class:"secondary-content"},C=["onClick","title"],N={class:"collection-header"},E=["onClick"],S={class:"title"},k={class:"secondary-content"},w=["title"],M={class:"tableActionBar"},_=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1);function D(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ActivityIndicator");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",h,[Object(r["createVNode"])(l,{loading:e.isLoading},null,8,["loading"]),Object(r["createElementVNode"])("div",f,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createNewVariable",onClick:t[0]||(t[0]=function(t){return e.createVariable()})},[v,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)],512),[[r["vShow"],!e.isLoading]])]),Object(r["createElementVNode"])("ul",j,[Object(r["createElementVNode"])("li",O,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(e.translate("TagManager_CustomVariables")),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.containerVariables,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",onClick:function(n){return e.selectVariable(t)},key:n},[Object(r["createElementVNode"])("span",y,Object(r["toDisplayString"])(t.name)+" ("+Object(r["toDisplayString"])(e.translate("TagManager_Type"))+": "+Object(r["toDisplayString"])(t.type)+") ",1),Object(r["createElementVNode"])("span",V,[Object(r["createElementVNode"])("i",{class:"icon-edit",onClick:Object(r["withModifiers"])((function(n){return e.editVariable(t)}),["stop"]),title:e.translate("General_Edit")},null,8,C)])],8,T)})),128))]),Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_PreconfiguredVariables")),1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.preconfiguredVariables,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:t.name},[Object(r["createElementVNode"])("li",N,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:n,onClick:function(n){return e.selectVariable(t)}},[Object(r["createElementVNode"])("span",S,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",k,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.description},null,8,w)],512),[[r["vShow"],!!t.description]])],8,E)),[[r["vShow"],t.is_pre_configured]])})),128))])})),128)),Object(r["createElementVNode"])("div",M,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createNewVariable",onClick:t[1]||(t[1]=function(t){return e.createVariable()})},[_,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable",e.translate("TagManager_Variable"))),1)],512),[[r["vShow"],!e.isLoading]])])])}function A(e){return U(e)||L(e)||B(e)||x()}function x(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function B(e,t){if(e){if("string"===typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(e,t):void 0}}function L(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function U(e){if(Array.isArray(e))return P(e)}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);n-1&&(this.variable.lookup_table.splice(e,1),this.isDirty=!0)},createVariableType:function(e){var t,n=this;e&&this.isVariableTemplateDisabled[e.id]||(this.chooseVariableType=!1,this.editTitle=Object(u["translate"])("TagManager_CreateNewVariable"),this.variable={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:ft.suggestNameForType(e.name)||"",description:"",type:e.id,idcontainer:this.idContainer,idcontainerversion:this.idContainerVersion,default_value:"",lookup_table:[],typeMetadata:e},null!==(t=this.variable.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.variable.typeMetadata.name)),this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.addLookUpEntry(),this.isDirty=!0,Object(r["nextTick"])((function(){if(n.$refs.root){var e=n.$refs.root;e.scrollIntoView();var t=e.querySelector("#name");t&&t.focus()}})))},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idVariable,u["MatomoUrl"].updateHash(e)},createVariable:function(){var e=this;this.removeAnyVariableNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVar=!0,ft.createOrUpdateVariable(Object.assign(Object.assign({},this.variable),{},{name:encodeURIComponent(this.variable.name)}),"TagManager.addContainerVariable",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t){e.isDirty=!1;var n=t.value;ft.reload(e.idContainer,e.idContainerVersion).then((function(){if(e.isEmbedded)return e.variable.idvariable=n,void e.$emit("changeVariable",{variable:e.variable});e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Variable")),n="";e.hasPublishCapability()&&(n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(t," ").concat(n),"success")}),200)}))}})).finally((function(){e.isUpdatingVar=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateVariable:function(){var e=this;this.removeAnyVariableNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVar=!0,ft.createOrUpdateVariable(Object.assign(Object.assign({},this.variable),{},{name:encodeURIComponent(this.variable.name)}),"TagManager.updateContainerVariable",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t)if(e.isEmbedded)e.$emit("changeVariable",{variable:e.variable});else{e.isDirty=!1,ft.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdVariable()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Variable")),a="";e.hasPublishCapability()&&(a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(n," ").concat(a),"success")}})).finally((function(){e.isUpdatingVar=!1})))},checkRequiredFieldsAreSet:function(){return!!this.variable.name||(this.showErrorFieldNotProvidedNotification(Object(u["translate"])("General_Name")),!1)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")}},computed:{typeInlineHelp:function(){var e,t,n=(null===(e=this.variable.typeMetadata)||void 0===e?void 0:e.description)||"",a=(null===(t=this.variable.typeMetadata)||void 0===t?void 0:t.help)||"";return"".concat(n," ").concat(a)},create:function(){return 0===this.idVariable},edit:function(){return!this.create},isLoading:function(){return ft.isLoading.value||Vt.isLoading.value},isUpdating:function(){return ft.isUpdating.value||this.isUpdatingVar},availableLookUpComparisons:function(){return Vt.comparisonOptions.value},isVariableTemplateDisabled:function(){var e=this,t={};return this.availableVariables.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},isVariableDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.variable.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},variableParameterValues:function(){var e;return null!==(e=this.variable.typeMetadata)&&void 0!==e&&e.parameters?this.parameterValues:null},variableLookupTable:function(){return this.variable.lookup_table}}});Nt.render=et;var Et=Nt,St={class:"tagManagerManageList tagManagerVariableList"},kt={class:"variableSearchFilter"},wt=["title"],Mt=["title"],_t=["title"],Dt=["title"],At=["title"],xt=["title"],Bt={colspan:"7"},Lt={class:"loadingPiwik"},Ut=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Pt={colspan:"7"},It=["id"],Ft=["title"],Ht=["title"],Gt=["title"],$t={class:"lookupTable"},Rt={class:"icon-ok"},qt=["title"],zt={class:"action"},Wt=["onClick","title"],Xt=["onClick","title"],Kt={class:"tableActionBar"},Jt=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Yt=["title"],Zt=Object(r["createElementVNode"])("span",{class:"icon-help preconfiguredVariablesHelp"},null,-1),Qt={class:"collection-header"},en={class:"title"},tn=["textContent"],nn={class:"secondary-content"},an=["title"],rn={class:"ui-confirm",id:"confirmDeleteVariable",ref:"confirmDeleteVariable"},on=["value"],ln=["value"],cn={class:"ui-confirm",id:"confirmDeleteVariableNotPossible",ref:"confirmDeleteVariableNotPossible"},sn={class:"collection"},dn=["value"];function un(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ContentBlock"),s=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",St,[Object(r["createVNode"])(c,{feature:"Tag Manager",class:"tagManagerCustomVariablesList","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Variables")),"help-text":e.variablesHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableUsageBenefits")),1),Object(r["createElementVNode"])("div",kt,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"variableSearch",title:e.translate("General_Search"),modelValue:e.variableSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.variableSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.variables.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,wt),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,Mt),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,_t),Object(r["createElementVNode"])("th",{class:"lookupTable",title:e.lookupTableTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LookupTable")),9,Dt),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,At),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,xt),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Bt,[Object(r["createElementVNode"])("span",Lt,[Ut,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Pt,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoVariablesFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerVariableNow",onClick:t[1]||(t[1]=function(t){return e.createVariable()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariableNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&!e.variables.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVariables,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"variable".concat(t.idvariable),class:"variables",key:t.idvariable},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Ft),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Ht),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,Gt),Object(r["createElementVNode"])("td",$t,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Rt,null,512),[[r["vShow"],t.lookup_table.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,qt),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",zt,[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editVariable(t.idvariable,t.type)},title:e.translate("TagManager_EditVariable")},null,8,Wt),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteVariable(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Variable"))},null,8,Xt)],512),[[r["vShow"],e.hasWriteAccess]])],8,It)})),128))])],512),[[s]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Kt,[Object(r["createElementVNode"])("a",{class:"createNewVariable",value:"",onClick:t[2]||(t[2]=function(t){return e.createVariable()})},[Jt,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("h2",{title:e.translate("TagManager_PreConfiguredInfoTitle")},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_PreconfiguredVariables"))+" ",1),Zt],8,Yt),Object(r["createElementVNode"])("div",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.containerVariables,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:t},[Object(r["createElementVNode"])("li",Qt,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(e.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.types,(function(e){return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:e.id},[Object(r["createElementVNode"])("span",en,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.name)+" ",1),Object(r["createElementVNode"])("span",{class:"variableId",textContent:Object(r["toDisplayString"])("{{".concat(e.id,"}}"))},null,8,tn)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",nn,[Object(r["createElementVNode"])("i",{class:"icon-help",title:e.description},null,8,an)],512),[[r["vShow"],!!e.description]])],512)),[[r["vShow"],e.is_pre_configured]])})),128))])})),128))]),Object(r["createElementVNode"])("div",rn,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteVariableConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,on),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ln)],512),Object(r["createElementVNode"])("div",cn,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableCannotBeDeleted")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableBeingUsedBy")),1),Object(r["createElementVNode"])("ul",sn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.variableReferences,(function(e){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:"".concat(e.referenceType,".").concat(e.referenceId)},Object(r["toDisplayString"])(e.referenceTypeName)+": "+Object(r["toDisplayString"])(e.referenceName),1)})),128))]),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableBeingUsedNeedsRemove")),1),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,dn)],512)])}function gn(e){return hn(e)||pn(e)||bn(e)||mn()}function mn(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bn(e,t){if(e){if("string"===typeof e)return fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(e,t):void 0}}function pn(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function hn(e){if(Array.isArray(e))return fn(e)}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.name?1:0})),t},nameTranslatedText:function(){return this.translate("TagManager_VariablesNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_VariablesDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_VariablesTypeDescription")},lookupTableTranslatedText:function(){return this.translate("TagManager_VariablesLookupTableDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_VariablesLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_VariablesActionDescription")}}});On.render=un;var Tn=On,yn={class:"manageVariable"},Vn={key:0},Cn={key:1};function Nn(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("VariableList"),c=Object(r["resolveComponent"])("VariableEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",yn,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Vn,[Object(r["createVNode"])(l,{"id-container-version":e.idContainerVersion,"id-container":e.idContainer,"variables-help-text":e.variablesHelpText},null,8,["id-container-version","id-container","variables-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Cn,[Object(r["createVNode"])(c,{"id-container-version":e.idContainerVersion,"id-container":e.idContainer,"id-variable":e.idVariable},null,8,["id-container-version","id-container","id-variable"])])):Object(r["createCommentVNode"])("",!0)])}var En=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,variablesHelpText:String},components:{VariableList:Tn,VariableEdit:Et},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idVariable}),(function(t){e.onIdVariableParamChange(t)})),u["NotificationsStore"].remove("variablevariablemanagement"),this.onIdVariableParamChange(u["MatomoUrl"].hashParsed.value.idVariable)},methods:{onIdVariableParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVariable",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idVariable:function(){var e=u["MatomoUrl"].hashParsed.value.idVariable;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idVariable}}});En.render=Nn;var Sn=En;function kn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wn={class:"editTrigger tagManagerManageEdit",ref:"root"},Mn={class:"loadingPiwik"},_n=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Dn={class:"loadingPiwik"},An=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),xn={class:"form-group row"},Bn={class:"col s12"},Ln={key:0},Un={class:"form-group row"},Pn={class:"col s12"},In={class:"form-group row multiple"},Fn={class:"col s12 input-field m6"},Hn={class:"col s12 input-field m6"},Gn={class:"form-help"},$n=["innerHTML"],Rn={class:"col s12 m12"},qn={class:"innerFormField"},zn={class:"innerFormField comparisonField"},Wn={class:"innerFormField"},Xn=["onClick","title"],Kn={class:"triggerConditionNode"},Jn={class:"entityCancel"},Yn={id:"confirmSelectTriggerType"},Zn={class:"collection-header"},Qn=["onClick","title"],ea=["src"],ta={class:"title"},na={class:"secondary-content"},aa=["title"],ia={class:"entityCancel"};function ra(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("GroupedSettings"),s=Object(r["resolveComponent"])("SaveButton"),d=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",wn,[Object(r["createVNode"])(d,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n,a,i,o,d;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Mn,[_n,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Dn,[An,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("form",{onSubmit:t[5]||(t[5]=function(t){return e.edit?e.updateTrigger():e.createTrigger()})},[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTriggerDisabled]]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.trigger.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.trigger.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_TriggerNameHelp"),placeholder:e.translate("TagManager_TriggerNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.trigger.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.trigger.description=t,e.setValueHasChanged()}),maxlength:1e3,title:e.translate("TagManager_Description"),"inline-help":e.translate("TagManager_TriggerDescriptionHelp"),placeholder:e.translate("TagManager_TriggerDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",xn,[Object(r["createElementVNode"])("div",Bn,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureThisTrigger")),1)])],512),[[r["vShow"],null===(n=e.trigger.typeMetadata)||void 0===n||null===(a=n.parameters)||void 0===a?void 0:a.length]]),e.trigger?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ln,[Object(r["createVNode"])(c,{settings:(null===(i=e.trigger.typeMetadata)||void 0===i?void 0:i.parameters)||[],"all-setting-values":e.parameterValues,onChange:t[2]||(t[2]=function(t){return e.parameterValues[t.name]=t.value})},null,8,["settings","all-setting-values"])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Un,[Object(r["createElementVNode"])("div",Pn,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_OnlyTriggerWhen"))+" "+Object(r["toDisplayString"])(e.translate("Goals_Optional")),1)])],512),[[r["vShow"],null===(o=e.trigger.typeMetadata)||void 0===o?void 0:o.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",In,[Object(r["createElementVNode"])("div",Fn,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerConditionsHelp")),1)]),Object(r["createElementVNode"])("div",Hn,[Object(r["createElementVNode"])("div",Gn,[Object(r["createElementVNode"])("span",{class:"inline-help",innerHTML:e.$sanitize(e.triggerInlineHelpText)},null,8,$n)])]),Object(r["createElementVNode"])("div",Rn,[Object(r["createElementVNode"])("div",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.trigger.conditions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n,class:Object(r["normalizeClass"])(["condition multiple valign-wrapper","condition".concat(n)])},[Object(r["createElementVNode"])("div",qn,[Object(r["createVNode"])(l,{uicontrol:"expandable-select",name:"condition_actual","model-value":t.actual,"onUpdate:modelValue":function(n){t.actual=n,e.setValueHasChanged()},"full-width":!0,options:e.availableVariables,title:e.variableIdToName[t.actual]||t.actual},null,8,["model-value","onUpdate:modelValue","options","title"])]),Object(r["createElementVNode"])("div",zn,[Object(r["createVNode"])(l,{uicontrol:"select",name:"condition_comparison","model-value":t.comparison,"onUpdate:modelValue":function(n){t.comparison=n,e.setValueHasChanged()},"full-width":!0,options:e.availableComparisons},null,8,["model-value","onUpdate:modelValue","options"])]),Object(r["createElementVNode"])("div",Wn,[Object(r["createVNode"])(l,{uicontrol:"text",name:"condition_expected","model-value":t.expected,"onUpdate:modelValue":function(n){t.expected=n,e.setValueHasChanged(),e.onConditionChange()},"full-width":!0},null,8,["model-value","onUpdate:modelValue"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-minus valign",onClick:function(t){return e.removeConditionEntry(n)},title:e.translate("General_Remove")},null,8,Xn),[[r["vShow"],!(n+1===e.trigger.conditions.length)]])],2)})),128))]),Object(r["createElementVNode"])("p",Kn,Object(r["toDisplayString"])(e.translate("TagManager_TriggerConditionNode")),1)])])],512),[[r["vShow"],null===(d=e.trigger.typeMetadata)||void 0===d?void 0:d.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTriggerDisabled]]),Object(r["withDirectives"])(Object(r["createVNode"])(s,{class:"createButton",onConfirm:t[3]||(t[3]=function(t){return e.edit?e.updateTrigger():e.createTrigger()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),[[r["vShow"],!e.isTriggerDisabled]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Jn,[Object(r["createElementVNode"])("a",{onClick:t[4]||(t[4]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])])],544),[[r["vShow"],!e.chooseTriggerType&&e.editTitle]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Yn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.availableTriggers,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:n},[Object(r["createElementVNode"])("li",Zn,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:Object(r["normalizeClass"])(["collection-item avatar",kn({disabledTemplate:e.isTriggerTemplateDisabled[t.id]},"templateType".concat(t.id),!0)]),onClick:function(n){return e.createTriggerType(t)},key:n,title:e.isTriggerTemplateDisabled[t.id]?e.collectionItemAvatarText:""},[t.icon?(Object(r["openBlock"])(),Object(r["createElementBlock"])("img",{key:0,alt:"",class:"circle",src:t.icon},null,8,ea)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("span",ta,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(t.description),513),[[r["vShow"],t.description]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",na,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.help},null,8,aa)],512),[[r["vShow"],!!t.help]])],10,Qn)})),128))])})),128)),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",ia,[Object(r["createElementVNode"])("a",{onClick:t[6]||(t[6]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])],512),[[r["vShow"],e.chooseTriggerType]])]})),_:1},8,["content-title"])],512)}function oa(e,t){return sa(e)||ca(e,t)||ma(e,t)||la()}function la(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ca(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,r=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done);o=!0)if(r.push(a.value),t&&r.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return r}}function sa(e){if(Array.isArray(e))return e}function da(e){return da="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},da(e)}function ua(e){return pa(e)||ba(e)||ma(e)||ga()}function ga(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ma(e,t){if(e){if("string"===typeof e)return ha(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ha(e,t):void 0}}function ba(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function pa(e){if(Array.isArray(e))return ha(e)}function ha(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n-1&&(this.variable.lookup_table.splice(e,1),this.isDirty=!0)},createVariableType:function(e){var t,n=this;e&&this.isVariableTemplateDisabled[e.id]||(this.chooseVariableType=!1,this.editTitle=Object(u["translate"])("TagManager_CreateNewVariable"),this.variable={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:ft.suggestNameForType(e.name)||"",description:"",type:e.id,idcontainer:this.idContainer,idcontainerversion:this.idContainerVersion,default_value:"",lookup_table:[],typeMetadata:e},null!==(t=this.variable.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.variable.typeMetadata.name)),this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.addLookUpEntry(),this.isDirty=!0,Object(r["nextTick"])((function(){if(n.$refs.root){var e=n.$refs.root;e.scrollIntoView();var t=e.querySelector("#name");t&&t.focus()}})))},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idVariable,u["MatomoUrl"].updateHash(e)},createVariable:function(){var e=this;this.removeAnyVariableNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVar=!0,ft.createOrUpdateVariable(Object.assign(Object.assign({},this.variable),{},{name:encodeURIComponent(this.variable.name)}),"TagManager.addContainerVariable",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t){e.isDirty=!1;var n=t.value;ft.reload(e.idContainer,e.idContainerVersion).then((function(){if(e.isEmbedded)return e.variable.idvariable=n,void e.$emit("changeVariable",{variable:e.variable});e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Variable")),n="";e.hasPublishCapability()&&(n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(t," ").concat(n),"success")}),200)}))}})).finally((function(){e.isUpdatingVar=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateVariable:function(){var e=this;this.removeAnyVariableNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVar=!0,ft.createOrUpdateVariable(Object.assign(Object.assign({},this.variable),{},{name:encodeURIComponent(this.variable.name)}),"TagManager.updateContainerVariable",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t)if(e.isEmbedded)e.$emit("changeVariable",{variable:e.variable});else{e.isDirty=!1,ft.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdVariable()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Variable")),a="";e.hasPublishCapability()&&(a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(n," ").concat(a),"success")}})).finally((function(){e.isUpdatingVar=!1})))},checkRequiredFieldsAreSet:function(){return!!this.variable.name||(this.showErrorFieldNotProvidedNotification(Object(u["translate"])("General_Name")),!1)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")}},computed:{typeInlineHelp:function(){var e,t,n=(null===(e=this.variable.typeMetadata)||void 0===e?void 0:e.description)||"",a=(null===(t=this.variable.typeMetadata)||void 0===t?void 0:t.help)||"";return"".concat(n," ").concat(a)},create:function(){return 0===this.idVariable},edit:function(){return!this.create},isLoading:function(){return ft.isLoading.value||Vt.isLoading.value},isUpdating:function(){return ft.isUpdating.value||this.isUpdatingVar},availableLookUpComparisons:function(){return Vt.comparisonOptions.value},isVariableTemplateDisabled:function(){var e=this,t={};return this.availableVariables.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},isVariableDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.variable.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},variableParameterValues:function(){var e;return null!==(e=this.variable.typeMetadata)&&void 0!==e&&e.parameters?this.parameterValues:null},variableLookupTable:function(){return this.variable.lookup_table}}});Nt.render=et;var Et=Nt,St={class:"tagManagerManageList tagManagerVariableList"},wt={class:"variableSearchFilter"},kt=["title"],Mt=["title"],_t=["title"],Dt=["title"],At=["title"],xt=["title"],Bt={colspan:"7"},Lt={class:"loadingPiwik"},Ut=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Pt={colspan:"7"},It=["id"],Ft=["title"],Ht=["title"],Gt=["title"],$t={class:"lookupTable"},Rt={class:"icon-ok"},qt=["title"],zt={class:"action"},Wt=["onClick","title"],Xt=["onClick","title"],Kt={class:"tableActionBar"},Jt=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Yt=["title"],Zt=Object(r["createElementVNode"])("span",{class:"icon-help preconfiguredVariablesHelp"},null,-1),Qt={class:"collection-header"},en={class:"title"},tn=["textContent"],nn={class:"secondary-content"},an=["title"],rn={class:"ui-confirm",id:"confirmDeleteVariable",ref:"confirmDeleteVariable"},on=["value"],ln=["value"],cn={class:"ui-confirm",id:"confirmDeleteVariableNotPossible",ref:"confirmDeleteVariableNotPossible"},sn={class:"collection"},dn=["value"];function un(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ContentBlock"),s=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",St,[Object(r["createVNode"])(c,{feature:"Tag Manager",class:"tagManagerCustomVariablesList","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Variables")),"help-text":e.variablesHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableUsageBenefits")),1),Object(r["createElementVNode"])("div",wt,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"variableSearch",title:e.translate("General_Search"),modelValue:e.variableSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.variableSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.variables.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,kt),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,Mt),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,_t),Object(r["createElementVNode"])("th",{class:"lookupTable",title:e.lookupTableTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LookupTable")),9,Dt),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,At),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,xt),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Bt,[Object(r["createElementVNode"])("span",Lt,[Ut,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Pt,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoVariablesFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerVariableNow",onClick:t[1]||(t[1]=function(t){return e.createVariable()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariableNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&!e.variables.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVariables,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"variable".concat(t.idvariable),class:"variables",key:t.idvariable},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Ft),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Ht),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,Gt),Object(r["createElementVNode"])("td",$t,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Rt,null,512),[[r["vShow"],t.lookup_table.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,qt),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",zt,[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editVariable(t.idvariable,t.type)},title:e.translate("TagManager_EditVariable")},null,8,Wt),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteVariable(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Variable"))},null,8,Xt)],512),[[r["vShow"],e.hasWriteAccess]])],8,It)})),128))])],512),[[s]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Kt,[Object(r["createElementVNode"])("a",{class:"createNewVariable",value:"",onClick:t[2]||(t[2]=function(t){return e.createVariable()})},[Jt,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("h2",{title:e.translate("TagManager_PreConfiguredInfoTitle")},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_PreconfiguredVariables"))+" ",1),Zt],8,Yt),Object(r["createElementVNode"])("div",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.containerVariables,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:t},[Object(r["createElementVNode"])("li",Qt,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(e.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.types,(function(e){return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:e.id},[Object(r["createElementVNode"])("span",en,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.name)+" ",1),Object(r["createElementVNode"])("span",{class:"variableId",textContent:Object(r["toDisplayString"])("{{".concat(e.id,"}}"))},null,8,tn)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",nn,[Object(r["createElementVNode"])("i",{class:"icon-help",title:e.description},null,8,an)],512),[[r["vShow"],!!e.description]])],512)),[[r["vShow"],e.is_pre_configured]])})),128))])})),128))]),Object(r["createElementVNode"])("div",rn,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteVariableConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,on),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ln)],512),Object(r["createElementVNode"])("div",cn,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableCannotBeDeleted")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableBeingUsedBy")),1),Object(r["createElementVNode"])("ul",sn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.variableReferences,(function(e){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:"".concat(e.referenceType,".").concat(e.referenceId)},Object(r["toDisplayString"])(e.referenceTypeName)+": "+Object(r["toDisplayString"])(e.referenceName),1)})),128))]),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VariableBeingUsedNeedsRemove")),1),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,dn)],512)])}function gn(e){return hn(e)||pn(e)||mn(e)||bn()}function bn(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function mn(e,t){if(e){if("string"===typeof e)return fn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fn(e,t):void 0}}function pn(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function hn(e){if(Array.isArray(e))return fn(e)}function fn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.name?1:0})),t},nameTranslatedText:function(){return this.translate("TagManager_VariablesNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_VariablesDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_VariablesTypeDescription")},lookupTableTranslatedText:function(){return this.translate("TagManager_VariablesLookupTableDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_VariablesLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_VariablesActionDescription")}}});On.render=un;var Tn=On,yn={class:"manageVariable"},Vn={key:0},Cn={key:1};function Nn(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("VariableList"),c=Object(r["resolveComponent"])("VariableEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",yn,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Vn,[Object(r["createVNode"])(l,{"id-container-version":e.idContainerVersion,"id-container":e.idContainer,"variables-help-text":e.variablesHelpText},null,8,["id-container-version","id-container","variables-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Cn,[Object(r["createVNode"])(c,{"id-container-version":e.idContainerVersion,"id-container":e.idContainer,"id-variable":e.idVariable},null,8,["id-container-version","id-container","id-variable"])])):Object(r["createCommentVNode"])("",!0)])}var En=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,variablesHelpText:String},components:{VariableList:Tn,VariableEdit:Et},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idVariable}),(function(t){e.onIdVariableParamChange(t)})),u["NotificationsStore"].remove("variablevariablemanagement"),this.onIdVariableParamChange(u["MatomoUrl"].hashParsed.value.idVariable)},methods:{onIdVariableParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVariable",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idVariable:function(){var e=u["MatomoUrl"].hashParsed.value.idVariable;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idVariable}}});En.render=Nn;var Sn=En;function wn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kn={class:"editTrigger tagManagerManageEdit",ref:"root"},Mn={class:"loadingPiwik"},_n=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Dn={class:"loadingPiwik"},An=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),xn={class:"form-group row"},Bn={class:"col s12"},Ln={key:0},Un={class:"form-group row"},Pn={class:"col s12"},In={class:"form-group row multiple"},Fn={class:"col s12 input-field m6"},Hn={class:"col s12 input-field m6"},Gn={class:"form-help"},$n=["innerHTML"],Rn={class:"col s12 m12"},qn={class:"innerFormField"},zn={class:"innerFormField comparisonField"},Wn={class:"innerFormField"},Xn=["onClick","title"],Kn={class:"triggerConditionNode"},Jn={class:"entityCancel"},Yn={id:"confirmSelectTriggerType"},Zn={class:"collection-header"},Qn=["onClick","title"],ea=["src"],ta={class:"title"},na={class:"secondary-content"},aa=["title"],ia={class:"entityCancel"};function ra(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("GroupedSettings"),s=Object(r["resolveComponent"])("SaveButton"),d=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",kn,[Object(r["createVNode"])(d,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n,a,i,o,d;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Mn,[_n,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Dn,[An,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("form",{onSubmit:t[5]||(t[5]=function(t){return e.edit?e.updateTrigger():e.createTrigger()})},[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTriggerDisabled]]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.trigger.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.trigger.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_TriggerNameHelp"),placeholder:e.translate("TagManager_TriggerNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.trigger.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.trigger.description=t,e.setValueHasChanged()}),maxlength:1e3,title:e.translate("TagManager_Description"),"inline-help":e.translate("TagManager_TriggerDescriptionHelp"),placeholder:e.translate("TagManager_TriggerDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",xn,[Object(r["createElementVNode"])("div",Bn,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureThisTrigger")),1)])],512),[[r["vShow"],null===(n=e.trigger.typeMetadata)||void 0===n||null===(a=n.parameters)||void 0===a?void 0:a.length]]),e.trigger?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ln,[Object(r["createVNode"])(c,{settings:(null===(i=e.trigger.typeMetadata)||void 0===i?void 0:i.parameters)||[],"all-setting-values":e.parameterValues,onChange:t[2]||(t[2]=function(t){return e.parameterValues[t.name]=t.value})},null,8,["settings","all-setting-values"])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Un,[Object(r["createElementVNode"])("div",Pn,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_OnlyTriggerWhen"))+" "+Object(r["toDisplayString"])(e.translate("Goals_Optional")),1)])],512),[[r["vShow"],null===(o=e.trigger.typeMetadata)||void 0===o?void 0:o.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",In,[Object(r["createElementVNode"])("div",Fn,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerConditionsHelp")),1)]),Object(r["createElementVNode"])("div",Hn,[Object(r["createElementVNode"])("div",Gn,[Object(r["createElementVNode"])("span",{class:"inline-help",innerHTML:e.$sanitize(e.triggerInlineHelpText)},null,8,$n)])]),Object(r["createElementVNode"])("div",Rn,[Object(r["createElementVNode"])("div",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.trigger.conditions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n,class:Object(r["normalizeClass"])(["condition multiple valign-wrapper","condition".concat(n)])},[Object(r["createElementVNode"])("div",qn,[Object(r["createVNode"])(l,{uicontrol:"expandable-select",name:"condition_actual","model-value":t.actual,"onUpdate:modelValue":function(n){t.actual=n,e.setValueHasChanged()},"full-width":!0,options:e.availableVariables,title:e.variableIdToName[t.actual]||t.actual},null,8,["model-value","onUpdate:modelValue","options","title"])]),Object(r["createElementVNode"])("div",zn,[Object(r["createVNode"])(l,{uicontrol:"select",name:"condition_comparison","model-value":t.comparison,"onUpdate:modelValue":function(n){t.comparison=n,e.setValueHasChanged()},"full-width":!0,options:e.availableComparisons},null,8,["model-value","onUpdate:modelValue","options"])]),Object(r["createElementVNode"])("div",Wn,[Object(r["createVNode"])(l,{uicontrol:"text",name:"condition_expected","model-value":t.expected,"onUpdate:modelValue":function(n){t.expected=n,e.setValueHasChanged(),e.onConditionChange()},"full-width":!0},null,8,["model-value","onUpdate:modelValue"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-minus valign",onClick:function(t){return e.removeConditionEntry(n)},title:e.translate("General_Remove")},null,8,Xn),[[r["vShow"],!(n+1===e.trigger.conditions.length)]])],2)})),128))]),Object(r["createElementVNode"])("p",Kn,Object(r["toDisplayString"])(e.translate("TagManager_TriggerConditionNode")),1)])])],512),[[r["vShow"],null===(d=e.trigger.typeMetadata)||void 0===d?void 0:d.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTriggerDisabled]]),Object(r["withDirectives"])(Object(r["createVNode"])(s,{class:"createButton",onConfirm:t[3]||(t[3]=function(t){return e.edit?e.updateTrigger():e.createTrigger()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),[[r["vShow"],!e.isTriggerDisabled]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Jn,[Object(r["createElementVNode"])("a",{onClick:t[4]||(t[4]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])])],544),[[r["vShow"],!e.chooseTriggerType&&e.editTitle]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Yn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.availableTriggers,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:n},[Object(r["createElementVNode"])("li",Zn,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:Object(r["normalizeClass"])(["collection-item avatar",wn({disabledTemplate:e.isTriggerTemplateDisabled[t.id]},"templateType".concat(t.id),!0)]),onClick:function(n){return e.createTriggerType(t)},key:n,title:e.isTriggerTemplateDisabled[t.id]?e.collectionItemAvatarText:""},[t.icon?(Object(r["openBlock"])(),Object(r["createElementBlock"])("img",{key:0,alt:"",class:"circle",src:t.icon},null,8,ea)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("span",ta,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(t.description),513),[[r["vShow"],t.description]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",na,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.help},null,8,aa)],512),[[r["vShow"],!!t.help]])],10,Qn)})),128))])})),128)),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",ia,[Object(r["createElementVNode"])("a",{onClick:t[6]||(t[6]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])],512),[[r["vShow"],e.chooseTriggerType]])]})),_:1},8,["content-title"])],512)}function oa(e,t){return sa(e)||ca(e,t)||ba(e,t)||la()}function la(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ca(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,r=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(a=n.next()).done);o=!0)if(r.push(a.value),t&&r.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return r}}function sa(e){if(Array.isArray(e))return e}function da(e){return da="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},da(e)}function ua(e){return pa(e)||ma(e)||ba(e)||ga()}function ga(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ba(e,t){if(e){if("string"===typeof e)return ha(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ha(e,t):void 0}}function ma(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function pa(e){if(Array.isArray(e))return ha(e)}function ha(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n-1){var t=this.trigger.conditions.length-1;t===e?this.trigger.conditions[e]=this.makeDefaultCondition():this.trigger.conditions.splice(e,1),this.isDirty=!0}},createTriggerType:function(e){var t,n=this;e&&this.isTriggerTemplateDisabled[e.id]||(this.chooseTriggerType=!1,this.editTitle=Object(u["translate"])("TagManager_CreateNewTrigger"),this.trigger={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:ya.suggestNameForType(e.name)||"",description:"",type:e.id,idcontainerversion:this.idContainerVersion,conditions:[],typeMetadata:e},null!==(t=this.trigger.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.trigger.typeMetadata.name)),this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.addConditionEntry(),this.isDirty=!0,Object(r["nextTick"])((function(){if(n.$refs.root){var e=n.$refs.root;e.scrollIntoView();var t=e.querySelector("#name");t&&t.focus()}})))},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idTrigger,u["MatomoUrl"].updateHash(e)},createTrigger:function(){var e=this;this.removeAnyTriggerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTrigger=!0,ya.createOrUpdateTrigger(this.trigger,"TagManager.addContainerTrigger",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){var n=t.value;e.isDirty=!1,ya.reload(e.idContainer,e.idContainerVersion).then((function(){if(e.isEmbedded)return e.trigger.idtrigger=n,void e.$emit("changeTrigger",{trigger:e.trigger});e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Trigger")),n="";e.hasPublishCapability()&&(n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(t," ").concat(n),"success")}),200)}))})).finally((function(){e.isUpdatingTrigger=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateTrigger:function(){var e=this;this.removeAnyTriggerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTrigger=!0,ya.createOrUpdateTrigger(this.trigger,"TagManager.updateContainerTrigger",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t){if(e.isEmbedded)return e.$emit("changeTrigger",{trigger:e.trigger}),void ya.reload(e.idContainer,e.idContainerVersion);e.isDirty=!1,ya.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdTrigger()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Trigger")),a="";e.hasPublishCapability()&&(a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(n," ").concat(a),"success")}})).finally((function(){e.isUpdatingTrigger=!1})))},makeDefaultCondition:function(){var e,t="PageUrl";if(null!==(e=this.trigger)&&void 0!==e&&e.typeMetadata){var n=this.trigger.typeMetadata.id;Ca[n]&&(t=Ca[n])}return{comparison:"equals",actual:t,expected:""}},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")}},computed:{isLoading:function(){return ya.isLoading.value||Vt.isLoading.value},isUpdating:function(){return ya.isUpdating.value||this.isUpdatingTrigger},create:function(){return 0===this.idTrigger},edit:function(){return!this.create},canUseCustomTemplates:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},isTriggerDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.trigger.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},saveButtonText:function(){return this.edit?Object(u["translate"])("CoreUpdater_UpdateTitle"):Object(u["translate"])("TagManager_CreateNewTrigger")},collectionItemAvatarText:function(){return Object(u["translate"])("TagManager_UseCustomTemplateCapabilityRequired",Object(u["translate"])("TagManager_CapabilityUseCustomTemplates"))},triggerInlineHelpText:function(){return Object(u["translate"])("TagManager_TriggerConditionsHelpText",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/create-a-trigger-to-track-interactions-on-all-nested-elements/"),"")},availableComparisons:function(){return Vt.comparisonOptions.value},isTriggerTemplateDisabled:function(){var e=this,t={};return this.availableTriggers.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},triggerParameterValues:function(){var e;return null!==(e=this.trigger.typeMetadata)&&void 0!==e&&e.parameters?this.parameterValues:null}}});Na.render=ra;var Ea=Na,Sa={class:"tagManagerManageList tagManagerTriggerList"},ka={class:"triggerSearchFilter"},wa=["title"],Ma=["title"],_a=["title"],Da=["title"],Aa=["title"],xa=["title"],Ba={colspan:"7"},La={class:"loadingPiwik"},Ua=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Pa={colspan:"7"},Ia=["id"],Fa=["title"],Ha=["title"],Ga=["title"],$a={class:"conditions"},Ra={class:"icon-ok"},qa=["title"],za={class:"action"},Wa=["onClick","title"],Xa=["onClick","title"],Ka={class:"tableActionBar"},Ja=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Ya={class:"ui-confirm",id:"confirmDeleteTrigger",ref:"confirmDeleteTrigger"},Za=["value"],Qa=["value"],ei={class:"ui-confirm",id:"confirmDeleteTriggerNotPossible",ref:"confirmDeleteTriggerNotPossible"},ti={class:"collection"},ni=["value"];function ai(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ContentBlock"),s=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Sa,[Object(r["createVNode"])(c,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Triggers")),"help-text":e.triggersHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerUsageBenefits")),1),Object(r["createElementVNode"])("div",ka,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"triggerSearch",title:e.translate("General_Search"),modelValue:e.triggerSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.triggerSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.triggers.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,wa),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,Ma),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,_a),Object(r["createElementVNode"])("th",{class:"conditions",title:e.filterTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Filter")),9,Da),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,Aa),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,xa),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Ba,[Object(r["createElementVNode"])("span",La,[Ua,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Pa,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoTriggersFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerTriggerNow",onClick:t[1]||(t[1]=function(t){return e.createTrigger()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTriggerNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&0===e.triggers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTriggers,(function(t){var n;return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"trigger".concat(t.idtrigger),class:"triggers",key:t.idtrigger},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Fa),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Ha),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,Ga),Object(r["createElementVNode"])("td",$a,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Ra,null,512),[[r["vShow"],null===(n=t.conditions)||void 0===n?void 0:n.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,qa),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",za,[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editTrigger(t.idtrigger,t.type)},title:e.translate("TagManager_EditTrigger")},null,8,Wa),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteTrigger(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Trigger"))},null,8,Xa)],512),[[r["vShow"],e.hasWriteAccess]])],8,Ia)})),128))])],512),[[s]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Ka,[Object(r["createElementVNode"])("a",{class:"createNewTrigger",value:"",onClick:t[2]||(t[2]=function(t){return e.createTrigger()})},[Ja,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTrigger")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",Ya,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteTriggerConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Za),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Qa)],512),Object(r["createElementVNode"])("div",ei,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerCannotBeDeleted")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerBeingUsedBy")),1),Object(r["createElementVNode"])("ul",ti,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.triggerReferences,(function(e){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:e.referenceId},Object(r["toDisplayString"])(e.referenceTypeName)+": "+Object(r["toDisplayString"])(e.referenceName),1)})),128))]),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerBeingUsedNeedsRemove")),1),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,ni)],512)])}function ii(e){return ci(e)||li(e)||oi(e)||ri()}function ri(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oi(e,t){if(e){if("string"===typeof e)return si(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?si(e,t):void 0}}function li(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function ci(e){if(Array.isArray(e))return si(e)}function si(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.name?1:0})),t},nameTranslatedText:function(){return this.translate("TagManager_TriggersNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_TriggersDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_TriggersTypeDescription")},filterTranslatedText:function(){return this.translate("TagManager_TriggersFilterDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_TriggersLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_TriggersActionDescription")}}});gi.render=ai;var mi=gi,bi={class:"manageTrigger"};function pi(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TriggerList"),c=Object(r["resolveComponent"])("TriggerEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",bi,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"triggers-help-text":e.triggersHelpText},null,8,["id-container","id-container-version","triggers-help-text"])])],512),[[r["vShow"],!e.editMode]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"id-trigger":e.idTrigger},null,8,["id-container","id-container-version","id-trigger"])])],512),[[r["vShow"],e.editMode]])])}var hi=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,triggersHelpText:String},components:{TriggerList:mi,TriggerEdit:Ea},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idTrigger}),(function(t){e.onIdTriggerParamChange(t)})),u["NotificationsStore"].remove("triggertriggermanagement"),this.onIdTriggerParamChange(u["MatomoUrl"].hashParsed.value.idTrigger)},methods:{onIdTriggerParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddTrigger",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idTrigger:function(){var e=u["MatomoUrl"].hashParsed.value.idTrigger;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idTrigger}}});hi.render=pi;var fi=hi;function vi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ji={class:"editTag tagManagerManageEdit",ref:"root"},Oi={class:"loadingPiwik"},Ti=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),yi={class:"loadingPiwik"},Vi=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ci={class:"form-group row"},Ni={class:"col s12"},Ei={key:0},Si={class:"form-group row"},ki={class:"col s12"},wi={class:"form-group row"},Mi={class:"col s12"},_i={class:"form-group row tagStartDate"},Di={class:"col s12 m6"},Ai={class:"row"},xi={class:"col s12"},Bi={for:"start_date_date",class:"active"},Li={class:"tagStartDate"},Ui={class:"col s12 m6 "},Pi={class:"form-help"},Ii={class:"inline-help"},Fi=["innerHTML"],Hi=Object(r["createElementVNode"])("br",null,null,-1),Gi=["innerHTML"],$i={class:"form-group row tagEndDate"},Ri={class:"col s12 m6"},qi={class:"row"},zi={class:"col s12"},Wi={for:"end_date_date",class:"active"},Xi={class:"tagEndDate"},Ki={class:"col s12 m6"},Ji={class:"form-help"},Yi={class:"inline-help"},Zi=["innerHTML"],Qi=Object(r["createElementVNode"])("br",null,null,-1),er=["innerHTML"],tr={class:"entityCancel"},nr={id:"confirmSelectTagType"},ar={class:"collection-header"},ir=["onClick","title"],rr=["src"],or={class:"title"},lr={class:"secondary-content"},cr=["title"],sr={class:"entityCancel"};function dr(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("GroupedSettings"),s=Object(r["resolveComponent"])("TagTriggerArray"),d=Object(r["resolveComponent"])("TagDateInput"),u=Object(r["resolveComponent"])("SaveButton"),g=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ji,[Object(r["createVNode"])(g,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n,a,i,o,g;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Oi,[Ti,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",yi,[Vi,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("form",{onSubmit:t[18]||(t[18]=function(t){return e.edit?e.updateTag():e.createTag()})},[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTagDisabled]]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.tag.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.tag.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_TagNameHelpV2"),placeholder:e.translate("TagManager_TagNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.tag.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.tag.description=t,e.setValueHasChanged()}),maxlength:1e3,title:e.translate("TagManager_Description"),placeholder:e.translate("TagManager_TagDescriptionPlaceholder")},null,8,["model-value","title","placeholder"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Ci,[Object(r["createElementVNode"])("div",Ni,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureWhatTagDoes")),1)])],512),[[r["vShow"],null===(n=e.tag.typeMetadata)||void 0===n?void 0:n.parameters.length]]),e.tag?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ei,[Object(r["createVNode"])(c,{settings:(null===(a=e.tag.typeMetadata)||void 0===a?void 0:a.parameters)||[],"all-setting-values":e.parameterValues,onChange:t[2]||(t[2]=function(t){e.parameterValues[t.name]=t.value,e.setValueHasChanged()})},null,8,["settings","all-setting-values"])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Si,[Object(r["createElementVNode"])("div",ki,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureWhenTagDoes")),1)])],512),[[r["vShow"],null===(i=e.tag.typeMetadata)||void 0===i?void 0:i.parameters.length]]),Object(r["createVNode"])(s,{"container-triggers":e.containerTriggers,type:"fire",title:e.translate("TagManager_FireTriggerTitle"),help:e.translate("TagManager_FireTriggerHelp",e.translate("TagManager_FireLimit")),"model-value":e.fireTriggers,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.fireTriggers=t,e.setValueHasChanged(),e.onFireTriggerChange()}),onCreate:t[4]||(t[4]=function(t){return e.onCreateNewFireTrigger()}),onEdit:t[5]||(t[5]=function(t){return e.editTrigger(t)})},null,8,["container-triggers","title","help","model-value"]),Object(r["createVNode"])(s,{"container-triggers":e.containerTriggers,type:"block",title:e.translate("TagManager_BlockTriggerTitle"),help:e.translate("TagManager_BlockTriggerHelp"),"model-value":e.blockTriggers,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.blockTriggers=t,e.setValueHasChanged(),e.onBlockTriggerChange()}),onCreate:t[7]||(t[7]=function(t){return e.onCreateNewBlockTrigger()}),onEdit:t[8]||(t[8]=function(t){return e.editTrigger(t)})},null,8,["container-triggers","title","help","model-value"]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",wi,[Object(r["createElementVNode"])("div",Mi,[Object(r["createElementVNode"])("h3",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{href:"",class:"showAdvancedSettings",onClick:t[9]||(t[9]=Object(r["withModifiers"])((function(t){return e.showAdvanced=!0}),["prevent"]))},Object(r["toDisplayString"])(e.translate("TagManager_ShowAdvancedSettings")),513),[[r["vShow"],!e.showAdvanced]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{href:"",class:"hideAdvancedSettings",onClick:t[10]||(t[10]=Object(r["withModifiers"])((function(t){return e.showAdvanced=!1}),["prevent"]))},Object(r["toDisplayString"])(e.translate("TagManager_HideAdvancedSettings")),513),[[r["vShow"],e.showAdvanced]])])])],512),[[r["vShow"],null===(o=e.tag.typeMetadata)||void 0===o?void 0:o.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"radio",name:"fire_limit","model-value":e.tag.fire_limit,"onUpdate:modelValue":t[11]||(t[11]=function(t){e.tag.fire_limit=t,e.setValueHasChanged()}),options:e.availableFireLimits,title:e.translate("TagManager_FireLimit"),"inline-help":e.fireLimitHelp},null,8,["model-value","options","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"fire_delay","model-value":e.tag.fire_delay,"onUpdate:modelValue":t[12]||(t[12]=function(t){e.tag.fire_delay=t,e.setValueHasChanged()}),maxlength:8,title:e.translate("TagManager_FireDelay"),"inline-help":e.translate("TagManager_FireDelayHelp"),placeholder:e.translate("TagManager_PlaceholderZero")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"priority","model-value":e.tag.priority,"onUpdate:modelValue":t[13]||(t[13]=function(t){e.tag.priority=t,e.setValueHasChanged()}),maxlength:4,title:e.translate("TagManager_Priority"),"inline-help":e.translate("TagManager_PriorityHelp"),placeholder:e.translate("TagManager_PriorityPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",_i,[Object(r["createElementVNode"])("div",Di,[Object(r["createElementVNode"])("div",Ai,[Object(r["createElementVNode"])("div",xi,[Object(r["createElementVNode"])("label",Bi,Object(r["toDisplayString"])(e.translate("TagManager_StartDate"))+":",1)]),Object(r["createElementVNode"])("div",Li,[Object(r["createVNode"])(d,{name:"start_date","model-value":e.tag.start_date,"onUpdate:modelValue":t[14]||(t[14]=function(t){e.tag.start_date=t,e.setValueHasChanged()}),"default-time":"00:00:00"},null,8,["model-value"])])])]),Object(r["createElementVNode"])("div",Ui,[Object(r["createElementVNode"])("div",Pi,[Object(r["createElementVNode"])("span",Ii,[Object(r["createElementVNode"])("span",null,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_TagStartDateHelp","",""))},null,8,Fi),Hi,Object(r["createElementVNode"])("span",{class:"currentLocalTime",innerHTML:e.$sanitize(e.translate("TagManager_CurrentTimeInLocalTimezone","",e.currentTime,""))},null,8,Gi)])])])])]),Object(r["createElementVNode"])("div",$i,[Object(r["createElementVNode"])("div",Ri,[Object(r["createElementVNode"])("div",qi,[Object(r["createElementVNode"])("div",zi,[Object(r["createElementVNode"])("label",Wi,Object(r["toDisplayString"])(e.translate("TagManager_EndDate"))+":",1)]),Object(r["createElementVNode"])("div",Xi,[Object(r["createVNode"])(d,{name:"end_date","model-value":e.tag.end_date,"onUpdate:modelValue":t[15]||(t[15]=function(t){e.tag.end_date=t,e.setValueHasChanged()}),"default-time":"23:59:59"},null,8,["model-value"])])])]),Object(r["createElementVNode"])("div",Ki,[Object(r["createElementVNode"])("div",Ji,[Object(r["createElementVNode"])("span",Yi,[Object(r["createElementVNode"])("span",null,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_TagEndDateHelp","",""))},null,8,Zi),Qi,Object(r["createElementVNode"])("span",{class:"currentLocalTime",innerHTML:e.$sanitize(e.translate("TagManager_CurrentTimeInLocalTimezone","",e.currentTime,""))},null,8,er)])])])])])],512),[[r["vShow"],e.showAdvanced&&(null===(g=e.tag.typeMetadata)||void 0===g?void 0:g.hasAdvancedSettings)]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTagDisabled]]),Object(r["withDirectives"])(Object(r["createVNode"])(u,{class:"createButton",onConfirm:t[16]||(t[16]=function(t){return e.edit?e.updateTag():e.createTag()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateNewTag")},null,8,["disabled","saving","value"]),[[r["vShow"],!e.isTagDisabled]]),Object(r["createElementVNode"])("div",tr,[Object(r["createElementVNode"])("a",{onClick:t[17]||(t[17]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],544),[[r["vShow"],!e.chooseTagType&&e.editTitle]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",nr,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.availableTags,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:t.name},[Object(r["createElementVNode"])("li",ar,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:n,class:Object(r["normalizeClass"])(["collection-item avatar",vi({disabledTemplate:e.isTagTemplateDisabled[t.id]},"templateType".concat(t.id),!0)]),onClick:function(n){return e.createTagType(t)},title:e.isTagTemplateDisabled[t.id]?e.collectionItemAvatarText:""},[t.icon?(Object(r["openBlock"])(),Object(r["createElementBlock"])("img",{key:0,alt:"",class:"circle",src:t.icon},null,8,rr)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("span",or,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(t.description),513),[[r["vShow"],t.description]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",lr,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.help},null,8,cr)],512),[[r["vShow"],!!t.help]])],10,ir)})),128))])})),128)),Object(r["createElementVNode"])("div",sr,[Object(r["createElementVNode"])("a",{onClick:t[19]||(t[19]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])],512),[[r["vShow"],e.chooseTagType]])]})),_:1},8,["content-title"])],512)}function ur(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gr(e,t){for(var n=0;n-1){var t=this.trigger.conditions.length-1;t===e?this.trigger.conditions[e]=this.makeDefaultCondition():this.trigger.conditions.splice(e,1),this.isDirty=!0}},createTriggerType:function(e){var t,n=this;e&&this.isTriggerTemplateDisabled[e.id]||(this.chooseTriggerType=!1,this.editTitle=Object(u["translate"])("TagManager_CreateNewTrigger"),this.trigger={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:ya.suggestNameForType(e.name)||"",description:"",type:e.id,idcontainerversion:this.idContainerVersion,conditions:[],typeMetadata:e},null!==(t=this.trigger.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.trigger.typeMetadata.name)),this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.addConditionEntry(),this.isDirty=!0,Object(r["nextTick"])((function(){if(n.$refs.root){var e=n.$refs.root;e.scrollIntoView();var t=e.querySelector("#name");t&&t.focus()}})))},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idTrigger,u["MatomoUrl"].updateHash(e)},createTrigger:function(){var e=this;this.removeAnyTriggerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTrigger=!0,ya.createOrUpdateTrigger(this.trigger,"TagManager.addContainerTrigger",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){var n=t.value;e.isDirty=!1,ya.reload(e.idContainer,e.idContainerVersion).then((function(){if(e.isEmbedded)return e.trigger.idtrigger=n,void e.$emit("changeTrigger",{trigger:e.trigger});e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Trigger")),n="";e.hasPublishCapability()&&(n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(t," ").concat(n),"success")}),200)}))})).finally((function(){e.isUpdatingTrigger=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateTrigger:function(){var e=this;this.removeAnyTriggerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTrigger=!0,ya.createOrUpdateTrigger(this.trigger,"TagManager.updateContainerTrigger",this.idContainer,this.idContainerVersion,this.parameterValues).then((function(t){if(t){if(e.isEmbedded)return e.$emit("changeTrigger",{trigger:e.trigger}),void ya.reload(e.idContainer,e.idContainerVersion);e.isDirty=!1,ya.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdTrigger()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Trigger")),a="";e.hasPublishCapability()&&(a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(n," ").concat(a),"success")}})).finally((function(){e.isUpdatingTrigger=!1})))},makeDefaultCondition:function(){var e,t="PageUrl";if(null!==(e=this.trigger)&&void 0!==e&&e.typeMetadata){var n=this.trigger.typeMetadata.id;Ca[n]&&(t=Ca[n])}return{comparison:"equals",actual:t,expected:""}},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")}},computed:{isLoading:function(){return ya.isLoading.value||Vt.isLoading.value},isUpdating:function(){return ya.isUpdating.value||this.isUpdatingTrigger},create:function(){return 0===this.idTrigger},edit:function(){return!this.create},canUseCustomTemplates:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},isTriggerDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.trigger.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},saveButtonText:function(){return this.edit?Object(u["translate"])("CoreUpdater_UpdateTitle"):Object(u["translate"])("TagManager_CreateNewTrigger")},collectionItemAvatarText:function(){return Object(u["translate"])("TagManager_UseCustomTemplateCapabilityRequired",Object(u["translate"])("TagManager_CapabilityUseCustomTemplates"))},triggerInlineHelpText:function(){return Object(u["translate"])("TagManager_TriggerConditionsHelpText",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/create-a-trigger-to-track-interactions-on-all-nested-elements/"),"")},availableComparisons:function(){return Vt.comparisonOptions.value},isTriggerTemplateDisabled:function(){var e=this,t={};return this.availableTriggers.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},triggerParameterValues:function(){var e;return null!==(e=this.trigger.typeMetadata)&&void 0!==e&&e.parameters?this.parameterValues:null}}});Na.render=ra;var Ea=Na,Sa={class:"tagManagerManageList tagManagerTriggerList"},wa={class:"triggerSearchFilter"},ka=["title"],Ma=["title"],_a=["title"],Da=["title"],Aa=["title"],xa=["title"],Ba={colspan:"7"},La={class:"loadingPiwik"},Ua=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Pa={colspan:"7"},Ia=["id"],Fa=["title"],Ha=["title"],Ga=["title"],$a={class:"conditions"},Ra={class:"icon-ok"},qa=["title"],za={class:"action"},Wa=["onClick","title"],Xa=["onClick","title"],Ka={class:"tableActionBar"},Ja=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Ya={class:"ui-confirm",id:"confirmDeleteTrigger",ref:"confirmDeleteTrigger"},Za=["value"],Qa=["value"],ei={class:"ui-confirm",id:"confirmDeleteTriggerNotPossible",ref:"confirmDeleteTriggerNotPossible"},ti={class:"collection"},ni=["value"];function ai(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ContentBlock"),s=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Sa,[Object(r["createVNode"])(c,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Triggers")),"help-text":e.triggersHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerUsageBenefits")),1),Object(r["createElementVNode"])("div",wa,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"triggerSearch",title:e.translate("General_Search"),modelValue:e.triggerSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.triggerSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.triggers.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,ka),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,Ma),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,_a),Object(r["createElementVNode"])("th",{class:"conditions",title:e.filterTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Filter")),9,Da),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,Aa),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,xa),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Ba,[Object(r["createElementVNode"])("span",La,[Ua,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Pa,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoTriggersFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerTriggerNow",onClick:t[1]||(t[1]=function(t){return e.createTrigger()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTriggerNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&0===e.triggers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTriggers,(function(t){var n;return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"trigger".concat(t.idtrigger),class:"triggers",key:t.idtrigger},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Fa),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Ha),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,Ga),Object(r["createElementVNode"])("td",$a,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Ra,null,512),[[r["vShow"],null===(n=t.conditions)||void 0===n?void 0:n.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,qa),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",za,[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editTrigger(t.idtrigger,t.type)},title:e.translate("TagManager_EditTrigger")},null,8,Wa),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteTrigger(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Trigger"))},null,8,Xa)],512),[[r["vShow"],e.hasWriteAccess]])],8,Ia)})),128))])],512),[[s]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Ka,[Object(r["createElementVNode"])("a",{class:"createNewTrigger",value:"",onClick:t[2]||(t[2]=function(t){return e.createTrigger()})},[Ja,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTrigger")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",Ya,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteTriggerConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Za),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Qa)],512),Object(r["createElementVNode"])("div",ei,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerCannotBeDeleted")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerBeingUsedBy")),1),Object(r["createElementVNode"])("ul",ti,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.triggerReferences,(function(e){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:"collection-item",key:e.referenceId},Object(r["toDisplayString"])(e.referenceTypeName)+": "+Object(r["toDisplayString"])(e.referenceName),1)})),128))]),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TriggerBeingUsedNeedsRemove")),1),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,ni)],512)])}function ii(e){return ci(e)||li(e)||oi(e)||ri()}function ri(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oi(e,t){if(e){if("string"===typeof e)return si(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?si(e,t):void 0}}function li(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function ci(e){if(Array.isArray(e))return si(e)}function si(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.name?1:0})),t},nameTranslatedText:function(){return this.translate("TagManager_TriggersNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_TriggersDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_TriggersTypeDescription")},filterTranslatedText:function(){return this.translate("TagManager_TriggersFilterDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_TriggersLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_TriggersActionDescription")}}});gi.render=ai;var bi=gi,mi={class:"manageTrigger"};function pi(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TriggerList"),c=Object(r["resolveComponent"])("TriggerEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",mi,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"triggers-help-text":e.triggersHelpText},null,8,["id-container","id-container-version","triggers-help-text"])])],512),[[r["vShow"],!e.editMode]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"id-trigger":e.idTrigger},null,8,["id-container","id-container-version","id-trigger"])])],512),[[r["vShow"],e.editMode]])])}var hi=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,triggersHelpText:String},components:{TriggerList:bi,TriggerEdit:Ea},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idTrigger}),(function(t){e.onIdTriggerParamChange(t)})),u["NotificationsStore"].remove("triggertriggermanagement"),this.onIdTriggerParamChange(u["MatomoUrl"].hashParsed.value.idTrigger)},methods:{onIdTriggerParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddTrigger",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idTrigger:function(){var e=u["MatomoUrl"].hashParsed.value.idTrigger;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idTrigger}}});hi.render=pi;var fi=hi;function vi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ji={class:"editTag tagManagerManageEdit",ref:"root"},Oi={class:"loadingPiwik"},Ti=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),yi={class:"loadingPiwik"},Vi=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ci={class:"form-group row"},Ni={class:"col s12"},Ei={key:0},Si={class:"form-group row"},wi={class:"col s12"},ki={class:"form-group row"},Mi={class:"col s12"},_i={class:"form-group row tagStartDate"},Di={class:"col s12 m6"},Ai={class:"row"},xi={class:"col s12"},Bi={for:"start_date_date",class:"active"},Li={class:"tagStartDate"},Ui={class:"col s12 m6 "},Pi={class:"form-help"},Ii={class:"inline-help"},Fi=["innerHTML"],Hi=Object(r["createElementVNode"])("br",null,null,-1),Gi=["innerHTML"],$i={class:"form-group row tagEndDate"},Ri={class:"col s12 m6"},qi={class:"row"},zi={class:"col s12"},Wi={for:"end_date_date",class:"active"},Xi={class:"tagEndDate"},Ki={class:"col s12 m6"},Ji={class:"form-help"},Yi={class:"inline-help"},Zi=["innerHTML"],Qi=Object(r["createElementVNode"])("br",null,null,-1),er=["innerHTML"],tr={class:"entityCancel"},nr={id:"confirmSelectTagType"},ar={class:"collection-header"},ir=["onClick","title"],rr=["src"],or={class:"title"},lr={class:"secondary-content"},cr=["title"],sr={class:"entityCancel"};function dr(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("GroupedSettings"),s=Object(r["resolveComponent"])("TagTriggerArray"),d=Object(r["resolveComponent"])("TagDateInput"),u=Object(r["resolveComponent"])("SaveButton"),g=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ji,[Object(r["createVNode"])(g,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n,a,i,o,g;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Oi,[Ti,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",yi,[Vi,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("form",{onSubmit:t[18]||(t[18]=function(t){return e.edit?e.updateTag():e.createTag()})},[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTagDisabled]]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.tag.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.tag.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_TagNameHelpV2"),placeholder:e.translate("TagManager_TagNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.tag.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.tag.description=t,e.setValueHasChanged()}),maxlength:1e3,title:e.translate("TagManager_Description"),placeholder:e.translate("TagManager_TagDescriptionPlaceholder")},null,8,["model-value","title","placeholder"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Ci,[Object(r["createElementVNode"])("div",Ni,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureWhatTagDoes")),1)])],512),[[r["vShow"],null===(n=e.tag.typeMetadata)||void 0===n?void 0:n.parameters.length]]),e.tag?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ei,[Object(r["createVNode"])(c,{settings:(null===(a=e.tag.typeMetadata)||void 0===a?void 0:a.parameters)||[],"all-setting-values":e.parameterValues,onChange:t[2]||(t[2]=function(t){e.parameterValues[t.name]=t.value,e.setValueHasChanged()})},null,8,["settings","all-setting-values"])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Si,[Object(r["createElementVNode"])("div",wi,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ConfigureWhenTagDoes")),1)])],512),[[r["vShow"],null===(i=e.tag.typeMetadata)||void 0===i?void 0:i.parameters.length]]),Object(r["createVNode"])(s,{"container-triggers":e.containerTriggers,type:"fire",title:e.translate("TagManager_FireTriggerTitle"),help:e.translate("TagManager_FireTriggerHelp",e.translate("TagManager_FireLimit")),"model-value":e.fireTriggers,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.fireTriggers=t,e.setValueHasChanged(),e.onFireTriggerChange()}),onCreate:t[4]||(t[4]=function(t){return e.onCreateNewFireTrigger()}),onEdit:t[5]||(t[5]=function(t){return e.editTrigger(t)})},null,8,["container-triggers","title","help","model-value"]),Object(r["createVNode"])(s,{"container-triggers":e.containerTriggers,type:"block",title:e.translate("TagManager_BlockTriggerTitle"),help:e.translate("TagManager_BlockTriggerHelp"),"model-value":e.blockTriggers,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.blockTriggers=t,e.setValueHasChanged(),e.onBlockTriggerChange()}),onCreate:t[7]||(t[7]=function(t){return e.onCreateNewBlockTrigger()}),onEdit:t[8]||(t[8]=function(t){return e.editTrigger(t)})},null,8,["container-triggers","title","help","model-value"]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",ki,[Object(r["createElementVNode"])("div",Mi,[Object(r["createElementVNode"])("h3",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{href:"",class:"showAdvancedSettings",onClick:t[9]||(t[9]=Object(r["withModifiers"])((function(t){return e.showAdvanced=!0}),["prevent"]))},Object(r["toDisplayString"])(e.translate("TagManager_ShowAdvancedSettings")),513),[[r["vShow"],!e.showAdvanced]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{href:"",class:"hideAdvancedSettings",onClick:t[10]||(t[10]=Object(r["withModifiers"])((function(t){return e.showAdvanced=!1}),["prevent"]))},Object(r["toDisplayString"])(e.translate("TagManager_HideAdvancedSettings")),513),[[r["vShow"],e.showAdvanced]])])])],512),[[r["vShow"],null===(o=e.tag.typeMetadata)||void 0===o?void 0:o.hasAdvancedSettings]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"radio",name:"fire_limit","model-value":e.tag.fire_limit,"onUpdate:modelValue":t[11]||(t[11]=function(t){e.tag.fire_limit=t,e.setValueHasChanged()}),options:e.availableFireLimits,title:e.translate("TagManager_FireLimit"),"inline-help":e.fireLimitHelp},null,8,["model-value","options","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"fire_delay","model-value":e.tag.fire_delay,"onUpdate:modelValue":t[12]||(t[12]=function(t){e.tag.fire_delay=t,e.setValueHasChanged()}),maxlength:8,title:e.translate("TagManager_FireDelay"),"inline-help":e.translate("TagManager_FireDelayHelp"),placeholder:e.translate("TagManager_PlaceholderZero")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"priority","model-value":e.tag.priority,"onUpdate:modelValue":t[13]||(t[13]=function(t){e.tag.priority=t,e.setValueHasChanged()}),maxlength:4,title:e.translate("TagManager_Priority"),"inline-help":e.translate("TagManager_PriorityHelp"),placeholder:e.translate("TagManager_PriorityPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",_i,[Object(r["createElementVNode"])("div",Di,[Object(r["createElementVNode"])("div",Ai,[Object(r["createElementVNode"])("div",xi,[Object(r["createElementVNode"])("label",Bi,Object(r["toDisplayString"])(e.translate("TagManager_StartDate"))+":",1)]),Object(r["createElementVNode"])("div",Li,[Object(r["createVNode"])(d,{name:"start_date","model-value":e.tag.start_date,"onUpdate:modelValue":t[14]||(t[14]=function(t){e.tag.start_date=t,e.setValueHasChanged()}),"default-time":"00:00:00"},null,8,["model-value"])])])]),Object(r["createElementVNode"])("div",Ui,[Object(r["createElementVNode"])("div",Pi,[Object(r["createElementVNode"])("span",Ii,[Object(r["createElementVNode"])("span",null,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_TagStartDateHelp","",""))},null,8,Fi),Hi,Object(r["createElementVNode"])("span",{class:"currentLocalTime",innerHTML:e.$sanitize(e.translate("TagManager_CurrentTimeInLocalTimezone","",e.currentTime,""))},null,8,Gi)])])])])]),Object(r["createElementVNode"])("div",$i,[Object(r["createElementVNode"])("div",Ri,[Object(r["createElementVNode"])("div",qi,[Object(r["createElementVNode"])("div",zi,[Object(r["createElementVNode"])("label",Wi,Object(r["toDisplayString"])(e.translate("TagManager_EndDate"))+":",1)]),Object(r["createElementVNode"])("div",Xi,[Object(r["createVNode"])(d,{name:"end_date","model-value":e.tag.end_date,"onUpdate:modelValue":t[15]||(t[15]=function(t){e.tag.end_date=t,e.setValueHasChanged()}),"default-time":"23:59:59"},null,8,["model-value"])])])]),Object(r["createElementVNode"])("div",Ki,[Object(r["createElementVNode"])("div",Ji,[Object(r["createElementVNode"])("span",Yi,[Object(r["createElementVNode"])("span",null,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_TagEndDateHelp","",""))},null,8,Zi),Qi,Object(r["createElementVNode"])("span",{class:"currentLocalTime",innerHTML:e.$sanitize(e.translate("TagManager_CurrentTimeInLocalTimezone","",e.currentTime,""))},null,8,er)])])])])])],512),[[r["vShow"],e.showAdvanced&&(null===(g=e.tag.typeMetadata)||void 0===g?void 0:g.hasAdvancedSettings)]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-warning"},Object(r["toDisplayString"])(e.translate("TagManager_UseCustomTemplateCapabilityRequired",e.translate("TagManager_CapabilityUseCustomTemplates"))),513),[[r["vShow"],e.isTagDisabled]]),Object(r["withDirectives"])(Object(r["createVNode"])(u,{class:"createButton",onConfirm:t[16]||(t[16]=function(t){return e.edit?e.updateTag():e.createTag()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateNewTag")},null,8,["disabled","saving","value"]),[[r["vShow"],!e.isTagDisabled]]),Object(r["createElementVNode"])("div",tr,[Object(r["createElementVNode"])("a",{onClick:t[17]||(t[17]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],544),[[r["vShow"],!e.chooseTagType&&e.editTitle]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",nr,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.availableTags,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("ul",{class:"collection with-header",key:t.name},[Object(r["createElementVNode"])("li",ar,[Object(r["createElementVNode"])("h4",null,Object(r["toDisplayString"])(t.name),1)]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.types,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:n,class:Object(r["normalizeClass"])(["collection-item avatar",vi({disabledTemplate:e.isTagTemplateDisabled[t.id]},"templateType".concat(t.id),!0)]),onClick:function(n){return e.createTagType(t)},title:e.isTagTemplateDisabled[t.id]?e.collectionItemAvatarText:""},[t.icon?(Object(r["openBlock"])(),Object(r["createElementBlock"])("img",{key:0,alt:"",class:"circle",src:t.icon},null,8,rr)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("span",or,Object(r["toDisplayString"])(t.name),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(t.description),513),[[r["vShow"],t.description]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",lr,[Object(r["createElementVNode"])("i",{class:"icon-help",title:t.help},null,8,cr)],512),[[r["vShow"],!!t.help]])],10,ir)})),128))])})),128)),Object(r["createElementVNode"])("div",sr,[Object(r["createElementVNode"])("a",{onClick:t[19]||(t[19]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])],512),[[r["vShow"],e.chooseTagType]])]})),_:1},8,["content-title"])],512)}function ur(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gr(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);n-1){var t=this.blockTriggers.length-1;t===e?this.blockTriggers[e]=null:this.blockTriggers.splice(e,1),this.isDirty=!0}},onFireTriggerChange:function(){var e=this.fireTriggers.every((function(e){return!!e}));e&&this.addFireTrigger()},addFireTrigger:function(){this.fireTriggers.push(null),this.isDirty=!0},removeFireTrigger:function(e){if(e>-1){var t=this.fireTriggers.length-1;t===e?this.fireTriggers[e]=null:this.fireTriggers.splice(e,1),this.isDirty=!0}},createTagType:function(e){var t,n=this;e&&this.isTagTemplateDisabled[e.id]||(this.chooseTagType=!1,this.tag={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:bo.suggestNameForType(e.name)||"",type:e.id,fire_limit:"unlimited",priority:"GoogleTag"===e.id||"GoogleAnalytics4"===e.id?1:999,fire_delay:0,typeMetadata:e},this.editTitle=Object(u["translate"])("TagManager_CreateNewTag"),null!==(t=this.tag.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.tag.typeMetadata.name)),this.blockTriggers=[null],this.fireTriggers=[null],this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.isDirty=!1,setTimeout((function(){var e=Vo(n.$refs.root);e.length&&e[0]&&e[0].scrollIntoView(),e.find("#name").focus()}),1))},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idTag,u["MatomoUrl"].updateHash(e)},createTag:function(){var e=this;this.removeAnyTagNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTag=!0,bo.createOrUpdateTag(this.tag,"TagManager.addContainerTag",this.idContainer,this.idContainerVersion,this.parameterValues,this.fireTriggers.filter((function(e){return!!e})),this.blockTriggers.filter((function(e){return!!e}))).then((function(t){t&&(e.isDirty=!1,bo.reload(e.idContainer,e.idContainerVersion).then((function(){e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Tag")),n="";e.hasPublishCapability()&&(n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(t," ").concat(n),"success")}),200)})))})).finally((function(){e.isUpdatingTag=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateTag:function(){var e=this;this.removeAnyTagNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTag=!0,bo.createOrUpdateTag(this.tag,"TagManager.updateContainerTag",this.idContainer,this.idContainerVersion,this.parameterValues,this.fireTriggers.filter((function(e){return!!e})),this.blockTriggers.filter((function(e){return!!e}))).then((function(t){if(t){e.isDirty=!1,bo.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdTag()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Tag")),a="";e.hasPublishCapability()&&(a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(n," ").concat(a),"success")}})).finally((function(){e.isUpdatingTag=!1})))},checkRequiredFieldsAreSet:function(){if(!this.tag.name){var e=Object(u["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}return!(!this.fireTriggers||!this.fireTriggers.length)||(this.showNotification(Object(u["translate"])("TagManager_TagFireTriggerRequirement"),"error"),!1)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")}},computed:{availableFireLimits:function(){return hr.fireLimitsOptions.value},isLoading:function(){return ya.isLoading.value||hr.isLoading.value},isUpdating:function(){return ya.isUpdating.value||this.isUpdatingTag},create:function(){return 0===this.idTag},edit:function(){return!this.create},canUseCustomTemplates:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},isTagDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.tag.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},isTagTemplateDisabled:function(){var e=this,t={};return this.availableTags.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},collectionItemAvatarText:function(){return Object(u["translate"])("TagManager_UseCustomTemplateCapabilityRequired",Object(u["translate"])("TagManager_CapabilityUseCustomTemplates"))},fireLimitHelp:function(){return Object(u["translate"])("TagManager_FireLimitHelp",Object(u["translate"])("TagManager_Unlimited"),Object(u["translate"])("TagManager_OncePage"),Object(u["translate"])("TagManager_Once24Hours"),Object(u["translate"])("TagManager_OnceLifetime"))}}});Eo.render=dr;var So=Eo,ko={class:"tagManagerManageList tagManagerTagList"},wo={class:"tagSearchFilter"},Mo=["title"],_o=["title"],Do=["title"],Ao=["title"],xo=["title"],Bo=["title"],Lo={colspan:"6"},Uo={class:"loadingPiwik"},Po=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Io={colspan:"6"},Fo=["id"],Ho=["title"],Go=["title"],$o=["title"],Ro={class:"triggers"},qo=["onClick","title"],zo=["title"],Wo=["onClick","title"],Xo=["title"],Ko=["title"],Jo={class:"action"},Yo=["onClick","title"],Zo=["onClick","title"],Qo=["onClick","title"],el=["onClick","title"],tl={class:"tableActionBar"},nl=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),al={class:"ui-confirm",id:"confirmDeleteTag",ref:"confirmDeleteTag"},il=["value"],rl=["value"],ol={class:"ui-confirm",id:"confirmPauseTag",ref:"confirmPauseTag"},ll=["value"],cl=["value"],sl={class:"ui-confirm",id:"confirmResumeTag",ref:"confirmResumeTag"},dl=["value"],ul=["value"];function gl(e,t,n,a,i,o){var l=this,c=Object(r["resolveComponent"])("Field"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ko,[Object(r["createVNode"])(s,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Tags")),"help-text":e.tagsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TagUsageBenefits")),1),Object(r["createElementVNode"])("div",wo,[Object(r["withDirectives"])(Object(r["createVNode"])(c,{uicontrol:"text",name:"tagSearch",title:e.translate("General_Search"),modelValue:e.tagSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.tagSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.tags.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,Mo),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,_o),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,Do),Object(r["createElementVNode"])("th",{class:"triggers",title:e.triggersTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Triggers")),9,Ao),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,xo),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,Bo),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Lo,[Object(r["createElementVNode"])("span",Uo,[Po,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Io,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoTagsFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerTagNow",onClick:t[1]||(t[1]=function(t){return e.createTag()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTagNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&0===e.tags.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTags,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{class:"tags",key:t.idtag,id:"tag".concat(t.idtag)},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Ho),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Go),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,$o),Object(r["createElementVNode"])("td",Ro,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.fire_trigger_ids,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n,style:{"margin-right":"3.5px"}},[e.hasWriteAccess?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,style:{display:"inline-block","vertical-align":"top !important"},class:"chip",href:"",onClick:Object(r["withModifiers"])((function(n){return e.editTrigger(t)}),["prevent"]),title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,qo)):Object(r["createCommentVNode"])("",!0),e.hasWriteAccess?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:1,class:"chip",title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,zo))])})),128)),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Except"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.block_trigger_ids,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n,style:{"margin-right":"3.5px"}},[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"chip",href:"",onClick:Object(r["withModifiers"])((function(n){return e.editTrigger(t)}),["prevent"]),title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,Wo),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"chip",title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,Xo),[[r["vShow"],!e.hasWriteAccess]])])})),128))],512),[[r["vShow"],t.block_trigger_ids.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,Ko),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",Jo,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-pause",onClick:function(n){return e.pauseTag(t)},title:e.translate("TagManager_PauseX",e.translate("TagManager_Tag"))},null,8,Yo),[[r["vShow"],"active"===t.status]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-play",onClick:function(n){return e.resumeTag(t)},title:e.translate("TagManager_ResumeX",e.translate("TagManager_Tag"))},null,8,Zo),[[r["vShow"],"paused"===t.status]]),Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editTag(t.idtag,t.type)},title:e.translate("TagManager_EditTag")},null,8,Qo),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteTag(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Tag"))},null,8,el)],512),[[r["vShow"],e.hasWriteAccess]])],8,Fo)})),128))])],512),[[d]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",tl,[Object(r["createElementVNode"])("a",{class:"createNewTag",value:"",onClick:t[2]||(t[2]=function(t){return e.createTag()})},[nl,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTag")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",al,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,il),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,rl)],512),Object(r["createElementVNode"])("div",ol,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_PauseTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ll),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,cl)],512),Object(r["createElementVNode"])("div",sl,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_ResumeTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,dl),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ul)],512)])}function ml(e){return fl(e)||hl(e)||pl(e)||bl()}function bl(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pl(e,t){if(e){if("string"===typeof e)return vl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vl(e,t):void 0}}function hl(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function fl(e){if(Array.isArray(e))return vl(e)}function vl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n',"")),this.showNotification("".concat(n," ").concat(a),"success")},showNotification:function(e,t){var n=u["NotificationsStore"].show({message:e,context:t,id:Tl,type:"transient"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(n)}),200)}},computed:{triggers:function(){var e={};return ya.triggers.value.forEach((function(t){e["".concat(t.idtrigger)]=t.name})),e},isLoading:function(){return bo.isLoading.value},isUpdating:function(){return bo.isUpdating.value},tags:function(){return bo.tags.value},sortedTags:function(){var e=this,t=this.tagSearch.toLowerCase(),n=ml(this.tags).filter((function(n){return Object.keys(n).some((function(a){var i=n,r="";if("string"===typeof i[a])r=i[a];else if("typeMetadata"===a){var o=i.typeMetadata;r=o.name}else if("fire_trigger_ids"===a)e.triggers&&i.fire_trigger_ids&&Object.values(i.fire_trigger_ids).forEach((function(t){e.triggers[t]&&(r+="".concat(e.triggers[t]," "))}));else if("parameters"===a&&"CustomHtml"===i.type){var l=i.parameters;r=l.customHtml}return-1!==r.toLowerCase().indexOf(t)}))}));return n.sort((function(e,t){return e.namet.name?1:0})),n},nameTranslatedText:function(){return this.translate("TagManager_TagsNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_TagsDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_TagsTypeDescription")},triggersTranslatedText:function(){return this.translate("TagManager_TagsTriggersDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_TagsLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_TagsActionDescription")}}});yl.render=gl;var Vl=yl,Cl={class:"manageTag"},Nl={key:0},El={key:1};function Sl(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TagList"),c=Object(r["resolveComponent"])("TagEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Cl,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Nl,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"tags-help-text":e.tagsHelpText},null,8,["id-container","id-container-version","tags-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",El,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"id-tag":e.idTag},null,8,["id-container","id-container-version","id-tag"])])):Object(r["createCommentVNode"])("",!0)])}var kl=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,tagsHelpText:String},components:{TagList:Vl,TagEdit:So},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idTag}),(function(t){e.onIdTagParamChange(t)})),u["NotificationsStore"].remove("tagtagmanagement"),this.onIdTagParamChange(u["MatomoUrl"].hashParsed.value.idTag)},methods:{onIdTagParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddTag",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idTag:function(){var e=u["MatomoUrl"].hashParsed.value.idTag;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idTag}}});kl.render=Sl;var wl=kl,Ml={class:"editVersion tagManagerManageEdit"},_l={class:"loadingPiwik"},Dl=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Al={class:"loadingPiwik"},xl=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Bl={key:0},Ll={key:0},Ul={key:1},Pl=["innerHTML"],Il={key:2,class:"versionChanges"},Fl={key:0},Hl={colspan:"4"},Gl={key:1},$l={colspan:"4"},Rl={class:"lastUpdated"},ql={class:"entityCancel"};function zl(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("SaveButton"),s=Object(r["resolveComponent"])("ActivityIndicator"),d=Object(r["resolveComponent"])("ContentBlock"),u=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ml,[Object(r["createVNode"])(d,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",_l,[Dl,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Al,[xl,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[6]||(t[6]=function(t){return e.edit?e.updateVersion():e.createVersion()})},[Object(r["createElementVNode"])("div",null,[e.hasPublishCapability()||e.hasWriteCapability()&&e.hasPublishToLiveCapability()?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Bl,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","inline-help":e.versionNameHelpText,"inline-help-bind":{lastVersion:e.lastVersion},"model-value":e.version.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.version.name=t,e.setValueHasChanged()}),maxlength:30,title:e.translate("TagManager_VersionName"),placeholder:e.translate("TagManager_VersionNamePlaceholder")},null,8,["inline-help","inline-help-bind","model-value","title","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.version.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.version.description=t,e.setValueHasChanged()}),title:e.translate("TagManager_VersionDescriptionOptional"),"inline-help":e.translate("TagManager_VersionDescriptionHelp"),placeholder:e.translate("TagManager_VersionDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createVNode"])(c,{class:"createButton no-publish",onConfirm:t[2]||(t[2]=function(t){return e.edit?e.updateVersion():e.createVersion()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateVersionWithoutPublishing")},null,8,["disabled","saving","value"]),e.create&&e.environments.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ll,[Object(r["createVNode"])(l,{uicontrol:"select",name:"environment","inline-help":e.selectTagManagerEnvironmentHelp,"inline-help-bind":{canPublishToLive:e.canPublishToLive},"model-value":null===(n=e.version.environments)||void 0===n?void 0:n[0],"onUpdate:modelValue":t[3]||(t[3]=function(t){e.version.environments[0]=t,e.setValueHasChanged()}),options:e.environments,introduction:e.translate("TagManager_OrCreateAndPublishVersion"),title:e.translate("TagManager_Environment")},null,8,["inline-help","inline-help-bind","model-value","options","introduction","title"])])):Object(r["createCommentVNode"])("",!0),e.create&&e.environments.length?(Object(r["openBlock"])(),Object(r["createBlock"])(c,{key:1,class:"publishButton",onConfirm:t[4]||(t[4]=function(t){return e.createVersionAndPublish()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.translate("TagManager_CreateVersionAndPublishRelease")},null,8,["disabled","saving","value"])):Object(r["createCommentVNode"])("",!0)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ul,[Object(r["createElementVNode"])("div",{class:"alert alert-warning",innerHTML:e.$sanitize(e.showNoAccessErrorMessage)},null,8,Pl)])),e.lastVersion?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Il,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ChangesSinceLastVersion"))+":",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SitesManager_Type")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("TagManager_Change")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),1)])]),Object(r["createElementVNode"])("tbody",null,[e.isLoadingVersionChanges?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Fl,[Object(r["createElementVNode"])("td",Hl,[Object(r["createVNode"])(s,{"loading-message":e.translate("TagManager_DetectingChanges"),loading:!0},null,8,["loading-message"])])])):Object(r["createCommentVNode"])("",!0),e.versionChanges.length||e.isLoadingVersionChanges?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Gl,[Object(r["createElementVNode"])("td",$l,Object(r["toDisplayString"])(e.translate("UserCountryMap_None")),1)])),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.versionChanges,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:n},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.translate(t.entityType)),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.translate(t.type)),1),Object(r["createElementVNode"])("td",Rl,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.lastChanged),1)])])})),128))])],512),[[u]])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",ql,[Object(r["createElementVNode"])("a",{onClick:t[5]||(t[5]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])])],32)]})),_:1},8,["content-title"])])}function Wl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xl(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,a=new Array(t);n-1){var t=this.blockTriggers.length-1;t===e?this.blockTriggers[e]=null:this.blockTriggers.splice(e,1),this.isDirty=!0}},onFireTriggerChange:function(){var e=this.fireTriggers.every((function(e){return!!e}));e&&this.addFireTrigger()},addFireTrigger:function(){this.fireTriggers.push(null),this.isDirty=!0},removeFireTrigger:function(e){if(e>-1){var t=this.fireTriggers.length-1;t===e?this.fireTriggers[e]=null:this.fireTriggers.splice(e,1),this.isDirty=!0}},createTagType:function(e){var t,n=this;e&&this.isTagTemplateDisabled[e.id]||(this.chooseTagType=!1,this.tag={idsite:parseInt("".concat(u["Matomo"].idSite),10),name:mo.suggestNameForType(e.name)||"",type:e.id,fire_limit:"unlimited",priority:"GoogleTag"===e.id||"GoogleAnalytics4"===e.id?1:999,fire_delay:0,typeMetadata:e},this.editTitle=Object(u["translate"])("TagManager_CreateNewTag"),null!==(t=this.tag.typeMetadata)&&void 0!==t&&t.name&&(this.editTitle+=": ".concat(this.tag.typeMetadata.name)),this.blockTriggers=[null],this.fireTriggers=[null],this.parameterValues=Object.fromEntries(e.parameters.map((function(e){return[e.name,e.value]}))),this.isDirty=!1,setTimeout((function(){var e=Vo(n.$refs.root);e.length&&e[0]&&e[0].scrollIntoView(),e.find("#name").focus()}),1))},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idTag,u["MatomoUrl"].updateHash(e)},createTag:function(){var e=this;this.removeAnyTagNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTag=!0,mo.createOrUpdateTag(this.tag,"TagManager.addContainerTag",this.idContainer,this.idContainerVersion,this.parameterValues,this.fireTriggers.filter((function(e){return!!e})),this.blockTriggers.filter((function(e){return!!e}))).then((function(t){t&&(e.isDirty=!1,mo.reload(e.idContainer,e.idContainerVersion).then((function(){e.cancel(),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Tag")),n="";e.hasPublishCapability()&&(n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(t," ").concat(n),"success")}),200)})))})).finally((function(){e.isUpdatingTag=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateTag:function(){var e=this;this.removeAnyTagNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingTag=!0,mo.createOrUpdateTag(this.tag,"TagManager.updateContainerTag",this.idContainer,this.idContainerVersion,this.parameterValues,this.fireTriggers.filter((function(e){return!!e})),this.blockTriggers.filter((function(e){return!!e}))).then((function(t){if(t){e.isDirty=!1,mo.reload(e.idContainer,e.idContainerVersion).then((function(){e.initIdTag()})),e.cancel();var n=Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Tag")),a="";e.hasPublishCapability()&&(a=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(n," ").concat(a),"success")}})).finally((function(){e.isUpdatingTag=!1})))},checkRequiredFieldsAreSet:function(){if(!this.tag.name){var e=Object(u["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}return!(!this.fireTriggers||!this.fireTriggers.length)||(this.showNotification(Object(u["translate"])("TagManager_TagFireTriggerRequirement"),"error"),!1)},hasPublishCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")}},computed:{availableFireLimits:function(){return hr.fireLimitsOptions.value},isLoading:function(){return ya.isLoading.value||hr.isLoading.value},isUpdating:function(){return ya.isUpdating.value||this.isUpdatingTag},create:function(){return 0===this.idTag},edit:function(){return!this.create},canUseCustomTemplates:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},isTagDisabled:function(){var e;return!this.canUseCustomTemplates&&(null===(e=this.tag.typeMetadata)||void 0===e?void 0:e.isCustomTemplate)},isTagTemplateDisabled:function(){var e=this,t={};return this.availableTags.forEach((function(n){n.types.forEach((function(n){t[n.id]=!e.canUseCustomTemplates&&n.isCustomTemplate}))})),t},collectionItemAvatarText:function(){return Object(u["translate"])("TagManager_UseCustomTemplateCapabilityRequired",Object(u["translate"])("TagManager_CapabilityUseCustomTemplates"))},fireLimitHelp:function(){return Object(u["translate"])("TagManager_FireLimitHelp",Object(u["translate"])("TagManager_Unlimited"),Object(u["translate"])("TagManager_OncePage"),Object(u["translate"])("TagManager_Once24Hours"),Object(u["translate"])("TagManager_OnceLifetime"))}}});Eo.render=dr;var So=Eo,wo={class:"tagManagerManageList tagManagerTagList"},ko={class:"tagSearchFilter"},Mo=["title"],_o=["title"],Do=["title"],Ao=["title"],xo=["title"],Bo=["title"],Lo={colspan:"6"},Uo={class:"loadingPiwik"},Po=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Io={colspan:"6"},Fo=["id"],Ho=["title"],Go=["title"],$o=["title"],Ro={class:"triggers"},qo=["onClick","title"],zo=["title"],Wo=["onClick","title"],Xo=["title"],Ko=["title"],Jo=["onClick","title"],Yo=["onClick","title"],Zo=["onClick","title"],Qo=["onClick","title"],el=["onClick","title"],tl={class:"tableActionBar"},nl=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),al={class:"ui-confirm",id:"confirmDeleteTag",ref:"confirmDeleteTag"},il=["value"],rl=["value"],ol={class:"ui-confirm",id:"confirmPauseTag",ref:"confirmPauseTag"},ll=["value"],cl=["value"],sl={class:"ui-confirm",id:"confirmResumeTag",ref:"confirmResumeTag"},dl=["value"],ul=["value"];function gl(e,t,n,a,i,o){var l=this,c=Object(r["resolveComponent"])("Field"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",wo,[Object(r["createVNode"])(s,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Tags")),"help-text":e.tagsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_TagUsageBenefits")),1),Object(r["createElementVNode"])("div",ko,[Object(r["withDirectives"])(Object(r["createVNode"])(c,{uicontrol:"text",name:"tagSearch",title:e.translate("General_Search"),modelValue:e.tagSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.tagSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.tags.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,Mo),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,_o),Object(r["createElementVNode"])("th",{class:"type",title:e.typeTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Type")),9,Do),Object(r["createElementVNode"])("th",{class:"triggers",title:e.triggersTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Triggers")),9,Ao),Object(r["createElementVNode"])("th",{class:"lastUpdated",title:e.lastUpdatedTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),9,xo),Object(r["withDirectives"])(Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,Bo),[[r["vShow"],e.hasWriteAccess]])])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Lo,[Object(r["createElementVNode"])("span",Uo,[Po,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Io,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoTagsFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerTagNow",onClick:t[1]||(t[1]=function(t){return e.createTag()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTagNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&0===e.tags.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTags,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{class:"tags",key:t.idtag,id:"tag".concat(t.idtag)},[Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,Ho),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,Go),Object(r["createElementVNode"])("td",{class:"type",title:t.typeMetadata.description},Object(r["toDisplayString"])(t.typeMetadata.name),9,$o),Object(r["createElementVNode"])("td",Ro,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.fire_trigger_ids,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n,style:{"margin-right":"3.5px"}},[e.hasWriteAccess?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,style:{display:"inline-block","vertical-align":"top !important"},class:"chip",href:"",onClick:Object(r["withModifiers"])((function(n){return e.editTrigger(t)}),["prevent"]),title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,qo)):Object(r["createCommentVNode"])("",!0),e.hasWriteAccess?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:1,class:"chip",title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,zo))])})),128)),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Except"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.block_trigger_ids,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n,style:{"margin-right":"3.5px"}},[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"chip",href:"",onClick:Object(r["withModifiers"])((function(n){return e.editTrigger(t)}),["prevent"]),title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,Wo),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"chip",title:l.triggers[t]},Object(r["toDisplayString"])(e.truncateText(l.triggers[t],e.triggerTruncateLength)),9,Xo),[[r["vShow"],!e.hasWriteAccess]])])})),128))],512),[[r["vShow"],t.block_trigger_ids.length]])]),Object(r["createElementVNode"])("td",{class:"lastUpdated",title:e.translate("TagManager_CreatedOnX",t.created_date_pretty)},[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.updated_date_pretty),1)],8,Ko),Object(r["withDirectives"])(Object(r["createElementVNode"])("td",{class:Object(r["normalizeClass"])(e.getActionClasses)},[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-pause",onClick:function(n){return e.pauseTag(t)},title:e.translate("TagManager_PauseX",e.translate("TagManager_Tag"))},null,8,Jo),[[r["vShow"],"active"===t.status]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-play",onClick:function(n){return e.resumeTag(t)},title:e.translate("TagManager_ResumeX",e.translate("TagManager_Tag"))},null,8,Yo),[[r["vShow"],"paused"===t.status]]),Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editTag(t.idtag,t.type)},title:e.translate("TagManager_EditTag")},null,8,Zo),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteTag(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Tag"))},null,8,Qo),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-content-copy",onClick:function(n){return e.openCopyDialog(t)},title:e.translate("TagManager_CopyX",e.translate("TagManager_Tag"))},null,8,el),[[r["vShow"],e.hasPublishCapability()]])],2),[[r["vShow"],e.hasWriteAccess]])],8,Fo)})),128))])],512),[[d]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",tl,[Object(r["createElementVNode"])("a",{class:"createNewTag",value:"",onClick:t[2]||(t[2]=function(t){return e.createTag()})},[nl,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTag")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",al,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,il),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,rl)],512),Object(r["createElementVNode"])("div",ol,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_PauseTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ll),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,cl)],512),Object(r["createElementVNode"])("div",sl,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_ResumeTagConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,dl),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ul)],512)])}function bl(e){return fl(e)||hl(e)||pl(e)||ml()}function ml(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function pl(e,t){if(e){if("string"===typeof e)return vl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vl(e,t):void 0}}function hl(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function fl(e){if(Array.isArray(e))return vl(e)}function vl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n',"")),this.showNotification("".concat(n," ").concat(a),"success")},showNotification:function(e,t){var n=u["NotificationsStore"].show({message:e,context:t,id:Tl,type:"transient"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(n)}),200)},openCopyDialog:function(e){var t=u["MatomoUrl"].stringify({module:"TagManager",action:"copyTagDialog",idSite:e.idsite,idContainer:this.idContainer,idTag:e.idtag,idContainerVersion:this.idContainerVersion});window.Piwik_Popover.createPopupAndLoadUrl(t,"","mtmCopyTag")}},computed:{triggers:function(){var e={};return ya.triggers.value.forEach((function(t){e["".concat(t.idtrigger)]=t.name})),e},isLoading:function(){return mo.isLoading.value},isUpdating:function(){return mo.isUpdating.value},tags:function(){return mo.tags.value},sortedTags:function(){var e=this,t=this.tagSearch.toLowerCase(),n=bl(this.tags).filter((function(n){return Object.keys(n).some((function(a){var i=n,r="";if("string"===typeof i[a])r=i[a];else if("typeMetadata"===a){var o=i.typeMetadata;r=o.name}else if("fire_trigger_ids"===a)e.triggers&&i.fire_trigger_ids&&Object.values(i.fire_trigger_ids).forEach((function(t){e.triggers[t]&&(r+="".concat(e.triggers[t]," "))}));else if("parameters"===a&&"CustomHtml"===i.type){var l=i.parameters;r=l.customHtml}return-1!==r.toLowerCase().indexOf(t)}))}));return n.sort((function(e,t){return e.namet.name?1:0})),n},nameTranslatedText:function(){return this.translate("TagManager_TagsNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_TagsDescriptionDescription")},typeTranslatedText:function(){return this.translate("TagManager_TagsTypeDescription")},triggersTranslatedText:function(){return this.translate("TagManager_TagsTriggersDescription")},lastUpdatedTranslatedText:function(){return this.translate("TagManager_TagsLastUpdatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_TagsActionDescription")},getActionClasses:function(){var e=this.hasPublishCapability()?" hasCopyAction":"";return"action".concat(e)}}});yl.render=gl;var Vl=yl,Cl={class:"manageTag"},Nl={key:0},El={key:1};function Sl(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TagList"),c=Object(r["resolveComponent"])("TagEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Cl,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Nl,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"tags-help-text":e.tagsHelpText},null,8,["id-container","id-container-version","tags-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",El,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion,"id-tag":e.idTag},null,8,["id-container","id-container-version","id-tag"])])):Object(r["createCommentVNode"])("",!0)])}var wl=Object(r["defineComponent"])({props:{idContainerVersion:Number,idContainer:String,tagsHelpText:String},components:{TagList:Vl,TagEdit:So},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idTag}),(function(t){e.onIdTagParamChange(t)})),u["NotificationsStore"].remove("tagtagmanagement"),this.onIdTagParamChange(u["MatomoUrl"].hashParsed.value.idTag)},methods:{onIdTagParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddTag",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idTag:function(){var e=u["MatomoUrl"].hashParsed.value.idTag;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idTag}}});wl.render=Sl;var kl=wl,Ml={class:"editVersion tagManagerManageEdit"},_l={class:"loadingPiwik"},Dl=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Al={class:"loadingPiwik"},xl=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Bl={key:0},Ll={key:0},Ul={key:1},Pl=["innerHTML"],Il={key:2,class:"versionChanges"},Fl={key:0},Hl={colspan:"4"},Gl={key:1},$l={colspan:"4"},Rl={class:"lastUpdated"},ql={class:"entityCancel"};function zl(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("SaveButton"),s=Object(r["resolveComponent"])("ActivityIndicator"),d=Object(r["resolveComponent"])("ContentBlock"),u=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ml,[Object(r["createVNode"])(d,{feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){var n;return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",_l,[Dl,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Al,[xl,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[6]||(t[6]=function(t){return e.edit?e.updateVersion():e.createVersion()})},[Object(r["createElementVNode"])("div",null,[e.hasPublishCapability()||e.hasWriteCapability()&&e.hasPublishToLiveCapability()?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Bl,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","inline-help":e.versionNameHelpText,"inline-help-bind":{lastVersion:e.lastVersion},"model-value":e.version.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.version.name=t,e.setValueHasChanged()}),maxlength:30,title:e.translate("TagManager_VersionName"),placeholder:e.translate("TagManager_VersionNamePlaceholder")},null,8,["inline-help","inline-help-bind","model-value","title","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.version.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.version.description=t,e.setValueHasChanged()}),title:e.translate("TagManager_VersionDescriptionOptional"),"inline-help":e.translate("TagManager_VersionDescriptionHelp"),placeholder:e.translate("TagManager_VersionDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createVNode"])(c,{class:"createButton no-publish",onConfirm:t[2]||(t[2]=function(t){return e.edit?e.updateVersion():e.createVersion()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateVersionWithoutPublishing")},null,8,["disabled","saving","value"]),e.create&&e.environments.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ll,[Object(r["createVNode"])(l,{uicontrol:"select",name:"environment","inline-help":e.selectTagManagerEnvironmentHelp,"inline-help-bind":{canPublishToLive:e.canPublishToLive},"model-value":null===(n=e.version.environments)||void 0===n?void 0:n[0],"onUpdate:modelValue":t[3]||(t[3]=function(t){e.version.environments[0]=t,e.setValueHasChanged()}),options:e.environments,introduction:e.translate("TagManager_OrCreateAndPublishVersion"),title:e.translate("TagManager_Environment")},null,8,["inline-help","inline-help-bind","model-value","options","introduction","title"])])):Object(r["createCommentVNode"])("",!0),e.create&&e.environments.length?(Object(r["openBlock"])(),Object(r["createBlock"])(c,{key:1,class:"publishButton",onConfirm:t[4]||(t[4]=function(t){return e.createVersionAndPublish()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.translate("TagManager_CreateVersionAndPublishRelease")},null,8,["disabled","saving","value"])):Object(r["createCommentVNode"])("",!0)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ul,[Object(r["createElementVNode"])("div",{class:"alert alert-warning",innerHTML:e.$sanitize(e.showNoAccessErrorMessage)},null,8,Pl)])),e.lastVersion?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Il,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("TagManager_ChangesSinceLastVersion"))+":",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SitesManager_Type")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("TagManager_Change")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("TagManager_LastUpdated")),1)])]),Object(r["createElementVNode"])("tbody",null,[e.isLoadingVersionChanges?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Fl,[Object(r["createElementVNode"])("td",Hl,[Object(r["createVNode"])(s,{"loading-message":e.translate("TagManager_DetectingChanges"),loading:!0},null,8,["loading-message"])])])):Object(r["createCommentVNode"])("",!0),e.versionChanges.length||e.isLoadingVersionChanges?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Gl,[Object(r["createElementVNode"])("td",$l,Object(r["toDisplayString"])(e.translate("UserCountryMap_None")),1)])),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.versionChanges,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:n},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.translate(t.entityType)),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.translate(t.type)),1),Object(r["createElementVNode"])("td",Rl,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.lastChanged),1)])])})),128))])],512),[[u]])])):Object(r["createCommentVNode"])("",!0),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",ql,[Object(r["createElementVNode"])("a",{onClick:t[5]||(t[5]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)],512),[[r["vShow"],!e.isEmbedded]])])],32)]})),_:1},8,["content-title"])])}function Wl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xl(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,a=new Array(t);ne.length)&&(t=e.length);for(var n=0,a=new Array(t);n".concat(e.lastVersion,"")))},null,8,Nc),[[r["vShow"],e.lastVersion]])])}var Sc=Object(r["defineComponent"])({props:{lastVersion:String}});Sc.render=Ec;var kc=Sc,wc={id:"selectTagManagerEnvironmentHelp",class:"inline-help-node"};function Mc(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",wc,[Object(r["createElementVNode"])("div",null,Object(r["toDisplayString"])(e.translate("TagManager_VersionEnvironmentHelp")),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-info",style:{"margin-bottom":"0","padding-bottom":"0"}},Object(r["toDisplayString"])(e.translate("TagManager_PublishLiveEnvironmentCapabilityRequired",e.translate("TagManager_CapabilityPublishLiveContainer"))),513),[[r["vShow"],!e.canPublishToLive]])])}var _c=Object(r["defineComponent"])({props:{canPublishToLive:Boolean}});_c.render=Mc;var Dc=_c;function Ac(e){return Uc(e)||Lc(e)||Bc(e)||xc()}function xc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Bc(e,t){if(e){if("string"===typeof e)return Pc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pc(e,t):void 0}}function Lc(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Uc(e){if(Array.isArray(e))return Pc(e)}function Pc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n=n.length-1||t.idcontainerversion===e.idContainerVersion&&n[i+1]&&(e.lastVersion=u["Matomo"].helper.htmlEntities(n[i+1].name),a=n[i+1].idcontainerversion)})),e.lastVersion&&(e.isLoadingVersionChanges=!0,sc(e.idContainer,e.idContainerVersion,a).then((function(t){t.sort((function(e,t){return new Date(t.lastChanged).valueOf()-new Date(e.lastChanged).valueOf()})),e.versionChanges=t,e.isLoadingVersionChanges=!1})),e.create&&!e.version.name&&/^\d+$/.test(e.lastVersion)&&(e.version.name="".concat(parseInt(e.lastVersion,10)+1),e.isDirty=!0))}})),u["Matomo"].helper.lazyScrollToContent(),this.edit&&this.idContainerVersion)Tc.findVersion(this.idContainer,this.idContainerVersion).then((function(t){t&&(e.version=Object(u["clone"])(t),e.isDirty=!1)}));else if(this.create){if(this.version={idSite:u["Matomo"].idSite,idcontainer:this.idContainer,name:"",description:""},this.canPublishToLive)this.version.environments=["live"];else{var t=this.environments.find((function(e){return"live"!==e.key}));this.version.environments=t?[t.key]:[]}this.isDirty=!1}},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idContainerVersion,u["MatomoUrl"].updateHash(e)},createVersion:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,Tc.createOrUpdateVersion(this.version,"TagManager.createContainerVersion",this.idContainer).then((function(t){if(t){e.isDirty=!1;var n=t.value;if(e.isEmbedded)return e.version.idcontainerversion=n,void e.$emit("changeVersion",{version:e.version});Tc.reload(e.idContainer).then((function(){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainerVersion:n})),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Version")),n="";e.hasPublishCapability()&&(n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(t," ").concat(n),"success")}),200)}))}})).finally((function(){e.isUpdatingVersion=!1})))},createVersionAndPublish:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,Tc.createOrUpdateVersion(this.version,"TagManager.createContainerVersion",this.idContainer).then((function(t){if(!t)return null;var n=t.value;return e.version.idcontainerversion=n,Tc.publishVersion(e.idContainer,n,e.version.environments[0]).then((function(){e.isDirty=!1,e.isEmbedded?e.$emit("changeVersion",{version:e.version}):Tc.reload(e.idContainer).then((function(){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainerVersion:n})),setTimeout((function(){e.showNotification(Object(u["translate"])("TagManager_VersionPublishSuccess"),"success")}),200)}))}))})).finally((function(){e.isUpdatingVersion=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateVersion:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,Tc.createOrUpdateVersion(this.version,"TagManager.updateContainerVersion",this.idContainer).then((function(t){t&&(e.isEmbedded?e.$emit("changeVersion",{version:e.version}):(e.isDirty=!1,e.version={},Tc.reload(e.idContainer).then((function(){e.initIdContainerVersion()})),e.showNotification(Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Version")),"success")))})).finally((function(){e.isUpdatingVersion=!1})))},checkRequiredFieldsAreSet:function(){if(!this.version.name){var e=Object(u["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}return!0},hasPublishCapability:function(){return this.hasWriteCapability()&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},hasWriteCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")},hasPublishToLiveCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")}},computed:{create:function(){return 0===this.idContainerVersion},edit:function(){return!this.create},isLoading:function(){return ft.isLoading.value||Vt.isLoading.value},isUpdating:function(){return ft.isUpdating.value||this.isUpdatingVersion},environments:function(){var e=Zl.environmentsWithPublishOptions.value;if(!this.canPublishToLive){var t=e.findIndex((function(e){return"live"===e.key}));t>-1&&(e[t].disabled=!0)}return e},canPublishToLive:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")},versionNameHelpText:function(){return Object(r["markRaw"])(kc)},selectTagManagerEnvironmentHelp:function(){return Object(r["markRaw"])(Dc)},editTitle:function(){return this.create?Object(u["translate"])("TagManager_CreateNewVersion"):Object(u["translate"])("TagManager_EditVersion")},showNoAccessErrorMessage:function(){return Object(u["translate"])("TagManager_VersionEditWithNoAccessMessage",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/faq_26547/"),"")}}});Fc.render=zl;var Hc=Fc,Gc={class:"tagManagerManageList tagManagerVersionList"},$c={class:"versionSearchFilter"},Rc=["title"],qc=["title"],zc=["title"],Wc=["title"],Xc=["title"],Kc=["title"],Jc={colspan:"7"},Yc={class:"loadingPiwik"},Zc=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Qc={colspan:"7"},es=["id"],ts={class:"index"},ns=["title"],as=["title"],is={class:"environments"},rs=["title"],os={class:"created"},ls={class:"action"},cs=["onClick","title"],ss=["onClick","title"],ds=["onClick","href","title"],us=["onClick","title"],gs=["onClick","title"],ms={class:"tableActionBar"},bs=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),ps=["href"],hs=Object(r["createElementVNode"])("span",{class:"icon-export"}," ",-1),fs=Object(r["createElementVNode"])("span",{class:"icon-upload"}," ",-1),vs={class:"ui-confirm",id:"confirmDeleteVersion",ref:"confirmDeleteVersion"},js=["value"],Os=["value"],Ts={class:"ui-confirm",id:"confirmPublishVersion",ref:"confirmPublishVersion"},ys={key:0,class:"alert alert-info",style:{"margin-top":"16px"}},Vs=["value"],Cs=["value"];function Ns(e,t,n,a,i,o){var l,c=Object(r["resolveComponent"])("Field"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Gc,[Object(r["createVNode"])(s,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Versions")),"help-text":e.versionsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VersionUsageBenefits"))+" "+Object(r["toDisplayString"])(e.translate("TagManager_ConfigureEnvironmentsSuperUser")),1),Object(r["createElementVNode"])("div",$c,[Object(r["withDirectives"])(Object(r["createVNode"])(c,{uicontrol:"text",name:"versionSearch",title:e.translate("General_Search"),modelValue:e.versionSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.versionSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.versions.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"index",title:e.revisionTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Revision")),9,Rc),Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,qc),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,zc),Object(r["createElementVNode"])("th",{class:"environments",title:e.environmentTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Environments")),9,Wc),Object(r["createElementVNode"])("th",{class:"created",title:e.createdTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Created")),9,Xc),Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,Kc)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Jc,[Object(r["createElementVNode"])("span",Yc,[Zc,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Qc,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoVersionsFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerVersionNow",onClick:t[1]||(t[1]=function(t){return e.createVersion()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersionNow")),513),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])],512),[[r["vShow"],!e.isLoading&&0===e.versions.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVersions,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"version".concat(t.idcontainerversion),class:"versions",key:t.revision},[Object(r["createElementVNode"])("td",ts,Object(r["toDisplayString"])(t.revision),1),Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,ns),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,as),Object(r["createElementVNode"])("td",is,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.releases,(function(n,a){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:a,title:e.translate("TagManager_ReleaseInfo",n.release_login,n.release_date_pretty)},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.ucfirst(n.environment)),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,", ",512),[[r["vShow"],a!==t.releases.length-1]])],8,rs)})),128))]),Object(r["createElementVNode"])("td",os,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.created_date_pretty),1)]),Object(r["createElementVNode"])("td",ls,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-rocket",onClick:function(n){return e.publishVersion(t)},title:e.translate("TagManager_PublishVersion",t.name)},null,8,cs),[[r["vShow"],e.hasWriteAccess&&(e.hasCustomTemplatesCapability||e.canPublishToLive)]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-bug",onClick:function(n){return e.enableDebugMode(t.idcontainerversion)},title:e.translate("TagManager_EnablePreviewDebug")},null,8,ss),[[r["vShow"],e.hasWriteAccess]]),Object(r["createElementVNode"])("a",{target:"_blank",class:"table-action icon-export",onClick:Object(r["withModifiers"])((function(n){e.exportVersion(t.idcontainerversion,t.name)}),["prevent"]),href:e.getExportUrl(t),title:e.translate("TagManager_ExportX",e.translate("TagManager_Version"))},null,8,ds),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editVersion(t.idcontainerversion)},title:e.translate("TagManager_EditX",e.translate("TagManager_Version"))},null,8,us),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteVersion(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Version"))},null,8,gs),[[r["vShow"],0===t.releases.length&&e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])],8,es)})),128))])],512),[[d]]),Object(r["createElementVNode"])("div",ms,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createNewVersion",onClick:t[2]||(t[2]=function(t){return e.createVersion()})},[bs,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersion")),1)],512),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]]),Object(r["createElementVNode"])("a",{class:"exportDraft",target:"_blank",onClick:t[3]||(t[3]=function(t){e.exportVersion(null,"draft"),t.preventDefault()}),href:e.getExportDraftUrl()},[hs,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_ExportDraft")),1)],8,ps),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"importVersion",onClick:t[4]||(t[4]=function(t){return e.importVersion()})},[fs,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Import")),1)],512),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",vs,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteVersionConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,js),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Os)],512),Object(r["createElementVNode"])("div",Ts,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_PublishVersion",null===(l=e.versionToBePublished)||void 0===l?void 0:l.name)),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{uicontrol:"select",name:"environment",modelValue:e.availableEnvironmentsToPublish.deployEnvironment,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.availableEnvironmentsToPublish.deployEnvironment=t}),options:e.availableEnvironmentsToPublish.environnments,"full-width":!0,title:e.translate("TagManager_Environment")},null,8,["modelValue","options","title"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{style:{"margin-bottom":"0"},class:"alert alert-info"},Object(r["toDisplayString"])(e.translate("TagManager_PublishLiveEnvironmentCapabilityRequired",e.translate("TagManager_CapabilityPublishLiveContainer"))),513),[[r["vShow"],!e.canPublishToLive]])],512),[[r["vShow"],e.availableEnvironmentsToPublish.environnments.length]]),e.availableEnvironmentsToPublish.environnments.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ys,Object(r["toDisplayString"])(e.translate("TagManager_VersionAlreadyPublishedToAllEnvironments")),1)),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("TagManager_PublishRelease")},null,8,Vs),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,Cs)],512)])}function Es(e){return Ms(e)||ws(e)||ks(e)||Ss()}function Ss(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ks(e,t){if(e){if("string"===typeof e)return _s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_s(e,t):void 0}}function ws(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Ms(e){if(Array.isArray(e))return _s(e)}function _s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.revision?0:1})),t},hasWriteAccess:function(){return u["Matomo"].hasUserCapability("tagmanager_write")},hasCustomTemplatesCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},canPublishToLive:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")},revisionTranslatedText:function(){return this.translate("TagManager_VersionsRevisionDescription")},nameTranslatedText:function(){return this.translate("TagManager_VersionsNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_VersionsDescriptionDescription")},environmentTranslatedText:function(){return this.translate("TagManager_VersionsEnvironmentsDescription")},createdTranslatedText:function(){return this.translate("TagManager_VersionsCreatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_VersionsActionDescription")}}});xs.render=Ns;var Bs=xs,Ls={class:"manageVersion"},Us={key:0},Ps={key:1};function Is(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("VersionList"),c=Object(r["resolveComponent"])("VersionEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ls,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Us,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"versions-help-text":e.versionsHelpText},null,8,["id-container","versions-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ps,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion},null,8,["id-container","id-container-version"])])):Object(r["createCommentVNode"])("",!0)])}var Fs=Object(r["defineComponent"])({props:{idContainer:String,versionsHelpText:String},components:{VersionList:Bs,VersionEdit:Hc},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idContainerVersion}),(function(t){e.onIdContainerVersionParamChange(t)})),u["NotificationsStore"].remove("versiontagmanagement"),this.onIdContainerVersionParamChange(u["MatomoUrl"].hashParsed.value.idContainerVersion)},methods:{onIdContainerVersionParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVersion",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idContainerVersion:function(){var e=u["MatomoUrl"].hashParsed.value.idContainerVersion;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idContainerVersion}}});Fs.render=Is;var Hs=Fs,Gs={class:"loadingPiwik"},$s=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Rs={class:"loadingPiwik"},qs=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),zs={class:"entityCancel"};function Ws(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("SaveButton"),s=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createBlock"])(s,{class:"editContainer tagManagerManageEdit",feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Gs,[$s,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Rs,[qs,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[8]||(t[8]=function(t){return e.edit?e.updateContainer():e.createContainer()})},[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"idcontainer","model-value":e.container.idcontainer,disabled:!0,title:e.translate("General_Id")},null,8,["model-value","title"]),[[r["vShow"],e.edit]])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"select",name:"context","model-value":e.container.context,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.container.context=t,e.setValueHasChanged()}),disabled:!0,options:e.contexts,title:e.translate("TagManager_Context"),"inline-help":e.translate("TagManager_ContainerContextHelp")},null,8,["model-value","options","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.container.name,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.container.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_ContainerNameHelp"),placeholder:e.translate("TagManager_ContainerNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.container.description,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.container.description=t,e.setValueHasChanged()}),title:e.translate("TagManager_Description"),"inline-help":e.translate("TagManager_ContainerDescriptionHelp"),placeholder:e.translate("TagManager_ContainerDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"ignoreGtmDataLayer","model-value":e.container.ignoreGtmDataLayer,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.container.ignoreGtmDataLayer=t,e.setValueHasChanged()}),title:e.translate("TagManager_IgnoreGtmDataLaterTitle"),"inline-help":e.translate("TagManager_IgnoreGtmDataLaterDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"activelySyncGtmDataLayer","model-value":e.container.activelySyncGtmDataLayer,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.container.activelySyncGtmDataLayer=t,e.setValueHasChanged()}),title:e.translate("TagManager_ActivelySyncGtmDataLayerTitle"),"inline-help":e.translate("TagManager_ActivelySyncGtmDataLayerDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"isTagFireLimitAllowedInPreviewMode","model-value":e.container.isTagFireLimitAllowedInPreviewMode,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.container.isTagFireLimitAllowedInPreviewMode=t,e.setValueHasChanged()}),title:e.translate("TagManager_TagFireLimitAllowedInPreviewModeTitle"),"inline-help":e.translate("TagManager_TagFireLimitAllowedInPreviewModeDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createVNode"])(c,{class:"createButton",onConfirm:t[6]||(t[6]=function(t){return e.edit?e.updateContainer():e.createContainer()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateNewContainer")},null,8,["disabled","saving","value"]),Object(r["createElementVNode"])("div",zs,[Object(r["createElementVNode"])("a",{onClick:t[7]||(t[7]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]})),_:1},8,["content-title"])}function Xs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ks(e,t){for(var n=0;n".concat(e.lastVersion,"")))},null,8,Nc),[[r["vShow"],e.lastVersion]])])}var Sc=Object(r["defineComponent"])({props:{lastVersion:String}});Sc.render=Ec;var wc=Sc,kc={id:"selectTagManagerEnvironmentHelp",class:"inline-help-node"};function Mc(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",kc,[Object(r["createElementVNode"])("div",null,Object(r["toDisplayString"])(e.translate("TagManager_VersionEnvironmentHelp")),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"alert alert-info",style:{"margin-bottom":"0","padding-bottom":"0"}},Object(r["toDisplayString"])(e.translate("TagManager_PublishLiveEnvironmentCapabilityRequired",e.translate("TagManager_CapabilityPublishLiveContainer"))),513),[[r["vShow"],!e.canPublishToLive]])])}var _c=Object(r["defineComponent"])({props:{canPublishToLive:Boolean}});_c.render=Mc;var Dc=_c;function Ac(e){return Uc(e)||Lc(e)||Bc(e)||xc()}function xc(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Bc(e,t){if(e){if("string"===typeof e)return Pc(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pc(e,t):void 0}}function Lc(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Uc(e){if(Array.isArray(e))return Pc(e)}function Pc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n=n.length-1||t.idcontainerversion===e.idContainerVersion&&n[i+1]&&(e.lastVersion=u["Matomo"].helper.htmlEntities(n[i+1].name),a=n[i+1].idcontainerversion)})),e.lastVersion&&(e.isLoadingVersionChanges=!0,sc(e.idContainer,e.idContainerVersion,a).then((function(t){t.sort((function(e,t){return new Date(t.lastChanged).valueOf()-new Date(e.lastChanged).valueOf()})),e.versionChanges=t,e.isLoadingVersionChanges=!1})),e.create&&!e.version.name&&/^\d+$/.test(e.lastVersion)&&(e.version.name="".concat(parseInt(e.lastVersion,10)+1),e.isDirty=!0))}})),u["Matomo"].helper.lazyScrollToContent(),this.edit&&this.idContainerVersion)Tc.findVersion(this.idContainer,this.idContainerVersion).then((function(t){t&&(e.version=Object(u["clone"])(t),e.isDirty=!1)}));else if(this.create){if(this.version={idSite:u["Matomo"].idSite,idcontainer:this.idContainer,name:"",description:""},this.canPublishToLive)this.version.environments=["live"];else{var t=this.environments.find((function(e){return"live"!==e.key}));this.version.environments=t?[t.key]:[]}this.isDirty=!1}},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idContainerVersion,u["MatomoUrl"].updateHash(e)},createVersion:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,Tc.createOrUpdateVersion(this.version,"TagManager.createContainerVersion",this.idContainer).then((function(t){if(t){e.isDirty=!1;var n=t.value;if(e.isEmbedded)return e.version.idcontainerversion=n,void e.$emit("changeVersion",{version:e.version});Tc.reload(e.idContainer).then((function(){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainerVersion:n})),setTimeout((function(){var t=Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Version")),n="";e.hasPublishCapability()&&(n=Object(u["translate"])("TagManager_WantToDeployThisChangeCreateVersion",'',"")),e.showNotification("".concat(t," ").concat(n),"success")}),200)}))}})).finally((function(){e.isUpdatingVersion=!1})))},createVersionAndPublish:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,Tc.createOrUpdateVersion(this.version,"TagManager.createContainerVersion",this.idContainer).then((function(t){if(!t)return null;var n=t.value;return e.version.idcontainerversion=n,Tc.publishVersion(e.idContainer,n,e.version.environments[0]).then((function(){e.isDirty=!1,e.isEmbedded?e.$emit("changeVersion",{version:e.version}):Tc.reload(e.idContainer).then((function(){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainerVersion:n})),setTimeout((function(){e.showNotification(Object(u["translate"])("TagManager_VersionPublishSuccess"),"success")}),200)}))}))})).finally((function(){e.isUpdatingVersion=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateVersion:function(){var e=this;this.removeAnyVersionNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,Tc.createOrUpdateVersion(this.version,"TagManager.updateContainerVersion",this.idContainer).then((function(t){t&&(e.isEmbedded?e.$emit("changeVersion",{version:e.version}):(e.isDirty=!1,e.version={},Tc.reload(e.idContainer).then((function(){e.initIdContainerVersion()})),e.showNotification(Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Version")),"success")))})).finally((function(){e.isUpdatingVersion=!1})))},checkRequiredFieldsAreSet:function(){if(!this.version.name){var e=Object(u["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}return!0},hasPublishCapability:function(){return this.hasWriteCapability()&&u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},hasWriteCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_write")},hasPublishToLiveCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")}},computed:{create:function(){return 0===this.idContainerVersion},edit:function(){return!this.create},isLoading:function(){return ft.isLoading.value||Vt.isLoading.value},isUpdating:function(){return ft.isUpdating.value||this.isUpdatingVersion},environments:function(){var e=Zl.environmentsWithPublishOptions.value;if(!this.canPublishToLive){var t=e.findIndex((function(e){return"live"===e.key}));t>-1&&(e[t].disabled=!0)}return e},canPublishToLive:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")},versionNameHelpText:function(){return Object(r["markRaw"])(wc)},selectTagManagerEnvironmentHelp:function(){return Object(r["markRaw"])(Dc)},editTitle:function(){return this.create?Object(u["translate"])("TagManager_CreateNewVersion"):Object(u["translate"])("TagManager_EditVersion")},showNoAccessErrorMessage:function(){return Object(u["translate"])("TagManager_VersionEditWithNoAccessMessage",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/faq_26547/"),"")}}});Fc.render=zl;var Hc=Fc,Gc={class:"tagManagerManageList tagManagerVersionList"},$c={class:"versionSearchFilter"},Rc=["title"],qc=["title"],zc=["title"],Wc=["title"],Xc=["title"],Kc=["title"],Jc={colspan:"7"},Yc={class:"loadingPiwik"},Zc=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Qc={colspan:"7"},es=["id"],ts={class:"index"},ns=["title"],as=["title"],is={class:"environments"},rs=["title"],os={class:"created"},ls={class:"action"},cs=["onClick","title"],ss=["onClick","title"],ds=["onClick","href","title"],us=["onClick","title"],gs=["onClick","title"],bs={class:"tableActionBar"},ms=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),ps=["href"],hs=Object(r["createElementVNode"])("span",{class:"icon-export"}," ",-1),fs=Object(r["createElementVNode"])("span",{class:"icon-upload"}," ",-1),vs={class:"ui-confirm",id:"confirmDeleteVersion",ref:"confirmDeleteVersion"},js=["value"],Os=["value"],Ts={class:"ui-confirm",id:"confirmPublishVersion",ref:"confirmPublishVersion"},ys={key:0,class:"alert alert-info",style:{"margin-top":"16px"}},Vs=["value"],Cs=["value"];function Ns(e,t,n,a,i,o){var l,c=Object(r["resolveComponent"])("Field"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Gc,[Object(r["createVNode"])(s,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Versions")),"help-text":e.versionsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_VersionUsageBenefits"))+" "+Object(r["toDisplayString"])(e.translate("TagManager_ConfigureEnvironmentsSuperUser")),1),Object(r["createElementVNode"])("div",$c,[Object(r["withDirectives"])(Object(r["createVNode"])(c,{uicontrol:"text",name:"versionSearch",title:e.translate("General_Search"),modelValue:e.versionSearch,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.versionSearch=t})},null,8,["title","modelValue"]),[[r["vShow"],e.versions.length>0]])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",{class:"index",title:e.revisionTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Revision")),9,Rc),Object(r["createElementVNode"])("th",{class:"name",title:e.nameTranslatedText},Object(r["toDisplayString"])(e.translate("General_Name")),9,qc),Object(r["createElementVNode"])("th",{class:"description",title:e.descriptionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Description")),9,zc),Object(r["createElementVNode"])("th",{class:"environments",title:e.environmentTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Environments")),9,Wc),Object(r["createElementVNode"])("th",{class:"created",title:e.createdTranslatedText},Object(r["toDisplayString"])(e.translate("TagManager_Created")),9,Xc),Object(r["createElementVNode"])("th",{class:"action",title:e.actionTranslatedText},Object(r["toDisplayString"])(e.translate("General_Actions")),9,Kc)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Jc,[Object(r["createElementVNode"])("span",Yc,[Zc,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Qc,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoVersionsFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerVersionNow",onClick:t[1]||(t[1]=function(t){return e.createVersion()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersionNow")),513),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])],512),[[r["vShow"],!e.isLoading&&0===e.versions.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVersions,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"version".concat(t.idcontainerversion),class:"versions",key:t.revision},[Object(r["createElementVNode"])("td",ts,Object(r["toDisplayString"])(t.revision),1),Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,ns),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,as),Object(r["createElementVNode"])("td",is,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(t.releases,(function(n,a){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:a,title:e.translate("TagManager_ReleaseInfo",n.release_login,n.release_date_pretty)},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.ucfirst(n.environment)),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,", ",512),[[r["vShow"],a!==t.releases.length-1]])],8,rs)})),128))]),Object(r["createElementVNode"])("td",os,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.created_date_pretty),1)]),Object(r["createElementVNode"])("td",ls,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-rocket",onClick:function(n){return e.publishVersion(t)},title:e.translate("TagManager_PublishVersion",t.name)},null,8,cs),[[r["vShow"],e.hasWriteAccess&&(e.hasCustomTemplatesCapability||e.canPublishToLive)]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-bug",onClick:function(n){return e.enableDebugMode(t.idcontainerversion)},title:e.translate("TagManager_EnablePreviewDebug")},null,8,ss),[[r["vShow"],e.hasWriteAccess]]),Object(r["createElementVNode"])("a",{target:"_blank",class:"table-action icon-export",onClick:Object(r["withModifiers"])((function(n){e.exportVersion(t.idcontainerversion,t.name)}),["prevent"]),href:e.getExportUrl(t),title:e.translate("TagManager_ExportX",e.translate("TagManager_Version"))},null,8,ds),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editVersion(t.idcontainerversion)},title:e.translate("TagManager_EditX",e.translate("TagManager_Version"))},null,8,us),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteVersion(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Version"))},null,8,gs),[[r["vShow"],0===t.releases.length&&e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])],8,es)})),128))])],512),[[d]]),Object(r["createElementVNode"])("div",bs,[Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createNewVersion",onClick:t[2]||(t[2]=function(t){return e.createVersion()})},[ms,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersion")),1)],512),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]]),Object(r["createElementVNode"])("a",{class:"exportDraft",target:"_blank",onClick:t[3]||(t[3]=function(t){e.exportVersion(null,"draft"),t.preventDefault()}),href:e.getExportDraftUrl()},[hs,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_ExportDraft")),1)],8,ps),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"importVersion",onClick:t[4]||(t[4]=function(t){return e.importVersion()})},[fs,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Import")),1)],512),[[r["vShow"],e.hasWriteAccess&&e.hasCustomTemplatesCapability]])])]})),_:1},8,["content-title","help-text"]),Object(r["createElementVNode"])("div",vs,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteVersionConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,js),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Os)],512),Object(r["createElementVNode"])("div",Ts,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_PublishVersion",null===(l=e.versionToBePublished)||void 0===l?void 0:l.name)),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{uicontrol:"select",name:"environment",modelValue:e.availableEnvironmentsToPublish.deployEnvironment,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.availableEnvironmentsToPublish.deployEnvironment=t}),options:e.availableEnvironmentsToPublish.environnments,"full-width":!0,title:e.translate("TagManager_Environment")},null,8,["modelValue","options","title"])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{style:{"margin-bottom":"0"},class:"alert alert-info"},Object(r["toDisplayString"])(e.translate("TagManager_PublishLiveEnvironmentCapabilityRequired",e.translate("TagManager_CapabilityPublishLiveContainer"))),513),[[r["vShow"],!e.canPublishToLive]])],512),[[r["vShow"],e.availableEnvironmentsToPublish.environnments.length]]),e.availableEnvironmentsToPublish.environnments.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ys,Object(r["toDisplayString"])(e.translate("TagManager_VersionAlreadyPublishedToAllEnvironments")),1)),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("TagManager_PublishRelease")},null,8,Vs),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_Cancel")},null,8,Cs)],512)])}function Es(e){return Ms(e)||ks(e)||ws(e)||Ss()}function Ss(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ws(e,t){if(e){if("string"===typeof e)return _s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_s(e,t):void 0}}function ks(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Ms(e){if(Array.isArray(e))return _s(e)}function _s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.revision?0:1})),t},hasWriteAccess:function(){return u["Matomo"].hasUserCapability("tagmanager_write")},hasCustomTemplatesCapability:function(){return u["Matomo"].hasUserCapability("tagmanager_use_custom_templates")},canPublishToLive:function(){return u["Matomo"].hasUserCapability("tagmanager_publish_live_container")},revisionTranslatedText:function(){return this.translate("TagManager_VersionsRevisionDescription")},nameTranslatedText:function(){return this.translate("TagManager_VersionsNameDescription")},descriptionTranslatedText:function(){return this.translate("TagManager_VersionsDescriptionDescription")},environmentTranslatedText:function(){return this.translate("TagManager_VersionsEnvironmentsDescription")},createdTranslatedText:function(){return this.translate("TagManager_VersionsCreatedDescription")},actionTranslatedText:function(){return this.translate("TagManager_VersionsActionDescription")}}});xs.render=Ns;var Bs=xs,Ls={class:"manageVersion"},Us={key:0},Ps={key:1};function Is(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("VersionList"),c=Object(r["resolveComponent"])("VersionEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ls,[e.editMode?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Us,[Object(r["createVNode"])(l,{"id-container":e.idContainer,"versions-help-text":e.versionsHelpText},null,8,["id-container","versions-help-text"])])),e.editMode?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ps,[Object(r["createVNode"])(c,{"id-container":e.idContainer,"id-container-version":e.idContainerVersion},null,8,["id-container","id-container-version"])])):Object(r["createCommentVNode"])("",!0)])}var Fs=Object(r["defineComponent"])({props:{idContainer:String,versionsHelpText:String},components:{VersionList:Bs,VersionEdit:Hc},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idContainerVersion}),(function(t){e.onIdContainerVersionParamChange(t)})),u["NotificationsStore"].remove("versiontagmanagement"),this.onIdContainerVersionParamChange(u["MatomoUrl"].hashParsed.value.idContainerVersion)},methods:{onIdContainerVersionParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVersion",t),this.isAddAllowed=!!t.isAllowed}}},computed:{idContainerVersion:function(){var e=u["MatomoUrl"].hashParsed.value.idContainerVersion;return this.isAddAllowed||"0"!==e?e?parseInt(e,10):e:null},editMode:function(){return"number"===typeof this.idContainerVersion}}});Fs.render=Is;var Hs=Fs,Gs={class:"loadingPiwik"},$s=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Rs={class:"loadingPiwik"},qs=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),zs={class:"entityCancel"};function Ws(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("SaveButton"),s=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createBlock"])(s,{class:"editContainer tagManagerManageEdit",feature:"Tag Manager","content-title":e.editTitle},{default:Object(r["withCtx"])((function(){return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Gs,[$s,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Rs,[qs,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[8]||(t[8]=function(t){return e.edit?e.updateContainer():e.createContainer()})},[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createVNode"])(l,{uicontrol:"text",name:"idcontainer","model-value":e.container.idcontainer,disabled:!0,title:e.translate("General_Id")},null,8,["model-value","title"]),[[r["vShow"],e.edit]])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"select",name:"context","model-value":e.container.context,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.container.context=t,e.setValueHasChanged()}),disabled:!0,options:e.contexts,title:e.translate("TagManager_Context"),"inline-help":e.translate("TagManager_ContainerContextHelp")},null,8,["model-value","options","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"text",name:"name","model-value":e.container.name,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.container.name=t,e.setValueHasChanged()}),maxlength:255,title:e.translate("General_Name"),"inline-help":e.translate("TagManager_ContainerNameHelp"),placeholder:e.translate("TagManager_ContainerNamePlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"textarea",name:"description","model-value":e.container.description,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.container.description=t,e.setValueHasChanged()}),title:e.translate("TagManager_Description"),"inline-help":e.translate("TagManager_ContainerDescriptionHelp"),placeholder:e.translate("TagManager_ContainerDescriptionPlaceholder")},null,8,["model-value","title","inline-help","placeholder"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"ignoreGtmDataLayer","model-value":e.container.ignoreGtmDataLayer,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.container.ignoreGtmDataLayer=t,e.setValueHasChanged()}),title:e.translate("TagManager_IgnoreGtmDataLaterTitle"),"inline-help":e.translate("TagManager_IgnoreGtmDataLaterDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"activelySyncGtmDataLayer","model-value":e.container.activelySyncGtmDataLayer,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.container.activelySyncGtmDataLayer=t,e.setValueHasChanged()}),title:e.translate("TagManager_ActivelySyncGtmDataLayerTitle"),"inline-help":e.translate("TagManager_ActivelySyncGtmDataLayerDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"checkbox",name:"isTagFireLimitAllowedInPreviewMode","model-value":e.container.isTagFireLimitAllowedInPreviewMode,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.container.isTagFireLimitAllowedInPreviewMode=t,e.setValueHasChanged()}),title:e.translate("TagManager_TagFireLimitAllowedInPreviewModeTitle"),"inline-help":e.translate("TagManager_TagFireLimitAllowedInPreviewModeDescription")},null,8,["model-value","title","inline-help"])]),Object(r["createVNode"])(c,{class:"createButton",onConfirm:t[6]||(t[6]=function(t){return e.edit?e.updateContainer():e.createContainer()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.edit?e.translate("CoreUpdater_UpdateTitle"):e.translate("TagManager_CreateNewContainer")},null,8,["disabled","saving","value"]),Object(r["createElementVNode"])("div",zs,[Object(r["createElementVNode"])("a",{onClick:t[7]||(t[7]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]})),_:1},8,["content-title"])}function Xs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ks(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.created_date?-1:0})),e},getManageContainersIntro:function(){var e=Object(u["externalLink"])("https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/");return Object(u["translate"])("TagManager_ManageContainersIntro",e,"")},canCopyContainer:function(){return this.isSuperUser},getActionClasses:function(){var e=this.canCopyContainer?" hasCopyAction":"";return"action".concat(e)}},methods:{createContainer:function(){this.editContainer("0")},editContainer:function(e){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainer:e}))},installCode:function(e){Kd.showInstallCode(e)},deleteContainer:function(e){function t(){ud.deleteContainer(e.idcontainer).then((function(){ud.reload()}))}u["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteContainer,{yes:t})},truncateText:function(e,t){return e.length>t?"".concat(e.substr(0,t-3),"..."):e},openCopyDialog:function(e){var t=u["MatomoUrl"].stringify({module:"TagManager",action:"copyContainerDialog",idSite:e.idsite,idContainer:e.idcontainer});window.Piwik_Popover.createPopupAndLoadUrl(t,"","mtmCopyContainer")}}});Jd.render=Hd;var Yd=Jd,Zd={class:"manageContainer"};function Qd(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ContainerList"),c=Object(r["resolveComponent"])("ContainerEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Zd,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"is-super-user":e.isSuperUser},null,8,["is-super-user"])],512),[[r["vShow"],!e.editMode]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"id-container":e.idContainer},null,8,["id-container"])],512),[[r["vShow"],e.editMode]])])}var eu=Object(r["defineComponent"])({props:{isSuperUser:{type:Boolean,required:!0}},components:{ContainerList:Yd,ContainerEdit:bd},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idContainer}),(function(t){e.onIdContainerParamChange(t)})),u["NotificationsStore"].remove("containertagmanagement"),this.onIdContainerParamChange(u["MatomoUrl"].hashParsed.value.idContainer)},computed:{idContainer:function(){var e=u["MatomoUrl"].hashParsed.value.idContainer;return this.isAddAllowed||""!==e?e:null},editMode:function(){return!!this.idContainer}},methods:{onIdContainerParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVersion",t),this.isAddAllowed=!!t.isAllowed}}}});eu.render=Qd;var tu=eu,nu={class:"containerDashboard"},au={key:0},iu={class:"dashboardCreationDate"},ru={key:0},ou=Object(r["createElementVNode"])("br",null,null,-1),lu=["innerHTML"],cu={class:"row",style:{"margin-left":"-0.75rem"}},su={class:"col m6 s12"},du={key:0},uu=["href","title"],gu={key:0},mu=Object(r["createElementVNode"])("hr",null,null,-1),bu=["href"],pu=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),hu=["href"],fu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),vu={class:"col m6 s12"},ju={key:0},Ou=["href","title"],Tu=Object(r["createElementVNode"])("hr",null,null,-1),yu=["href"],Vu=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),Cu=["href"],Nu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Eu={class:"row",style:{"margin-left":"-0.75rem"}},Su={class:"col m6 s12"},ku=["href","title"],wu={key:0},Mu=Object(r["createElementVNode"])("hr",null,null,-1),_u=["href"],Du=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),Au=["href"],xu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Bu={class:"col m6 s12"},Lu=["title","href"],Uu={key:0},Pu=Object(r["createElementVNode"])("br",null,null,-1),Iu=["title"],Fu={key:0},Hu=Object(r["createElementVNode"])("hr",null,null,-1),Gu=["href"],$u=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),Ru=["href"],qu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1);function zu(e,t,n,a,i,o){var l,c,s=Object(r["resolveComponent"])("ActivityIndicator"),d=Object(r["resolveComponent"])("EnrichedHeadline"),u=Object(r["resolveComponent"])("ContentBlock"),g=Object(r["resolveDirective"])("content-intro");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",nu,[Object(r["createVNode"])(s,{loading:e.isLoading},null,8,["loading"]),e.isLoading?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",au,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("h2",null,[Object(r["createVNode"])(d,{"feature-name":"Tag Manager","inline-help":e.dashboardHelpText},{default:Object(r["withCtx"])((function(){var t;return[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_ContainerX",null===(t=e.container)||void 0===t?void 0:t.name)),1)]})),_:1},8,["inline-help"])]),Object(r["createElementVNode"])("p",iu,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.containerMetaInformation)+" ",1),null!==(l=e.containerVersion)&&void 0!==l&&l.description?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",ru,[ou,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_Description"))+": "+Object(r["toDisplayString"])(null===(c=e.containerVersion)||void 0===c?void 0:c.description),1)])):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.containerDashboardDescription)},null,8,lu)],512),[[g]]),Object(r["createElementVNode"])("div",cu,[Object(r["createElementVNode"])("div",su,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.tagCount," ").concat(e.translate("TagManager_Tags")),"help-text":e.tagsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[e.tagCount?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",du,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedContainerVersionTags,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageTags",{idTag:t.idtag}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,uu),n!==e.sortedContainerVersionTags.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",gu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))])):Object(r["createCommentVNode"])("",!0)]),mu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTags")},[pu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditTags")),1)],8,bu),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTags",{idTag:0})},[fu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTag")),1)],8,hu)]})),_:1},8,["content-title","help-text"])]),Object(r["createElementVNode"])("div",vu,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.triggerCount," ").concat(e.translate("TagManager_Triggers")),"help-text":e.triggersHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[e.triggerCount?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",ju,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTriggers,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageTriggers",{idTrigger:t.idtrigger}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,Ou),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,", ",512),[[r["vShow"],n!==e.sortedTriggers.length-1]])])})),128))])):Object(r["createCommentVNode"])("",!0)]),Tu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTriggers")},[Vu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditTriggers")),1)],8,yu),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTriggers",{idTrigger:0})},[Nu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTrigger")),1)],8,Cu)]})),_:1},8,["content-title","help-text"])])]),Object(r["createElementVNode"])("div",Eu,[Object(r["createElementVNode"])("div",Su,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.variableCount," ").concat(e.translate("TagManager_Variables")),"help-text":e.variablesHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVariables,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageVariables",{idVariable:t.idvariable}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,ku),n!==e.sortedVariables.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",wu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.variableCount]])]),Mu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVariables")},[Du,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditVariables")),1)],8,_u),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVariables",{idVariable:0})},[xu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)],8,Au)]})),_:1},8,["content-title","help-text"])]),Object(r["createElementVNode"])("div",Bu,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.versionCount," ").concat(e.translate("TagManager_Versions")),"help-text":e.versionsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_LastVersions"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.lastVersions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{title:e.lastVersionLinkTitle(t),href:e.linkTo("manageVersions",{idContainerVersion:t.idcontainerversion})},Object(r["toDisplayString"])(t.name),9,Lu),n!==e.lastVersions.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Uu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.lastVersions.length]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Pu,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_Environments"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.container.releases,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("span",{title:e.releaseTooltip(t)},Object(r["toDisplayString"])(e.ucfirst(t.environment)),9,Iu),n!==e.container.releases.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Fu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.container.releases.length]])]),Hu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVersions")},[$u,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditVersions")),1)],8,Gu),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVersions",{idContainerVersion:0})},[qu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersion")),1)],8,Ru)]})),_:1},8,["content-title","help-text"])])])]))])}function Wu(e){e.sort((function(e,t){return e.namet.name?1:0}))}var Xu=Object(r["defineComponent"])({props:{idContainer:String,dashboardHelpText:String,tagsHelpText:String,triggersHelpText:String,variablesHelpText:String,versionsHelpText:String},components:{ActivityIndicator:u["ActivityIndicator"],EnrichedHeadline:u["EnrichedHeadline"],ContentBlock:u["ContentBlock"]},directives:{ContentIntro:u["ContentIntro"]},data:function(){return{container:null,containerVersion:null,isLoading:!1}},created:function(){var e=this;Qs.init(),this.isLoading=!0;var t=u["AjaxHelper"].fetch({method:"TagManager.getContainer",idContainer:this.idContainer}).then((function(t){e.container=t})),n=u["AjaxHelper"].fetch({method:"TagManager.exportContainerVersion",idContainer:this.idContainer}).then((function(t){e.containerVersion=t}));Promise.all([t,n]).finally((function(){e.isLoading=!1}))},methods:{linkTo:function(e,t){var n=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e}));return t&&(n+="#?".concat(u["MatomoUrl"].stringify(t))),"?".concat(n)},lastVersionLinkTitle:function(e){return"Created on ".concat(e.created_date_pretty)+", description: '".concat(e.description,"'")},releaseTooltip:function(e){var t=Object(u["translate"])("TagManager_ReleaseInfo",e.release_login,e.release_date_pretty),n=Object(u["translate"])("TagManager_ReleaseVersionInfo",e.version_name);return"".concat(t," ").concat(n)},ucfirst:function(e){return"".concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}},computed:{lastVersions:function(){var e,t;return null!==(e=this.container)&&void 0!==e&&null!==(t=e.versions)&&void 0!==t&&t.length?this.container.versions.slice(0,5):[]},contexts:function(){var e={};return Qs.contexts.value.forEach((function(t){var n=t.id,a=t.name;e[n]=a})),e},containerMetaInformation:function(){var e;return Object(u["translate"])("TagManager_ContainerIdInformation",(null===(e=this.containerVersion)||void 0===e?void 0:e.idcontainer)||"")},containerDashboardDescription:function(){return Object(u["translate"])("TagManager_ContainerDashboardDescription",'',"")},sortedContainerVersionTags:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.tags)||[];return Wu(t),t},sortedTriggers:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.triggers)||[];return Wu(t),t},sortedVariables:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.variables)||[];return Wu(t),t},tagCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.tags.length},triggerCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.triggers.length},versionCount:function(){var e;return null===(e=this.container)||void 0===e?void 0:e.versions.length},variableCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.variables.length}}});Xu.render=zu;var Ku=Xu,Ju=["title"],Yu={class:"title"},Zu=Object(r["createElementVNode"])("span",{class:"icon icon-chevron-down"}," ",-1),Qu={class:"dropdown positionInViewport"},eg={class:"custom_select_container"},tg={class:"custom_select_ul_list"},ng=["title"],ag=["href"];function ig(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ActivityIndicator"),c=Object(r["resolveDirective"])("focus-anywhere-but-here");return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["tagContainerSelector piwikSelector borderedControl",{expanded:e.showContainerList}]),onClick:t[1]||(t[1]=function(t){e.fetchContainers(),e.showContainerList=!e.showContainerList}),title:e.translate("TagManager_ChooseContainer")},[Object(r["createElementVNode"])("a",Yu,[Zu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.truncateText(e.actualContainerName,50)),1)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Qu,[Object(r["createVNode"])(l,{loading:e.isLoading},null,8,["loading"]),Object(r["createElementVNode"])("div",eg,[Object(r["createElementVNode"])("ul",tg,[Object(r["withDirectives"])(Object(r["createElementVNode"])("li",null,[Object(r["createElementVNode"])("a",{tabindex:"-1",onClick:t[0]||(t[0]=Object(r["withModifiers"])((function(){}),["prevent","stop"]))},Object(r["toDisplayString"])(e.translate("TagManager_NoContainersFound")),1)],512),[[r["vShow"],!e.isLoading&&0===e.containers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.containers,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{title:"".concat(t.name," (").concat(t.idcontainer,")"),key:t.idcontainer},[Object(r["createElementVNode"])("a",{href:e.linkTo(t.idcontainer)},Object(r["toDisplayString"])(t.name)+" ("+Object(r["toDisplayString"])(t.idcontainer)+") ",9,ag)],8,ng)})),128))])])],512),[[r["vShow"],e.showContainerList]])],10,Ju)),[[c,{blur:e.onBlur}]])}var rg=window,og=rg.tagManagerHelper,lg=Object(r["defineComponent"])({props:{containerName:String},components:{ActivityIndicator:u["ActivityIndicator"]},directives:{FocusAnywhereButHere:u["FocusAnywhereButHere"]},data:function(){return{containers:[],isLoading:!1,showContainerList:!1}},created:function(){setTimeout((function(){window.initTopControls()}))},methods:{fetchContainers:function(){var e=this;this.isLoading=!0,this.containers=[],u["AjaxHelper"].fetch({method:"TagManager.getContainers"}).then((function(t){e.containers=t})).finally((function(){e.isLoading=!1}))},linkTo:function(e){var t=u["MatomoUrl"].urlParsed.value.action;t&&"manageContainers"!==t||(t=this.hasWriteAccess?"dashboard":"manageTags");var n=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{idContainer:e,action:t}));return"".concat(window.location.pathname,"?").concat(n)},onBlur:function(){this.showContainerList=!1},truncateText:function(e,t){return og.truncateText(e,t)}},computed:{actualContainerName:function(){return this.containerName?Object(u["translate"])("TagManager_ContainerX",this.containerName):Object(u["translate"])("TagManager_ChooseContainer")},hasWriteAccess:function(){return u["Matomo"].hasUserCapability("tagmanager_write")}}});lg.render=ig;var cg=lg,sg={style:{"margin-left":"-0.75rem"}},dg=Object(r["createElementVNode"])("br",null,null,-1),ug=["href"],gg=["textContent"],mg={style:{"margin-top":"1rem"}},bg=["innerHTML"],pg=Object(r["createElementVNode"])("br",null,null,-1),hg=["href"],fg={class:"environment"},vg={class:"name"},jg={class:"name"},Og={class:"released_by"},Tg={class:"released_on"},yg={key:0},Vg={colspan:"7"},Cg={class:"loadingPiwik"},Ng=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Eg={key:1},Sg={colspan:"7"},kg={class:"environment"},wg={class:"name"},Mg={class:"revision"},_g={class:"released_by"},Dg={class:"released_on"},Ag={class:"date"};function xg(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ActivityIndicator"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("copy-to-clipboard"),u=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createBlock"])(s,{class:"manageInstallTagCode",feature:"Tag Manager","content-title":"Install Code"},{default:Object(r["withCtx"])((function(){var n,a;return[Object(r["createElementVNode"])("div",sg,[Object(r["createVNode"])(l,{uicontrol:"select",name:"environment","model-value":e.environment,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.environment=t,e.fetchInstallInstructions(e.environment)}),options:e.environments,title:e.translate("TagManager_Environment")},null,8,["model-value","options","title"])]),Object(r["createVNode"])(c,{loading:e.isLoading},null,8,["loading"]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n},[Object(r["createElementVNode"])("p",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.description)+" ",1),dg,t.helpUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,target:"_blank",href:t.helpUrl},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,ug)):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("div",null,[t.embedCode?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("pre",{key:0,textContent:Object(r["toDisplayString"])(t.embedCode)},null,8,gg)),[[d,{}]]):Object(r["createCommentVNode"])("",!0)])])})),128)),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_InstallCodePublishEnvironmentNote","preview"))+" "+Object(r["toDisplayString"])(e.translate("TagManager_ConfigureEnvironmentsSuperUser")),1),Object(r["createElementVNode"])("p",mg,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_InstallCodeDataLayerNote","",""))},null,8,bg),pg,Object(r["createElementVNode"])("a",{target:"_blank",href:e.externalRawLink("https://matomo.org/faq/tag-manager/data-layer-in-matomo-tag-manager/")},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,hg)]),Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_ReleasesOverview")),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",fg,Object(r["toDisplayString"])(e.translate("TagManager_Environment")),1),Object(r["createElementVNode"])("th",vg,Object(r["toDisplayString"])(e.translate("TagManager_VersionName")),1),Object(r["createElementVNode"])("th",jg,Object(r["toDisplayString"])(e.translate("TagManager_VersionRevision")),1),Object(r["createElementVNode"])("th",Og,Object(r["toDisplayString"])(e.translate("TagManager_ReleasedBy")),1),Object(r["createElementVNode"])("th",Tg,Object(r["toDisplayString"])(e.translate("TagManager_ReleasedOn")),1)])]),Object(r["createElementVNode"])("tbody",null,[e.isLoading?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",yg,[Object(r["createElementVNode"])("td",Vg,[Object(r["createElementVNode"])("span",Cg,[Ng,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])])):Object(r["createCommentVNode"])("",!0),e.isLoading||0!==(null===(n=e.container)||void 0===n||null===(a=n.releases)||void 0===a?void 0:a.length)?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Eg,[Object(r["createElementVNode"])("td",Sg,Object(r["toDisplayString"])(e.translate("TagManager_NoReleasesFound")),1)])),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedReleases,(function(t){var n,a;return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t.idcontainerrelease},[Object(r["createElementVNode"])("td",kg,Object(r["toDisplayString"])(e.ucfirst(t.environment)),1),Object(r["createElementVNode"])("td",wg,Object(r["toDisplayString"])(null===(n=e.releaseVersions[t.idcontainerrelease])||void 0===n?void 0:n.name),1),Object(r["createElementVNode"])("td",Mg,Object(r["toDisplayString"])(null===(a=e.releaseVersions[t.idcontainerrelease])||void 0===a?void 0:a.revision),1),Object(r["createElementVNode"])("td",_g,Object(r["toDisplayString"])(t.release_login),1),Object(r["createElementVNode"])("td",Dg,[Object(r["createElementVNode"])("span",Ag,Object(r["toDisplayString"])(t.release_date_pretty),1)])])})),128))])],512),[[u]])]})),_:1})}function Bg(e){return Pg(e)||Ug(e)||Hg(e)||Lg()}function Lg(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ug(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Pg(e){if(Array.isArray(e))return Gg(e)}function Ig(e,t){return Rg(e)||$g(e,t)||Hg(e,t)||Fg()}function Fg(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Hg(e,t){if(e){if("string"===typeof e)return Gg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gg(e,t):void 0}}function Gg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.release_date?-1:t.index-e.index})),t}}});Wg.render=xg;var Xg=Wg,Kg={class:"tagManagerTrackingCode"},Jg={key:0},Yg={class:"trackingCodeAdvancedOptions"},Zg={class:"advance-option"},Qg=Object(r["createElementVNode"])("span",{class:"icon-chevron-down"},null,-1),em=Object(r["createElementVNode"])("span",{class:"icon-chevron-up"},null,-1),tm={id:"mtm-advanced-options"},nm=["innerHTML"],am={key:1,class:"row"},im={class:"col s12 m4 "},rm={class:"form-group row"},om={class:"col s12 input-field"},lm={for:"tagManagerTrackingCodeSite",class:"siteSelectorLabel"},cm={class:"sites_autocomplete"},sm={class:"col s12 m4"},dm={class:"col s12 m4"},um=["innerHTML"],gm={key:1,class:"alert alert-info"},mm={href:""},bm={key:0},pm=["href"],hm=Object(r["createTextVNode"])(". "),fm=["innerHTML"],vm=["textContent"],jm=["innerHTML"],Om={key:1};function Tm(e,t,n,a,i,o){var l=this,c=Object(r["resolveComponent"])("ActivityIndicator"),s=Object(r["resolveComponent"])("SiteSelector"),d=Object(r["resolveComponent"])("Field"),u=Object(r["resolveDirective"])("copy-to-clipboard");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Kg,[e.showContainerRow?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",Jg,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_OptionallyCustomiseContainer"))+" ",1),Object(r["createElementVNode"])("div",Yg,[Object(r["createElementVNode"])("div",Zg,[Object(r["createElementVNode"])("span",null,[e.isAdvancedDisplayed?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,href:"javascript:;",onClick:t[0]||(t[0]=Object(r["withModifiers"])((function(t){return e.isAdvancedDisplayed=!0}),["prevent"]))},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("CoreAdminHome_ShowAdvancedOptions"))+" ",1),Qg])),e.isAdvancedDisplayed?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:1,href:"javascript:;",onClick:t[1]||(t[1]=Object(r["withModifiers"])((function(t){return e.isAdvancedDisplayed=!1}),["prevent"]))},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("CoreAdminHome_HideAdvancedOptions"))+" ",1),em])):Object(r["createCommentVNode"])("",!0)])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",tm,[Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.getAdvancedStepText)},null,8,nm),e.showContainerRow||e.environments.length>1?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createBlock"])(c,{key:0,loading:!0},null,512)),[[r["vShow"],e.isLoading]]):Object(r["createCommentVNode"])("",!0),e.showContainerRow||e.environments.length>1?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",am,[Object(r["createElementVNode"])("div",im,[Object(r["createElementVNode"])("div",rm,[Object(r["createElementVNode"])("div",om,[Object(r["createElementVNode"])("label",lm,Object(r["toDisplayString"])(e.translate("General_Website")),1),Object(r["createElementVNode"])("div",cm,[Object(r["createVNode"])(s,{id:"tagManagerTrackingCodeSite",modelValue:e.site,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.site=t}),"show-all-sites-item":!1,"switch-site-on-select":!1,"show-selected-site":!0},null,8,["modelValue"])])])])]),Object(r["createElementVNode"])("div",sm,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(d,{uicontrol:"select",name:"containers","model-value":e.idContainer,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.idContainer=t,e.onContainerChange()}),options:e.containerOptions,disabled:e.containerOptions.length<=1,"full-width":!0,title:e.translate("TagManager_Container")},null,8,["model-value","options","disabled","title"])])]),Object(r["createElementVNode"])("div",dm,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(d,{uicontrol:"select",name:"environment","model-value":e.environment,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.environment=t,l.$emit("fetchInstallInstructions")}),options:e.environments,disabled:e.environments.length<=1,"full-width":!0,title:e.translate("TagManager_Environment")},null,8,["model-value","options","disabled","title"])])])],512)),[[r["vShow"],!e.isLoading]]):Object(r["createCommentVNode"])("",!0),e.idContainer?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:2,innerHTML:e.$sanitize(e.getAdvancedStepInfo)},null,8,um)):Object(r["createCommentVNode"])("",!0)])],512),[[r["vShow"],e.isAdvancedDisplayed]])])])):Object(r["createCommentVNode"])("",!0),e.idContainer&&e.noReleaseFound?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",gm,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoReleasesFoundForContainer"))+" ",1),Object(r["createElementVNode"])("a",mm,Object(r["toDisplayString"])(e.translate("TagManager_PublishVersionToEnvironmentToViewEmbedCode")),1)])):Object(r["createCommentVNode"])("",!0),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],{key:n},[e.showDescription?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",bm,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.description)+" ",1),t.helpUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,target:"_blank",href:t.helpUrl},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,pm)):Object(r["createCommentVNode"])("",!0),hm])):Object(r["createCommentVNode"])("",!0),e.showPlainMtmSteps?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:1,innerHTML:e.$sanitize(e.getMtmStep3)},null,8,fm)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("pre",{class:"codeblock",textContent:Object(r["toDisplayString"])(t.embedCode),ref:"codeblock"},null,8,vm),[[u,{}]])])],64)})),128)),e.showBottom&&!e.noReleaseFound&&e.idContainer?(Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],{key:2},[e.showTestSection?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",Om,[(Object(r["openBlock"])(),Object(r["createBlock"])(Object(r["resolveDynamicComponent"])(e.testComponent),{site:e.site},null,8,["site"]))])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:0,innerHTML:e.$sanitize(e.getCongratulationsText)},null,8,jm))],64)):Object(r["createCommentVNode"])("",!0)])}function ym(e){return"".concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}var Vm=Object(r["defineComponent"])({props:{showContainerRow:Boolean,showBottom:Boolean,showDescription:Boolean,showPlainMtmSteps:Boolean,showTestSection:Boolean,showAdvancedOptions:{required:!1,type:Boolean,default:!1}},components:{ActivityIndicator:u["ActivityIndicator"],SiteSelector:u["SiteSelector"],Field:g["Field"]},emits:["fetchInstallInstructions"],directives:{CopyToClipboard:u["CopyToClipboard"]},data:function(){return{containerVariables:[],isLoading:!1,idContainer:"",environment:"",environments:[],environmentNameMap:{},containerMap:{},containerOptions:[],site:{id:u["Matomo"].idSite,name:u["Matomo"].helper.htmlDecode(u["Matomo"].siteName)},matomoConfigs:[],releases:[],installInstructions:[],noReleaseFound:!1,isAdvancedDisplayed:!1}},created:function(){var e=this;u["AjaxHelper"].fetch({method:"TagManager.getAvailableEnvironments",filter_limit:"-1"}).then((function(t){var n;n=Array.isArray(t)?t:Object.values(t),e.environmentNameMap=Object.fromEntries(n.map((function(e){var t=e.id,n=e.name;return[t,n]})))})),this.onSiteChange(),this.isAdvancedDisplayed=this.showAdvancedOptions},watch:{site:function(){this.onSiteChange()}},methods:{onSiteChange:function(){var e,t=this;this.installInstructions=[],this.containerOptions=[],this.containerMap={},this.environments=[],this.matomoConfigs=[],this.idContainer="",null!==(e=this.site)&&void 0!==e&&e.id&&(this.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainers",filter_limit:"-1",idSite:this.site.id}).then((function(e){if(t.containerOptions=[],null===e||void 0===e||!e.length)return t.idContainer="",t.isAdvancedDisplayed=!0,void t.containerOptions.push({key:"",value:t.translate("TagManager_NoContainersFound")});e.forEach((function(e){t.idContainer||(t.idContainer=e.idcontainer),t.containerMap[e.idcontainer]=e,t.containerOptions.push({key:e.idcontainer,value:e.name})})),t.onContainerChange()})).finally((function(){t.isLoading=!1})))},onContainerChange:function(){var e=this;if(this.noReleaseFound=!1,this.idContainer){this.installInstructions=[];var t=this.containerMap[this.idContainer],n=t.draft.idcontainerversion;this.environment="",this.environments=[];var a=t.releases||[];a.find((function(e){return"live"===e.environment}))&&(this.environment="live"),a.forEach((function(t){if("preview"!==t.environment){e.environment||(e.environment=t.environment);var n=ym(t.environment);t.environment in e.environmentNameMap&&(n=e.environmentNameMap[t.environment]),e.environments.push({key:t.environment,value:n})}})),this.environments.length||(this.noReleaseFound=!0,this.environments.push({key:"",value:this.translate("TagManager_NoReleasesFound")})),this.$emit("fetchInstallInstructions"),this.fetchVariables(n)}},linkTo:function(e,t,n,a){var i=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e,idSite:t,idContainer:n})),r="".concat(window.location.pathname,"?").concat(i);return a&&(r+="#?".concat(u["MatomoUrl"].stringify(a))),r},fetchVariables:function(e){var t,n=this;this.matomoConfigs=[],this.idContainer&&null!==(t=this.site)&&void 0!==t&&t.id&&e&&u["AjaxHelper"].fetch({method:"TagManager.getContainerVariables",filter_limit:"-1",idContainer:this.idContainer,idContainerVersion:e,idSite:this.site.id}).then((function(e){n.matomoConfigs=e.filter((function(e){return"MatomoConfiguration"===e.type}))})).finally((function(){n.isLoading=!1}))}},computed:{getLearnMoreLink:function(){return Object(u["translate"])("TagManager_CustomHtmlTagHelpText",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/"),"")},getMtmStep3:function(){return Object(u["translate"])("TagManager_CopyCodePasteInHeader","</head>")},getCongratulationsText:function(){return Object(u["translate"])("TagManager_SiteWithoutDataReactFollowStepCompleted","","")},testComponent:function(){return this.showTestSection?Object(u["useExternalPluginComponent"])("JsTrackerInstallCheck","JsTrackerInstallCheck"):""},getAdvancedStepText:function(){var e,t=Object(u["translate"])("TagManager_SelectContainerForWebsite","","");if(this.idContainer)return t;var n=this.linkTo("manageContainers",String(null===(e=this.site)||void 0===e?void 0:e.id),""),a=Object(u["translate"])("TagManager_ManageContainersLink",''),"");return"".concat(t," ").concat(a)},getAdvancedStepInfo:function(){var e=this.site&&this.site.id?this.site.id:"",t=this.linkTo("dashboard",e,this.idContainer,[]);return Object(u["translate"])("TagManager_CustomiseContainer",''),"",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/"),"")}}});Vm.render=Tm;var Cm=Vm,Nm=Object(r["createElementVNode"])("br",null,null,-1),Em={class:"followStepsHeading"},Sm={style:{"list-style":"inside decimal"}};function km(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TrackingCodeCommon");return Object(r["openBlock"])(),Object(r["createBlock"])(Object(r["resolveDynamicComponent"])("getTrackingMethodsForSite"===e.currentAction?"div":"ContentBlock"),{anchor:"tagmanager","content-title":e.translate("TagManager_MatomoTagManager")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_MtmTrackingCodeIntro")),1),Nm,Object(r["createElementVNode"])("p",Em,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SitesManager_SiteWithoutDataCloudflareFollowStepsIntro")),1)]),Object(r["createElementVNode"])("ol",Sm,[Object(r["createVNode"])(l,{"show-container-row":e.showContainerRow,showBottom:!0,showDescription:!1,showPlainMtmSteps:!0,showAdvancedOptions:"trackingCodeGenerator"===e.currentAction,showTestSection:"getTrackingMethodsForSite"===e.currentAction&&e.isJsTrackerInstallCheckAvailable,onFetchInstallInstructions:e.fetchInstallInstructions,ref:"trackingCodeCommon"},null,8,["show-container-row","showAdvancedOptions","showTestSection","onFetchInstallInstructions"])])]})),_:1},8,["content-title"])}var wm=Object(r["defineComponent"])({props:{currentAction:String,showContainerRow:Boolean,isJsTrackerInstallCheckAvailable:Boolean},components:{ContentBlock:u["ContentBlock"],TrackingCodeCommon:Cm},methods:{fetchInstallInstructions:function(){var e,t,n=this,a=this.$refs.trackingCodeCommon;a.installInstructions=[],null!==a&&void 0!==a&&null!==(e=a.site)&&void 0!==e&&e.id&&null!==a&&void 0!==a&&a.environment&&(a.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainerInstallInstructions",filter_limit:"-1",idContainer:null===a||void 0===a?void 0:a.idContainer,environment:null===a||void 0===a?void 0:a.environment,idSite:null===a||void 0===a||null===(t=a.site)||void 0===t?void 0:t.id}).then((function(e){a.installInstructions=e,Object(r["nextTick"])((function(){var e=Array.isArray(n.$refs.codeblock)?n.$refs.codeblock:[n.$refs.codeblock];e.forEach((function(e){$(e).effect("highlight",{},1500)}))}))})).finally((function(){a.isLoading=!1})))}}});wm.render=km;var Mm=wm,_m={class:"list-style-decimal"},Dm={ref:"step1"},Am=["innerHTML"],xm=["innerHTML"],Bm=["textContent"],Lm=["innerHTML"],Um=["textContent"],Pm=["innerHTML"],Im=["innerHTML"],Fm=["innerHTML"],Hm=["textContent"],Gm={style:{"list-style":"lower-alpha","list-style-position":"inside"}},$m=["innerHTML"],Rm=["innerHTML"],qm=["innerHTML"],zm=["textContent"],Wm=["textContent"],Xm=["innerHTML"],Km=["textContent"],Jm=["innerHTML"],Ym=["innerHTML"],Zm=["textContent"];function Qm(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TrackingCodeCommon"),c=Object(r["resolveDirective"])("copy-to-clipboard");return Object(r["openBlock"])(),Object(r["createElementBlock"])("ol",_m,[Object(r["withDirectives"])(Object(r["createElementVNode"])("li",Dm,[Object(r["createVNode"])(l,{"show-container-row":e.showContainerRow,showBottom:!1,showDescription:!1,onFetchInstallInstructions:e.fetchInstallInstructionsSPA,ref:"trackingCodeCommon"},null,8,["show-container-row","onFetchInstallInstructions"])],512),[[r["vShow"],e.step1HasContent]]),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.setupStep2)},null,8,Am),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep3)},null,8,xm),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("TagManager_CreateNewTrigger"))},null,8,Bm),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep5)},null,8,Lm),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("TagManager_CreateNewTrigger"))},null,8,Um),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.setupStep7)},null,8,Pm),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep8)},null,8,Im),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep9)},null,8,Fm),Object(r["createElementVNode"])("li",null,[Object(r["createElementVNode"])("span",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep10)},null,8,Hm),Object(r["createElementVNode"])("ol",Gm,[Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep10a)},null,8,$m),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep10b)},null,8,Rm)])]),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep11)},null,8,qm),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("General_Update"))},null,8,zm),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep13)},null,8,Wm),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep14)},null,8,Xm),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep15)},null,8,Km),Object(r["createElementVNode"])("li",null,["react"===e.jsFramework?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:0,innerHTML:e.$sanitize(e.fetchFollowStep16React)},null,8,Jm)):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:1,innerHTML:e.$sanitize(e.fetchFollowStep16SPA)},null,8,Ym)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:t},[Object(r["withDirectives"])(Object(r["createElementVNode"])("pre",{class:"codeblock",textContent:Object(r["toDisplayString"])(e.embedCode),ref:"codeblock"},null,8,Zm),[[c,{}]])])})),128))])])}var eb=Object(r["defineComponent"])({props:{showContainerRow:Boolean,jsFramework:String},components:{TrackingCodeCommon:Cm},directives:{CopyToClipboard:u["CopyToClipboard"]},data:function(){return{setupStep1:"",setupStep2:"",setupStep7:"",installInstructions:[]}},methods:{fetchInstallInstructionsSPA:function(){var e,t,n=this,a=this.$refs.trackingCodeCommon;if(this.installInstructions=[],null!==a&&void 0!==a&&a.idContainer&&null!==a&&void 0!==a&&a.environment&&null!==a&&void 0!==a&&null!==(e=a.site)&&void 0!==e&&e.id){var i=this.linkTo("manageContainers",a.site.id,a.idContainer);this.setupStep1=Object(u["translate"])("TagManager_SPAFollowStep1","
","",''),"");var o=this.linkTo("manageTriggers",a.site.id,a.idContainer);this.setupStep2=Object(u["translate"])("TagManager_SPAFollowStep2",''),"");var l=this.linkTo("manageTags",a.site.id,a.idContainer);this.setupStep7=Object(u["translate"])("TagManager_SPAFollowStep7",''),""),a.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainerInstallInstructions",filter_limit:"-1",idContainer:null===a||void 0===a?void 0:a.idContainer,environment:null===a||void 0===a?void 0:a.environment,idSite:null===a||void 0===a||null===(t=a.site)||void 0===t?void 0:t.id,jsFramework:this.jsFramework}).then((function(e){n.installInstructions=e,Object(r["nextTick"])((function(){var e=Array.isArray(n.$refs.codeblock)?n.$refs.codeblock:[n.$refs.codeblock];e.forEach((function(e){$(e).effect("highlight",{},1500)}))}))})).finally((function(){a.isLoading=!1}))}},linkTo:function(e,t,n,a){var i=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e,idSite:t,idContainer:n}));return a&&(i+="#?".concat(u["MatomoUrl"].stringify(a))),"?".concat(i)},fetchClickX:function(e){return Object(u["translate"])("General_ClickX",Object(u["translate"])(e))}},computed:{step1HasContent:function(){var e=this.$refs.step1;return e&&""!==e.textContent},fetchFollowStep3:function(){return Object(u["translate"])("TagManager_SPAFollowStep3","".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),""),Object(u["translate"])("TagManager_PageViewTriggerName"),Object(u["externalLink"])("https://matomo.org/faq/tag-manager/how-do-i-track-pageviews-of-my-website-using-matomo-tag-manager/#create-pageview-trigger"),"")},fetchFollowStep5:function(){return Object(u["translate"])("TagManager_SPAFollowStep5","".concat(Object(u["translate"])("TagManager_HistoryChangeTriggerName"),""),Object(u["translate"])("TagManager_CategoryUserEngagement"))},fetchFollowStep8:function(){return Object(u["translate"])("TagManager_SPAFollowStep8","".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),""),"".concat(Object(u["translate"])("TagManager_MatomoTagName"),""),Object(u["translate"])("TagManager_PageViewTriggerName"),Object(u["externalLink"])("https://matomo.org/faq/tag-manager/how-do-i-track-pageviews-of-my-website-using-matomo-tag-manager/#create-pageview-tag"),"")},fetchFollowStep9:function(){return Object(u["translate"])("TagManager_SPAFollowStep9",Object(u["translate"])("TagManager_ConfigureWhatTagDoes"),Object(u["translate"])("TagManager_CustomTitle"),"","")},fetchFollowStep10:function(){return Object(u["translate"])("TagManager_SPAFollowStep10",Object(u["translate"])("TagManager_CustomUrl"))},fetchFollowStep10a:function(){return Object(u["translate"])("TagManager_SPAFollowStep10a","","",Object(u["translate"])("TagManager_CustomUrl"))},fetchFollowStep10b:function(){return Object(u["translate"])("TagManager_SPAFollowStep10b",Object(u["translate"])("TagManager_CustomUrl"),"","")},fetchFollowStep11:function(){return Object(u["translate"])("TagManager_SPAFollowStep11",Object(u["translate"])("TagManager_ConfigureWhenTagDoes"),Object(u["translate"])("TagManager_FireTriggerTitle"),"".concat(Object(u["translate"])("TagManager_HistoryChangeTriggerName"),""),"".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),""))},fetchFollowStep13:function(){return Object(u["translate"])("TagManager_SPAFollowStep13",Object(u["translate"])("TagManager_Publish"))},fetchFollowStep14:function(){return Object(u["translate"])("TagManager_SPAFollowStep14",Object(u["translate"])("TagManager_VersionName"),"","")},fetchFollowStep15:function(){return Object(u["translate"])("TagManager_SPAFollowStep15",Object(u["translate"])("TagManager_CreateVersionAndPublishRelease"))},fetchFollowStep16SPA:function(){return Object(u["translate"])("TagManager_SPAFollowStep16","</head>",Object(u["externalLink"])("https://developer.matomo.org/guides/tagmanager/embedding"),"")},fetchFollowStep16React:function(){return Object(u["translate"])("TagManager_ReactFollowStep16","","","App.js","React.useEffect","Hello World","React.js")}}});eb.render=Qm;var tb,nb,ab=eb,ib={class:"nav-wrapper"},rb={class:"pull-right"},ob=Object(r["createElementVNode"])("svg",{class:"tm-icon tm-icon-close"},[Object(r["createElementVNode"])("use",{"xlink:href":"#tm-icon-close"})],-1),lb=[ob],cb={class:"pull-right"},sb=Object(r["createElementVNode"])("svg",{"aria-hidden":"true",style:{position:"absolute",width:"0",height:"0",overflow:"hidden"},version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[Object(r["createElementVNode"])("defs",null,[Object(r["createElementVNode"])("symbol",{id:"tm-icon-checkmark",viewBox:"0 0 32 32"},[Object(r["createElementVNode"])("path",{d:"M27 4l-15 15-7-7-5 5 12 12 20-20z"})])])],-1),db=Object(r["createElementVNode"])("svg",{"aria-hidden":"true",style:{position:"absolute",width:"0",height:"0",overflow:"hidden"},version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[Object(r["createElementVNode"])("symbol",{id:"tm-icon-close",viewBox:"0 0 32 32"},[Object(r["createElementVNode"])("path",{d:"M31.33 0.67c0.893 0.893 0.893 2.34 0 3.232l-27.427 27.427c-0.893 0.893-2.34\n 0.893-3.232 0s-0.893-2.34 0-3.232l27.427-27.427c0.892-0.893 2.34-0.893 3.232 0z"}),Object(r["createElementVNode"])("path",{d:"M0.67 0.67c0.893-0.893 2.34-0.893 3.232 0l27.427 27.427c0.893 0.892 0.893\n 2.34 0 3.232s-2.34 0.892-3.232 0l-27.427-27.427c-0.893-0.893-0.893-2.34 0-3.232z"})])],-1),ub={class:"page",style:{clear:"both"}},gb={key:0,id:"secondNavBar",class:"Menu--dashboard z-depth-1"},mb={class:"navbar",role:"menu",style:{padding:"0"}},bb={class:"menuTab",role:"menuitem"},pb={class:"item",style:{"font-weight":"normal"}},hb=Object(r["createTextVNode"])(" Events "),fb={key:0},vb=Object(r["createElementVNode"])("br",null,null,-1),jb=Object(r["createElementVNode"])("br",null,null,-1),Ob=Object(r["createElementVNode"])("label",{for:"onlyfiredTags",class:"lbl-onlyfiredTags"},"Only fired tags",-1),Tb={key:0,style:{padding:"0 0 1rem 1.2rem"}},yb=["onClick","title"],Vb={title:"This tag was fired"},Cb=Object(r["createElementVNode"])("svg",{class:"tm-icon tm-icon-checkmark"},[Object(r["createElementVNode"])("use",{"xlink:href":"#tm-icon-checkmark"})],-1),Nb=[Cb],Eb={class:"pageWrap"},Sb={class:"home",id:"content"},kb=Object(r["createElementVNode"])("h3",null,"Fired Tags",-1),wb={class:"entityTable"},Mb=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Action"),Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type"),Object(r["createElementVNode"])("th",null,"Fired count")])],-1),_b={key:0},Db=Object(r["createElementVNode"])("td",{colspan:"4"},"No tags",-1),Ab=[Db],xb=Object(r["createElementVNode"])("h3",{style:{"margin-top":"30px"}},"Not Yet Fired Tags",-1),Bb={class:"entityTable"},Lb=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type")])],-1),Ub=Object(r["createElementVNode"])("td",{colspan:"4"},"No tags",-1),Pb=[Ub],Ib=Object(r["createElementVNode"])("h3",null,"Triggers",-1),Fb={class:"entityTable"},Hb=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type")])],-1),Gb={key:0},$b=Object(r["createElementVNode"])("td",{colspan:"4"},"No trigger",-1),Rb=[$b],qb={key:1},zb=Object(r["createElementVNode"])("h3",null,"Pushed data by this event",-1),Wb={class:"entityTable"},Xb={style:{"word-break":"break-all"}},Kb=Object(r["createElementVNode"])("br",null,null,-1),Jb=Object(r["createElementVNode"])("h3",null,"Content after this event",-1),Yb={class:"entityTable"},Zb={style:{"word-break":"break-all"}},Qb={class:"entityTable"},ep=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type"),Object(r["createElementVNode"])("th",null,"Value")])],-1),tp={key:0},np=Object(r["createElementVNode"])("td",{colspan:"3"},"No variables",-1),ap=[np],ip={style:{"word-break":"break-all"}},rp={class:"entityTable"},op=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Time"),Object(r["createElementVNode"])("th",null,"Message")])],-1),lp={style:{"word-break":"break-all"}},cp=Object(r["createElementVNode"])("br",null,null,-1);function sp(e,t,n,a,i,o){var l,c,s,d,u,g,m,b,p,h;return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createElementVNode"])("nav",null,[Object(r["createElementVNode"])("div",ib,[Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",null,[Object(r["renderSlot"])(e.$slots,"logo")]),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"tags"===e.contentTab||!e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[0]||(t[0]=function(t){return e.contentTab="tags"})},"Tags")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"triggers"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[1]||(t[1]=function(t){return e.contentTab="triggers"})},"Triggers")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"variables"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[2]||(t[2]=function(t){return e.contentTab="variables"})},"Variables")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"dataLayer"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[3]||(t[3]=function(t){return e.contentTab="dataLayer"})},"Data Layer")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"logs"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[4]||(t[4]=function(t){return e.contentTab="logs"})},"Logs")],2),Object(r["createElementVNode"])("li",rb,[Object(r["createElementVNode"])("a",{id:"mtmCloseDebug",onClick:t[5]||(t[5]=function(t){return e.mtmCloseDebugWindow()})},lb)]),Object(r["createElementVNode"])("li",cb,[Object(r["createElementVNode"])("a",{id:"mtmUpdateDebugPosition",onClick:t[6]||(t[6]=function(t){return e.mtmUpdateDebugPosition()})},Object(r["toDisplayString"])(e.positionText),1)])])])]),sb,db,Object(r["createElementVNode"])("div",ub,["logs"!==e.contentTab?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",gb,[Object(r["createElementVNode"])("ul",mb,[Object(r["createElementVNode"])("li",bb,[Object(r["createElementVNode"])("span",pb,[hb,e.mtmEvents.length>0?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",fb,[vb,jb,Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{type:"checkbox",class:"onlyFiredTags-chk",name:"onlyfiredTags",id:"onlyfiredTags",value:"1","onUpdate:modelValue":t[7]||(t[7]=function(t){return e.onlyfiredTags=t}),style:{"margin-right":"3.5px"}},null,512),[[r["vModelCheckbox"],e.onlyfiredTags]]),Ob])):Object(r["createCommentVNode"])("",!0)])]),0===e.mtmEvents.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",Tb,"No event executed")):Object(r["createCommentVNode"])("",!0),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.mtmEventsReversed,(function(t,n){var a,i;return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:Object(r["normalizeClass"])(["menuTab",{active:n===e.selectedEventIndex}]),role:"menuitem",key:n},[(t.tags||[]).length||!e.onlyfiredTags?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,class:"item",onClick:function(n){return e.selectEvent(t.index0)},title:"Time: ".concat(t.time,". Trigger: ").concat(null===(a=t.metTrigger)||void 0===a?void 0:a.name)},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.index)+": "+Object(r["toDisplayString"])(t.name)+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Vb,Nb,512),[[r["vShow"],null===(i=t.tags)||void 0===i?void 0:i.length]])],8,yb)):Object(r["createCommentVNode"])("",!0)],2)})),128))])])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",Eb,[Object(r["createElementVNode"])("div",Sb,[Object(r["withDirectives"])(Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.homeTabTitle),513),[[r["vShow"],"logs"!==e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[kb,Object(r["createElementVNode"])("table",wb,[Mb,Object(r["createElementVNode"])("tbody",null,[null!==(l=e.selectedEvent)&&void 0!==l&&null!==(c=l.tags)&&void 0!==c&&c.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",_b,Ab)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])((null===(s=e.selectedEvent)||void 0===s?void 0:s.tags)||[],(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.action),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.type),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.numExecuted),1)])})),128))])]),xb,Object(r["createElementVNode"])("table",Bb,[Lb,Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,Pb,512),[[r["vShow"],0===e.notFiredTags.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.notFiredTags,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.type),1)])})),128))])])],512),[[r["vShow"],"tags"===e.contentTab||!e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Ib,Object(r["createElementVNode"])("table",Fb,[Hb,Object(r["createElementVNode"])("tbody",null,[null!==(d=e.selectedEvent)&&void 0!==d&&d.metTrigger?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Gb,Rb)),null!==(u=e.selectedEvent)&&void 0!==u&&u.metTrigger?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",qb,[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.selectedEvent.metTrigger.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.selectedEvent.metTrigger.type),1)])):Object(r["createCommentVNode"])("",!0)])])],512),[[r["vShow"],"triggers"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[zb,Object(r["createElementVNode"])("table",Wb,[Object(r["createElementVNode"])("tbody",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Xb,Object(r["toDisplayString"])(e.selectedEventData),1)])])]),Kb,Jb,Object(r["createElementVNode"])("table",Yb,[Object(r["createElementVNode"])("tbody",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Zb,Object(r["toDisplayString"])(e.selectedEventContainerDataLayer),1)])])])],512),[[r["vShow"],"dataLayer"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("table",Qb,[ep,Object(r["createElementVNode"])("tbody",null,[null!==(g=e.selectedEvent)&&void 0!==g&&null!==(m=g.container)&&void 0!==m&&null!==(b=m.variables)&&void 0!==b&&b.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",tp,ap)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])((null===(p=e.selectedEvent)||void 0===p||null===(h=p.container)||void 0===h?void 0:h.variables)||[],(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:n},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.type),1),Object(r["createElementVNode"])("td",ip,Object(r["toDisplayString"])(e.stringifySelectedVariable(t)),1)])})),128))])])],512),[[r["vShow"],"variables"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("table",rp,[op,Object(r["createElementVNode"])("tbody",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.mtmLogs,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.time),1),Object(r["createElementVNode"])("td",lp,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.messages,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:t},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e),1),cp])})),128))])])})),128))])])],512),[[r["vShow"],"logs"===e.contentTab]])])])])])}function dp(e){return bp(e)||mp(e)||gp(e)||up()}function up(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gp(e,t){if(e){if("string"===typeof e)return pp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pp(e,t):void 0}}function mp(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function bp(e){if(Array.isArray(e))return pp(e)}function pp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt||n.push.apply(n,dp(e.tags.map((function(e){return e.name}))))}));var a=[];return this.selectedEvent.container.tags.forEach((function(e){-1===n.indexOf(e.name)&&a.push(e)})),a},selectedEvent:function(){return this.mtmEvents[this.selectedEventIndex]},mtmEvents:function(){return window.mtmDbgData.mtmEvents},mtmEventsReversed:function(){var e=dp(this.mtmEvents);return e.reverse(),e},mtmLogs:function(){return window.mtmDbgData.mtmLogs},selectedEventData:function(){var e;return(null===(e=this.selectedEvent)||void 0===e?void 0:e.eventData)&&JSON.stringify(this.selectedEvent.eventData,Op())},selectedEventContainerDataLayer:function(){var e,t;return(null===(e=this.selectedEvent)||void 0===e||null===(t=e.container)||void 0===t?void 0:t.dataLayer)&&JSON.stringify(this.selectedEvent.container.dataLayer,Op())}}});Tp.render=sp;var yp=Tp,Vp={class:"copyMtmObjectDialog"},Cp=["innerHTML"],Np=["href"];function Ep(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ContainerSelector"),s=Object(r["resolveDirective"])("form");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Vp,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.getCopyDialogTitle),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.getCopyDescription),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"site",name:"destinationSite",title:e.translate("TagManager_ChooseWebsite"),modelValue:e.site,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.site=t})},null,8,["title","modelValue"]),"container"!==e.copyType.toLowerCase()?(Object(r["openBlock"])(),Object(r["createBlock"])(c,{key:0})):Object(r["createCommentVNode"])("",!0),"container"!==e.copyType.toLowerCase()?(Object(r["openBlock"])(),Object(r["createBlock"])(l,{key:1,uicontrol:"select",name:"idDestinationContainer",options:e.containerOptions,disabled:e.containerOptions.length<=1,"full-width":!0,title:e.translate("TagManager_Container"),modelValue:e.idDestinationContainer,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.idDestinationContainer=t})},null,8,["options","disabled","title","modelValue"])):Object(r["createCommentVNode"])("",!0),"container"===e.copyType.toLowerCase()?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:2,class:"copyNote",innerHTML:e.$sanitize(e.getCopyContainerNote)},null,8,Cp)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("a",{href:e.getCopyUrl,class:"btn"},Object(r["toDisplayString"])(e.translate("General_Copy")),9,Np)],512),[[s]])])}var Sp=Object(r["defineComponent"])({props:{defaultSite:{type:Object,required:!0},copyType:{type:String,required:!0},copyNonce:{type:String,required:!1,default:""},idToCopy:{type:[String,Number],required:!0}},directives:{Form:g["Form"]},components:{Field:g["Field"],ContainerSelector:cg},data:function(){return{site:this.defaultSite,idDestinationContainer:"",containerOptions:[]}},created:function(){this.onSiteChange()},watch:{site:function(){this.onSiteChange()}},methods:{onSiteChange:function(){var e,t=this;"container"!==this.copyType.toLowerCase()&&(this.containerOptions=[],this.idDestinationContainer="",null!==(e=this.site)&&void 0!==e&&e.id&&u["AjaxHelper"].fetch({method:"TagManager.getContainers",filter_limit:"-1",idSite:this.site.id}).then((function(e){if(t.containerOptions=[],null===e||void 0===e||!e.length)return t.idDestinationContainer="",void t.containerOptions.push({key:"",value:t.translate("TagManager_NoContainersFound")});e.forEach((function(e){t.idDestinationContainer||(t.idDestinationContainer=e.idcontainer),t.containerOptions.push({key:e.idcontainer,value:e.name})}))})))}},computed:{getCopyDialogTitle:function(){var e="";switch(this.copyType.toLowerCase()){case"container":e=Object(u["translate"])("TagManager_Container");break;case"tag":e=Object(u["translate"])("TagManager_Tag");break;case"trigger":e=Object(u["translate"])("TagManager_Trigger");break;case"variable":e=Object(u["translate"])("TagManager_Variable");break;default:throw Error("Unrecognised copy object type.")}return Object(u["translate"])("TagManager_CopyX",e)},getCopyDescription:function(){if("container"===this.copyType.toLowerCase())return Object(u["translate"])("TagManager_CopyContainerDescription");var e="";switch(this.copyType.toLowerCase()){case"tag":e=Object(u["translate"])("TagManager_TagLowercase");break;case"trigger":e=Object(u["translate"])("TagManager_TriggerLowercase");break;case"variable":e=Object(u["translate"])("TagManager_VariableLowercase");break;default:throw Error("Unrecognised copy object type.")}return Object(u["translate"])("TagManager_CopyXDescription",e)},getCopyContainerNote:function(){return Object(u["translate"])("TagManager_CopyContainerNote","","")},getCopyUrl:function(){var e,t="";switch(this.copyType.toLowerCase()){case"container":t="copyContainer";break;case"tag":t="copyTag";break;case"trigger":t="copyTrigger";break;case"variable":t="copyVariable";break;default:throw Error("Unrecognised copy object type.")}var n={module:"TagManager",action:t,idSite:this.defaultSite.id,idDestinationSite:null===(e=this.site)||void 0===e?void 0:e.id,idContainer:this.idToCopy,nonce:this.copyNonce,idDestinationContainer:""};return this.idDestinationContainer&&(n.idDestinationContainer=this.idDestinationContainer),"?".concat(u["MatomoUrl"].stringify(n))}}});Sp.render=Ep;var kp=Sp; + */var dd=function(){function e(){var t=this;od(this,e),sd(this,"privateState",Object(r["reactive"])({containers:[],isLoadingContainers:!1,isLoadingSingle:!1,isUpdating:!1})),sd(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),sd(this,"isLoading",Object(r["computed"])((function(){var e=t.state.value;return e.isLoadingContainers||e.isLoadingSingle}))),sd(this,"isUpdating",Object(r["computed"])((function(){return t.state.value.isUpdating}))),sd(this,"containers",Object(r["computed"])((function(){return t.state.value.containers}))),sd(this,"fetchPromise",null)}return cd(e,[{key:"reload",value:function(){return this.privateState.containers=[],this.fetchPromise=null,this.fetchContainers()}},{key:"fetchContainers",value:function(){var e=this;return this.privateState.isLoadingContainers=!0,this.privateState.containers=[],this.fetchPromise||(this.fetchPromise=u["AjaxHelper"].fetch({method:"TagManager.getContainers",filter_limit:"-1"})),Promise.resolve(this.fetchPromise).then((function(t){return e.privateState.containers=t,e.privateState.isLoadingContainers=!1,e.containers.value})).finally((function(){e.privateState.isLoadingContainers=!1}))}},{key:"findContainer",value:function(e){var t=this,n=this.containers.value.find((function(t){return t.idcontainer===e}));return n?Promise.resolve(n):(this.privateState.isLoadingSingle=!0,u["AjaxHelper"].fetch({idContainer:e,method:"TagManager.getContainer",filter_limit:"-1"}).then((function(e){return t.privateState.containers=[].concat(ed(t.privateState.containers),[e]),Object(r["readonly"])(e)})).finally((function(){t.privateState.isLoadingSingle=!1})))}},{key:"deleteContainer",value:function(e){var t=this;return this.privateState.isUpdating=!0,this.privateState.containers=[],u["AjaxHelper"].fetch({idContainer:e,method:"TagManager.deleteContainer"},{withTokenInUrl:!0}).finally((function(){t.privateState.isUpdating=!1}))}},{key:"createOrUpdateContainer",value:function(e,t){var n=this;return this.privateState.isUpdating=!0,u["AjaxHelper"].post({method:t,idContainer:e.idcontainer},{name:e.name,description:e.description,ignoreGtmDataLayer:e.ignoreGtmDataLayer,activelySyncGtmDataLayer:e.activelySyncGtmDataLayer,isTagFireLimitAllowedInPreviewMode:e.isTagFireLimitAllowedInPreviewMode,context:e.context},{withTokenInUrl:!0}).finally((function(){n.privateState.isUpdating=!1}))}}]),e}(),ud=new dd,gd="containertagmanagement",bd=Object(r["defineComponent"])({props:{idContainer:String},components:{ContentBlock:u["ContentBlock"],Field:g["Field"],SaveButton:g["SaveButton"]},data:function(){return{isDirty:!1,editTitle:"",isUpdatingVersion:!1,container:{}}},created:function(){Qs.init(),Vt.init(),this.initIdContainer()},watch:{idContainer:function(e){null!==e&&this.initIdContainer()}},methods:{removeAnyContainerNotification:function(){u["NotificationsStore"].remove(gd),u["NotificationsStore"].remove("ajaxHelper")},showNotification:function(e,t){var n=u["NotificationsStore"].show({message:e,context:t,id:gd,type:"transient"});setTimeout((function(){u["NotificationsStore"].scrollToNotification(n)}),200)},showErrorFieldNotProvidedNotification:function(e){var t=Object(u["translate"])("TagManager_ErrorXNotProvided",[e]);this.showNotification(t,"error")},initIdContainer:function(){var e=this;this.container={},u["Matomo"].helper.lazyScrollToContent(),this.edit&&this.idContainer?(this.editTitle=Object(u["translate"])("TagManager_EditContainer"),ud.findContainer(this.idContainer).then((function(t){t&&(e.container=Object(u["clone"])(t),e.isDirty=!1)}))):this.create&&(this.editTitle=Object(u["translate"])("TagManager_CreateNewContainer"),this.container={idSite:u["Matomo"].idSite,name:"",context:"web",description:"",activelySyncGtmDataLayer:!0},this.isDirty=!1)},cancel:function(){var e=Object.assign({},u["MatomoUrl"].hashParsed.value);delete e.idContainer,u["MatomoUrl"].updateHash(e)},createContainer:function(){var e=this;this.removeAnyContainerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdatingVersion=!0,ud.createOrUpdateContainer(this.container,"TagManager.addContainer").then((function(t){if(e.isUpdatingVersion=!1,t){e.isDirty=!1;var n=t.value;e.showNotification(Object(u["translate"])("TagManager_CreatedX",Object(u["translate"])("TagManager_Container")),"success"),u["MatomoUrl"].updateUrl(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:"dashboard",idContainer:n}))}})).finally((function(){e.isUpdatingVersion=!1})))},setValueHasChanged:function(){this.isDirty=!0},updateContainer:function(){var e=this;this.removeAnyContainerNotification(),this.checkRequiredFieldsAreSet()&&(this.isUpdating=!0,ud.createOrUpdateContainer(this.container,"TagManager.updateContainer").then((function(t){t&&(e.isDirty=!1,e.container={},ud.reload().then((function(){e.initIdContainer()})),e.showNotification(Object(u["translate"])("TagManager_UpdatedX",Object(u["translate"])("TagManager_Container")),"success"))})))},checkRequiredFieldsAreSet:function(){if(!this.container.name){var e=Object(u["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}return!0}},computed:{contexts:function(){return Qs.contextsOptions.value},create:function(){return"0"===this.idContainer},edit:function(){return!this.create},isLoading:function(){return ft.isLoading.value||Vt.isLoading.value},isUpdating:function(){return ft.isUpdating.value||this.isUpdatingVersion}}});bd.render=Ws;var md=bd,pd={class:"tagManagerManageList tagManagerContainerList"},hd=["innerHTML"],fd={class:"index"},vd={class:"name"},jd={class:"description"},Od={class:"created"},Td={class:"action"},yd={colspan:"5"},Vd={class:"loadingPiwik"},Cd=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Nd={colspan:"5"},Ed=["id"],Sd=["title"],wd=["title"],kd=["title"],Md={class:"created"},_d=["href","title"],Dd=["onClick","title"],Ad=["onClick","title"],xd=["onClick","title"],Bd=["onClick","title"],Ld={class:"tableActionBar"},Ud=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Pd={class:"ui-confirm",id:"confirmDeleteContainer",ref:"confirmDeleteContainer"},Id=["value"],Fd=["value"];function Hd(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ContentBlock"),c=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",pd,[Object(r["createVNode"])(l,{feature:"Tag Manager","content-title":e.translate("TagManager_ManageX",e.translate("TagManager_Containers"))},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.getManageContainersIntro)},null,8,hd),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",fd,Object(r["toDisplayString"])(e.translate("General_Id")),1),Object(r["createElementVNode"])("th",vd,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",jd,Object(r["toDisplayString"])(e.translate("General_Description")),1),Object(r["createElementVNode"])("th",Od,Object(r["toDisplayString"])(e.translate("TagManager_CreatedDate")),1),Object(r["createElementVNode"])("th",Td,Object(r["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",yd,[Object(r["createElementVNode"])("span",Vd,[Cd,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Nd,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoContainersFound"))+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"createContainerNow",onClick:t[0]||(t[0]=function(t){return e.createContainer()})},Object(r["toDisplayString"])(e.translate("TagManager_CreateNewContainerNow")),513),[[r["vShow"],e.hasWriteAccess]])])],512),[[r["vShow"],!e.isLoading&&0===e.containers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedContainers,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"container".concat(t.idcontainer),class:"containers",key:t.idcontainer},[Object(r["createElementVNode"])("td",{class:"index",title:"".concat(e.translate("TagManager_Context"),": ")+e.contexts[t.context]},Object(r["toDisplayString"])(t.idcontainer),9,Sd),Object(r["createElementVNode"])("td",{class:"name",title:t.name},Object(r["toDisplayString"])(e.truncateText(t.name,50)),9,wd),Object(r["createElementVNode"])("td",{class:"description",title:t.description},Object(r["toDisplayString"])(e.truncateText(t.description,75)),9,kd),Object(r["createElementVNode"])("td",Md,[Object(r["createElementVNode"])("span",null,Object(r["toDisplayString"])(t.created_date_pretty),1)]),Object(r["createElementVNode"])("td",{class:Object(r["normalizeClass"])(e.getActionClasses)},[Object(r["createElementVNode"])("a",{class:"table-action icon-configure",href:"?module=TagManager&action="+e.containerDefaultAction+"&idContainer="+t.idcontainer+"&idSite="+t.idsite+"&period=day&date=yesterday",title:e.translate("TagManager_ConfigureX",e.translate("TagManager_Container"))},null,8,_d),Object(r["createElementVNode"])("a",{class:"table-action installCode icon-embed",onClick:function(n){return e.installCode(t.idcontainer)},title:e.translate("TagManager_InstallCode")},null,8,Dd),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-edit",onClick:function(n){return e.editContainer(t.idcontainer)},title:e.translate("TagManager_EditX",e.translate("TagManager_Container"))},null,8,Ad),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-delete",onClick:function(n){return e.deleteContainer(t)},title:e.translate("TagManager_DeleteX",e.translate("TagManager_Container"))},null,8,xd),[[r["vShow"],e.hasWriteAccess]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action icon-content-copy",onClick:function(n){return e.openCopyDialog(t)},title:e.translate("TagManager_CopyX",e.translate("TagManager_Container"))},null,8,Bd),[[r["vShow"],e.canCopyContainer]])],2)],8,Ed)})),128))])],512),[[c]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Ld,[Object(r["createElementVNode"])("a",{class:"createNewContainer",value:"",onClick:t[1]||(t[1]=function(t){return e.createContainer()})},[Ud,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewContainer")),1)])],512),[[r["vShow"],e.hasWriteAccess]])]})),_:1},8,["content-title"]),Object(r["createElementVNode"])("div",Pd,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_DeleteContainerConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Id),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Fd)],512)])}function Gd(e){return zd(e)||qd(e)||Rd(e)||$d()}function $d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Rd(e,t){if(e){if("string"===typeof e)return Wd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wd(e,t):void 0}}function qd(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function zd(e){if(Array.isArray(e))return Wd(e)}function Wd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.created_date?-1:0})),e},getManageContainersIntro:function(){var e=Object(u["externalLink"])("https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/");return Object(u["translate"])("TagManager_ManageContainersIntro",e,"")},canCopyContainer:function(){return this.isSuperUser},getActionClasses:function(){var e=this.canCopyContainer?" hasCopyAction":"";return"action".concat(e)}},methods:{createContainer:function(){this.editContainer("0")},editContainer:function(e){u["MatomoUrl"].updateHash(Object.assign(Object.assign({},u["MatomoUrl"].hashParsed.value),{},{idContainer:e}))},installCode:function(e){Kd.showInstallCode(e)},deleteContainer:function(e){function t(){ud.deleteContainer(e.idcontainer).then((function(){ud.reload()}))}u["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteContainer,{yes:t})},truncateText:function(e,t){return e.length>t?"".concat(e.substr(0,t-3),"..."):e},openCopyDialog:function(e){var t=u["MatomoUrl"].stringify({module:"TagManager",action:"copyContainerDialog",idSite:e.idsite,idContainer:e.idcontainer});window.Piwik_Popover.createPopupAndLoadUrl(t,"","mtmCopyContainer")}}});Jd.render=Hd;var Yd=Jd,Zd={class:"manageContainer"};function Qd(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ContainerList"),c=Object(r["resolveComponent"])("ContainerEdit");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Zd,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"is-super-user":e.isSuperUser},null,8,["is-super-user"])],512),[[r["vShow"],!e.editMode]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"id-container":e.idContainer},null,8,["id-container"])],512),[[r["vShow"],e.editMode]])])}var eu=Object(r["defineComponent"])({props:{isSuperUser:{type:Boolean,required:!0}},components:{ContainerList:Yd,ContainerEdit:md},data:function(){return{isAddAllowed:!1}},created:function(){var e=this;Object(r["watch"])((function(){return u["MatomoUrl"].hashParsed.value.idContainer}),(function(t){e.onIdContainerParamChange(t)})),u["NotificationsStore"].remove("containertagmanagement"),this.onIdContainerParamChange(u["MatomoUrl"].hashParsed.value.idContainer)},computed:{idContainer:function(){var e=u["MatomoUrl"].hashParsed.value.idContainer;return this.isAddAllowed||""!==e?e:null},editMode:function(){return!!this.idContainer}},methods:{onIdContainerParamChange:function(e){if("0"===e){var t={isAllowed:!0};u["Matomo"].postEvent("TagManager.initAddVersion",t),this.isAddAllowed=!!t.isAllowed}}}});eu.render=Qd;var tu=eu,nu={class:"containerDashboard"},au={key:0},iu={class:"dashboardCreationDate"},ru={key:0},ou=Object(r["createElementVNode"])("br",null,null,-1),lu=["innerHTML"],cu={class:"row",style:{"margin-left":"-0.75rem"}},su={class:"col m6 s12"},du={key:0},uu=["href","title"],gu={key:0},bu=Object(r["createElementVNode"])("hr",null,null,-1),mu=["href"],pu=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),hu=["href"],fu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),vu={class:"col m6 s12"},ju={key:0},Ou=["href","title"],Tu=Object(r["createElementVNode"])("hr",null,null,-1),yu=["href"],Vu=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),Cu=["href"],Nu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Eu={class:"row",style:{"margin-left":"-0.75rem"}},Su={class:"col m6 s12"},wu=["href","title"],ku={key:0},Mu=Object(r["createElementVNode"])("hr",null,null,-1),_u=["href"],Du=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),Au=["href"],xu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1),Bu={class:"col m6 s12"},Lu=["title","href"],Uu={key:0},Pu=Object(r["createElementVNode"])("br",null,null,-1),Iu=["title"],Fu={key:0},Hu=Object(r["createElementVNode"])("hr",null,null,-1),Gu=["href"],$u=Object(r["createElementVNode"])("span",{class:"icon-edit"}," ",-1),Ru=["href"],qu=Object(r["createElementVNode"])("span",{class:"icon-add"}," ",-1);function zu(e,t,n,a,i,o){var l,c,s=Object(r["resolveComponent"])("ActivityIndicator"),d=Object(r["resolveComponent"])("EnrichedHeadline"),u=Object(r["resolveComponent"])("ContentBlock"),g=Object(r["resolveDirective"])("content-intro");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",nu,[Object(r["createVNode"])(s,{loading:e.isLoading},null,8,["loading"]),e.isLoading?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",au,[Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("h2",null,[Object(r["createVNode"])(d,{"feature-name":"Tag Manager","inline-help":e.dashboardHelpText},{default:Object(r["withCtx"])((function(){var t;return[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_ContainerX",null===(t=e.container)||void 0===t?void 0:t.name)),1)]})),_:1},8,["inline-help"])]),Object(r["createElementVNode"])("p",iu,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.containerMetaInformation)+" ",1),null!==(l=e.containerVersion)&&void 0!==l&&l.description?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",ru,[ou,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_Description"))+": "+Object(r["toDisplayString"])(null===(c=e.containerVersion)||void 0===c?void 0:c.description),1)])):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.containerDashboardDescription)},null,8,lu)],512),[[g]]),Object(r["createElementVNode"])("div",cu,[Object(r["createElementVNode"])("div",su,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.tagCount," ").concat(e.translate("TagManager_Tags")),"help-text":e.tagsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[e.tagCount?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",du,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedContainerVersionTags,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageTags",{idTag:t.idtag}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,uu),n!==e.sortedContainerVersionTags.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",gu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))])):Object(r["createCommentVNode"])("",!0)]),bu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTags")},[pu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditTags")),1)],8,mu),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTags",{idTag:0})},[fu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTag")),1)],8,hu)]})),_:1},8,["content-title","help-text"])]),Object(r["createElementVNode"])("div",vu,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.triggerCount," ").concat(e.translate("TagManager_Triggers")),"help-text":e.triggersHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[e.triggerCount?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",ju,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedTriggers,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageTriggers",{idTrigger:t.idtrigger}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,Ou),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,", ",512),[[r["vShow"],n!==e.sortedTriggers.length-1]])])})),128))])):Object(r["createCommentVNode"])("",!0)]),Tu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTriggers")},[Vu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditTriggers")),1)],8,yu),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageTriggers",{idTrigger:0})},[Nu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewTrigger")),1)],8,Cu)]})),_:1},8,["content-title","help-text"])])]),Object(r["createElementVNode"])("div",Eu,[Object(r["createElementVNode"])("div",Su,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.variableCount," ").concat(e.translate("TagManager_Variables")),"help-text":e.variablesHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_Names"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedVariables,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{href:e.linkTo("manageVariables",{idVariable:t.idvariable}),title:e.translate("TagManager_EntityDateTypeMetaInformation",t.created_date_pretty,t.updated_date_pretty,t.type)},Object(r["toDisplayString"])(t.name),9,wu),n!==e.sortedVariables.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",ku,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.variableCount]])]),Mu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVariables")},[Du,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditVariables")),1)],8,_u),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVariables",{idVariable:0})},[xu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVariable")),1)],8,Au)]})),_:1},8,["content-title","help-text"])]),Object(r["createElementVNode"])("div",Bu,[Object(r["createVNode"])(u,{feature:"Tag Manager","content-title":"".concat(e.versionCount," ").concat(e.translate("TagManager_Versions")),"help-text":e.versionsHelpText},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_LastVersions"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.lastVersions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("a",{title:e.lastVersionLinkTitle(t),href:e.linkTo("manageVersions",{idContainerVersion:t.idcontainerversion})},Object(r["toDisplayString"])(t.name),9,Lu),n!==e.lastVersions.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Uu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.lastVersions.length]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[Pu,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("TagManager_Environments"))+": ",1),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.container.releases,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:n},[Object(r["createElementVNode"])("span",{title:e.releaseTooltip(t)},Object(r["toDisplayString"])(e.ucfirst(t.environment)),9,Iu),n!==e.container.releases.length-1?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Fu,", ")):Object(r["createCommentVNode"])("",!0)])})),128))],512),[[r["vShow"],e.container.releases.length]])]),Hu,Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVersions")},[$u,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_EditVersions")),1)],8,Gu),Object(r["createElementVNode"])("a",{class:"btn-flat",href:e.linkTo("manageVersions",{idContainerVersion:0})},[qu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_CreateNewVersion")),1)],8,Ru)]})),_:1},8,["content-title","help-text"])])])]))])}function Wu(e){e.sort((function(e,t){return e.namet.name?1:0}))}var Xu=Object(r["defineComponent"])({props:{idContainer:String,dashboardHelpText:String,tagsHelpText:String,triggersHelpText:String,variablesHelpText:String,versionsHelpText:String},components:{ActivityIndicator:u["ActivityIndicator"],EnrichedHeadline:u["EnrichedHeadline"],ContentBlock:u["ContentBlock"]},directives:{ContentIntro:u["ContentIntro"]},data:function(){return{container:null,containerVersion:null,isLoading:!1}},created:function(){var e=this;Qs.init(),this.isLoading=!0;var t=u["AjaxHelper"].fetch({method:"TagManager.getContainer",idContainer:this.idContainer}).then((function(t){e.container=t})),n=u["AjaxHelper"].fetch({method:"TagManager.exportContainerVersion",idContainer:this.idContainer}).then((function(t){e.containerVersion=t}));Promise.all([t,n]).finally((function(){e.isLoading=!1}))},methods:{linkTo:function(e,t){var n=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e}));return t&&(n+="#?".concat(u["MatomoUrl"].stringify(t))),"?".concat(n)},lastVersionLinkTitle:function(e){return"Created on ".concat(e.created_date_pretty)+", description: '".concat(e.description,"'")},releaseTooltip:function(e){var t=Object(u["translate"])("TagManager_ReleaseInfo",e.release_login,e.release_date_pretty),n=Object(u["translate"])("TagManager_ReleaseVersionInfo",e.version_name);return"".concat(t," ").concat(n)},ucfirst:function(e){return"".concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}},computed:{lastVersions:function(){var e,t;return null!==(e=this.container)&&void 0!==e&&null!==(t=e.versions)&&void 0!==t&&t.length?this.container.versions.slice(0,5):[]},contexts:function(){var e={};return Qs.contexts.value.forEach((function(t){var n=t.id,a=t.name;e[n]=a})),e},containerMetaInformation:function(){var e;return Object(u["translate"])("TagManager_ContainerIdInformation",(null===(e=this.containerVersion)||void 0===e?void 0:e.idcontainer)||"")},containerDashboardDescription:function(){return Object(u["translate"])("TagManager_ContainerDashboardDescription",'',"")},sortedContainerVersionTags:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.tags)||[];return Wu(t),t},sortedTriggers:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.triggers)||[];return Wu(t),t},sortedVariables:function(){var e,t=(null===(e=this.containerVersion)||void 0===e?void 0:e.variables)||[];return Wu(t),t},tagCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.tags.length},triggerCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.triggers.length},versionCount:function(){var e;return null===(e=this.container)||void 0===e?void 0:e.versions.length},variableCount:function(){var e;return null===(e=this.containerVersion)||void 0===e?void 0:e.variables.length}}});Xu.render=zu;var Ku=Xu,Ju=["title"],Yu={class:"title"},Zu=Object(r["createElementVNode"])("span",{class:"icon icon-chevron-down"}," ",-1),Qu={class:"dropdown positionInViewport"},eg={class:"custom_select_container"},tg={class:"custom_select_ul_list"},ng=["title"],ag=["href"];function ig(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("ActivityIndicator"),c=Object(r["resolveDirective"])("focus-anywhere-but-here");return Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["tagContainerSelector piwikSelector borderedControl",{expanded:e.showContainerList}]),onClick:t[1]||(t[1]=function(t){e.fetchContainers(),e.showContainerList=!e.showContainerList}),title:e.translate("TagManager_ChooseContainer")},[Object(r["createElementVNode"])("a",Yu,[Zu,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.truncateText(e.actualContainerName,50)),1)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",Qu,[Object(r["createVNode"])(l,{loading:e.isLoading},null,8,["loading"]),Object(r["createElementVNode"])("div",eg,[Object(r["createElementVNode"])("ul",tg,[Object(r["withDirectives"])(Object(r["createElementVNode"])("li",null,[Object(r["createElementVNode"])("a",{tabindex:"-1",onClick:t[0]||(t[0]=Object(r["withModifiers"])((function(){}),["prevent","stop"]))},Object(r["toDisplayString"])(e.translate("TagManager_NoContainersFound")),1)],512),[[r["vShow"],!e.isLoading&&0===e.containers.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.containers,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{title:"".concat(t.name," (").concat(t.idcontainer,")"),key:t.idcontainer},[Object(r["createElementVNode"])("a",{href:e.linkTo(t.idcontainer)},Object(r["toDisplayString"])(t.name)+" ("+Object(r["toDisplayString"])(t.idcontainer)+") ",9,ag)],8,ng)})),128))])])],512),[[r["vShow"],e.showContainerList]])],10,Ju)),[[c,{blur:e.onBlur}]])}var rg=window,og=rg.tagManagerHelper,lg=Object(r["defineComponent"])({props:{containerName:String},components:{ActivityIndicator:u["ActivityIndicator"]},directives:{FocusAnywhereButHere:u["FocusAnywhereButHere"]},data:function(){return{containers:[],isLoading:!1,showContainerList:!1}},created:function(){setTimeout((function(){window.initTopControls()}))},methods:{fetchContainers:function(){var e=this;this.isLoading=!0,this.containers=[],u["AjaxHelper"].fetch({method:"TagManager.getContainers"}).then((function(t){e.containers=t})).finally((function(){e.isLoading=!1}))},linkTo:function(e){var t=u["MatomoUrl"].urlParsed.value.action;t&&"manageContainers"!==t||(t=this.hasWriteAccess?"dashboard":"manageTags");var n=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{idContainer:e,action:t}));return"".concat(window.location.pathname,"?").concat(n)},onBlur:function(){this.showContainerList=!1},truncateText:function(e,t){return og.truncateText(e,t)}},computed:{actualContainerName:function(){return this.containerName?Object(u["translate"])("TagManager_ContainerX",this.containerName):Object(u["translate"])("TagManager_ChooseContainer")},hasWriteAccess:function(){return u["Matomo"].hasUserCapability("tagmanager_write")}}});lg.render=ig;var cg=lg,sg={style:{"margin-left":"-0.75rem"}},dg=Object(r["createElementVNode"])("br",null,null,-1),ug=["href"],gg=["textContent"],bg={style:{"margin-top":"1rem"}},mg=["innerHTML"],pg=Object(r["createElementVNode"])("br",null,null,-1),hg=["href"],fg={class:"environment"},vg={class:"name"},jg={class:"name"},Og={class:"released_by"},Tg={class:"released_on"},yg={key:0},Vg={colspan:"7"},Cg={class:"loadingPiwik"},Ng=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Eg={key:1},Sg={colspan:"7"},wg={class:"environment"},kg={class:"name"},Mg={class:"revision"},_g={class:"released_by"},Dg={class:"released_on"},Ag={class:"date"};function xg(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveComponent"])("ActivityIndicator"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("copy-to-clipboard"),u=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createBlock"])(s,{class:"manageInstallTagCode",feature:"Tag Manager","content-title":"Install Code"},{default:Object(r["withCtx"])((function(){var n,a;return[Object(r["createElementVNode"])("div",sg,[Object(r["createVNode"])(l,{uicontrol:"select",name:"environment","model-value":e.environment,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.environment=t,e.fetchInstallInstructions(e.environment)}),options:e.environments,title:e.translate("TagManager_Environment")},null,8,["model-value","options","title"])]),Object(r["createVNode"])(c,{loading:e.isLoading},null,8,["loading"]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n},[Object(r["createElementVNode"])("p",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.description)+" ",1),dg,t.helpUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,target:"_blank",href:t.helpUrl},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,ug)):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("div",null,[t.embedCode?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("pre",{key:0,textContent:Object(r["toDisplayString"])(t.embedCode)},null,8,gg)),[[d,{}]]):Object(r["createCommentVNode"])("",!0)])])})),128)),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_InstallCodePublishEnvironmentNote","preview"))+" "+Object(r["toDisplayString"])(e.translate("TagManager_ConfigureEnvironmentsSuperUser")),1),Object(r["createElementVNode"])("p",bg,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_InstallCodeDataLayerNote","",""))},null,8,mg),pg,Object(r["createElementVNode"])("a",{target:"_blank",href:e.externalRawLink("https://matomo.org/faq/tag-manager/data-layer-in-matomo-tag-manager/")},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,hg)]),Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("TagManager_ReleasesOverview")),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",fg,Object(r["toDisplayString"])(e.translate("TagManager_Environment")),1),Object(r["createElementVNode"])("th",vg,Object(r["toDisplayString"])(e.translate("TagManager_VersionName")),1),Object(r["createElementVNode"])("th",jg,Object(r["toDisplayString"])(e.translate("TagManager_VersionRevision")),1),Object(r["createElementVNode"])("th",Og,Object(r["toDisplayString"])(e.translate("TagManager_ReleasedBy")),1),Object(r["createElementVNode"])("th",Tg,Object(r["toDisplayString"])(e.translate("TagManager_ReleasedOn")),1)])]),Object(r["createElementVNode"])("tbody",null,[e.isLoading?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",yg,[Object(r["createElementVNode"])("td",Vg,[Object(r["createElementVNode"])("span",Cg,[Ng,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])])):Object(r["createCommentVNode"])("",!0),e.isLoading||0!==(null===(n=e.container)||void 0===n||null===(a=n.releases)||void 0===a?void 0:a.length)?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Eg,[Object(r["createElementVNode"])("td",Sg,Object(r["toDisplayString"])(e.translate("TagManager_NoReleasesFound")),1)])),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedReleases,(function(t){var n,a;return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t.idcontainerrelease},[Object(r["createElementVNode"])("td",wg,Object(r["toDisplayString"])(e.ucfirst(t.environment)),1),Object(r["createElementVNode"])("td",kg,Object(r["toDisplayString"])(null===(n=e.releaseVersions[t.idcontainerrelease])||void 0===n?void 0:n.name),1),Object(r["createElementVNode"])("td",Mg,Object(r["toDisplayString"])(null===(a=e.releaseVersions[t.idcontainerrelease])||void 0===a?void 0:a.revision),1),Object(r["createElementVNode"])("td",_g,Object(r["toDisplayString"])(t.release_login),1),Object(r["createElementVNode"])("td",Dg,[Object(r["createElementVNode"])("span",Ag,Object(r["toDisplayString"])(t.release_date_pretty),1)])])})),128))])],512),[[u]])]})),_:1})}function Bg(e){return Pg(e)||Ug(e)||Hg(e)||Lg()}function Lg(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ug(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Pg(e){if(Array.isArray(e))return Gg(e)}function Ig(e,t){return Rg(e)||$g(e,t)||Hg(e,t)||Fg()}function Fg(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Hg(e,t){if(e){if("string"===typeof e)return Gg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gg(e,t):void 0}}function Gg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt.release_date?-1:t.index-e.index})),t}}});Wg.render=xg;var Xg=Wg,Kg={class:"tagManagerTrackingCode"},Jg={key:0},Yg={class:"trackingCodeAdvancedOptions"},Zg={class:"advance-option"},Qg=Object(r["createElementVNode"])("span",{class:"icon-chevron-down"},null,-1),eb=Object(r["createElementVNode"])("span",{class:"icon-chevron-up"},null,-1),tb={id:"mtm-advanced-options"},nb=["innerHTML"],ab={key:1,class:"row"},ib={class:"col s12 m4 "},rb={class:"form-group row"},ob={class:"col s12 input-field"},lb={for:"tagManagerTrackingCodeSite",class:"siteSelectorLabel"},cb={class:"sites_autocomplete"},sb={class:"col s12 m4"},db={class:"col s12 m4"},ub=["innerHTML"],gb={key:1,class:"alert alert-info"},bb={href:""},mb={key:0},pb=["href"],hb=Object(r["createTextVNode"])(". "),fb=["innerHTML"],vb=["textContent"],jb=["innerHTML"],Ob={key:1};function Tb(e,t,n,a,i,o){var l=this,c=Object(r["resolveComponent"])("ActivityIndicator"),s=Object(r["resolveComponent"])("SiteSelector"),d=Object(r["resolveComponent"])("Field"),u=Object(r["resolveDirective"])("copy-to-clipboard");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Kg,[e.showContainerRow?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",Jg,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_OptionallyCustomiseContainer"))+" ",1),Object(r["createElementVNode"])("div",Yg,[Object(r["createElementVNode"])("div",Zg,[Object(r["createElementVNode"])("span",null,[e.isAdvancedDisplayed?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,href:"javascript:;",onClick:t[0]||(t[0]=Object(r["withModifiers"])((function(t){return e.isAdvancedDisplayed=!0}),["prevent"]))},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("CoreAdminHome_ShowAdvancedOptions"))+" ",1),Qg])),e.isAdvancedDisplayed?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:1,href:"javascript:;",onClick:t[1]||(t[1]=Object(r["withModifiers"])((function(t){return e.isAdvancedDisplayed=!1}),["prevent"]))},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("CoreAdminHome_HideAdvancedOptions"))+" ",1),eb])):Object(r["createCommentVNode"])("",!0)])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",tb,[Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.getAdvancedStepText)},null,8,nb),e.showContainerRow||e.environments.length>1?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createBlock"])(c,{key:0,loading:!0},null,512)),[[r["vShow"],e.isLoading]]):Object(r["createCommentVNode"])("",!0),e.showContainerRow||e.environments.length>1?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ab,[Object(r["createElementVNode"])("div",ib,[Object(r["createElementVNode"])("div",rb,[Object(r["createElementVNode"])("div",ob,[Object(r["createElementVNode"])("label",lb,Object(r["toDisplayString"])(e.translate("General_Website")),1),Object(r["createElementVNode"])("div",cb,[Object(r["createVNode"])(s,{id:"tagManagerTrackingCodeSite",modelValue:e.site,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.site=t}),"show-all-sites-item":!1,"switch-site-on-select":!1,"show-selected-site":!0},null,8,["modelValue"])])])])]),Object(r["createElementVNode"])("div",sb,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(d,{uicontrol:"select",name:"containers","model-value":e.idContainer,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.idContainer=t,e.onContainerChange()}),options:e.containerOptions,disabled:e.containerOptions.length<=1,"full-width":!0,title:e.translate("TagManager_Container")},null,8,["model-value","options","disabled","title"])])]),Object(r["createElementVNode"])("div",db,[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(d,{uicontrol:"select",name:"environment","model-value":e.environment,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.environment=t,l.$emit("fetchInstallInstructions")}),options:e.environments,disabled:e.environments.length<=1,"full-width":!0,title:e.translate("TagManager_Environment")},null,8,["model-value","options","disabled","title"])])])],512)),[[r["vShow"],!e.isLoading]]):Object(r["createCommentVNode"])("",!0),e.idContainer?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:2,innerHTML:e.$sanitize(e.getAdvancedStepInfo)},null,8,ub)):Object(r["createCommentVNode"])("",!0)])],512),[[r["vShow"],e.isAdvancedDisplayed]])])])):Object(r["createCommentVNode"])("",!0),e.idContainer&&e.noReleaseFound?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",gb,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_NoReleasesFoundForContainer"))+" ",1),Object(r["createElementVNode"])("a",bb,Object(r["toDisplayString"])(e.translate("TagManager_PublishVersionToEnvironmentToViewEmbedCode")),1)])):Object(r["createCommentVNode"])("",!0),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],{key:n},[e.showDescription?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",mb,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.description)+" ",1),t.helpUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,target:"_blank",href:t.helpUrl},Object(r["toDisplayString"])(e.translate("TagManager_LearnMore")),9,pb)):Object(r["createCommentVNode"])("",!0),hb])):Object(r["createCommentVNode"])("",!0),e.showPlainMtmSteps?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:1,innerHTML:e.$sanitize(e.getMtmStep3)},null,8,fb)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("pre",{class:"codeblock",textContent:Object(r["toDisplayString"])(t.embedCode),ref:"codeblock"},null,8,vb),[[u,{}]])])],64)})),128)),e.showBottom&&!e.noReleaseFound&&e.idContainer?(Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],{key:2},[e.showTestSection?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",Ob,[(Object(r["openBlock"])(),Object(r["createBlock"])(Object(r["resolveDynamicComponent"])(e.testComponent),{site:e.site},null,8,["site"]))])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:0,innerHTML:e.$sanitize(e.getCongratulationsText)},null,8,jb))],64)):Object(r["createCommentVNode"])("",!0)])}function yb(e){return"".concat(e.substr(0,1).toUpperCase()).concat(e.substr(1))}var Vb=Object(r["defineComponent"])({props:{showContainerRow:Boolean,showBottom:Boolean,showDescription:Boolean,showPlainMtmSteps:Boolean,showTestSection:Boolean,showAdvancedOptions:{required:!1,type:Boolean,default:!1}},components:{ActivityIndicator:u["ActivityIndicator"],SiteSelector:u["SiteSelector"],Field:g["Field"]},emits:["fetchInstallInstructions"],directives:{CopyToClipboard:u["CopyToClipboard"]},data:function(){return{containerVariables:[],isLoading:!1,idContainer:"",environment:"",environments:[],environmentNameMap:{},containerMap:{},containerOptions:[],site:{id:u["Matomo"].idSite,name:u["Matomo"].helper.htmlDecode(u["Matomo"].siteName)},matomoConfigs:[],releases:[],installInstructions:[],noReleaseFound:!1,isAdvancedDisplayed:!1}},created:function(){var e=this;u["AjaxHelper"].fetch({method:"TagManager.getAvailableEnvironments",filter_limit:"-1"}).then((function(t){var n;n=Array.isArray(t)?t:Object.values(t),e.environmentNameMap=Object.fromEntries(n.map((function(e){var t=e.id,n=e.name;return[t,n]})))})),this.onSiteChange(),this.isAdvancedDisplayed=this.showAdvancedOptions},watch:{site:function(){this.onSiteChange()}},methods:{onSiteChange:function(){var e,t=this;this.installInstructions=[],this.containerOptions=[],this.containerMap={},this.environments=[],this.matomoConfigs=[],this.idContainer="",null!==(e=this.site)&&void 0!==e&&e.id&&(this.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainers",filter_limit:"-1",idSite:this.site.id}).then((function(e){if(t.containerOptions=[],null===e||void 0===e||!e.length)return t.idContainer="",t.isAdvancedDisplayed=!0,void t.containerOptions.push({key:"",value:t.translate("TagManager_NoContainersFound")});e.forEach((function(e){t.idContainer||(t.idContainer=e.idcontainer),t.containerMap[e.idcontainer]=e,t.containerOptions.push({key:e.idcontainer,value:e.name})})),t.onContainerChange()})).finally((function(){t.isLoading=!1})))},onContainerChange:function(){var e=this;if(this.noReleaseFound=!1,this.idContainer){this.installInstructions=[];var t=this.containerMap[this.idContainer],n=t.draft.idcontainerversion;this.environment="",this.environments=[];var a=t.releases||[];a.find((function(e){return"live"===e.environment}))&&(this.environment="live"),a.forEach((function(t){if("preview"!==t.environment){e.environment||(e.environment=t.environment);var n=yb(t.environment);t.environment in e.environmentNameMap&&(n=e.environmentNameMap[t.environment]),e.environments.push({key:t.environment,value:n})}})),this.environments.length||(this.noReleaseFound=!0,this.environments.push({key:"",value:this.translate("TagManager_NoReleasesFound")})),this.$emit("fetchInstallInstructions"),this.fetchVariables(n)}},linkTo:function(e,t,n,a){var i=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e,idSite:t,idContainer:n})),r="".concat(window.location.pathname,"?").concat(i);return a&&(r+="#?".concat(u["MatomoUrl"].stringify(a))),r},fetchVariables:function(e){var t,n=this;this.matomoConfigs=[],this.idContainer&&null!==(t=this.site)&&void 0!==t&&t.id&&e&&u["AjaxHelper"].fetch({method:"TagManager.getContainerVariables",filter_limit:"-1",idContainer:this.idContainer,idContainerVersion:e,idSite:this.site.id}).then((function(e){n.matomoConfigs=e.filter((function(e){return"MatomoConfiguration"===e.type}))})).finally((function(){n.isLoading=!1}))}},computed:{getLearnMoreLink:function(){return Object(u["translate"])("TagManager_CustomHtmlTagHelpText",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/"),"")},getMtmStep3:function(){return Object(u["translate"])("TagManager_CopyCodePasteInHeader","</head>")},getCongratulationsText:function(){return Object(u["translate"])("TagManager_SiteWithoutDataReactFollowStepCompleted","","")},testComponent:function(){return this.showTestSection?Object(u["useExternalPluginComponent"])("JsTrackerInstallCheck","JsTrackerInstallCheck"):""},getAdvancedStepText:function(){var e,t=Object(u["translate"])("TagManager_SelectContainerForWebsite","","");if(this.idContainer)return t;var n=this.linkTo("manageContainers",String(null===(e=this.site)||void 0===e?void 0:e.id),""),a=Object(u["translate"])("TagManager_ManageContainersLink",''),"");return"".concat(t," ").concat(a)},getAdvancedStepInfo:function(){var e=this.site&&this.site.id?this.site.id:"",t=this.linkTo("dashboard",e,this.idContainer,[]);return Object(u["translate"])("TagManager_CustomiseContainer",''),"",Object(u["externalLink"])("https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/"),"")}}});Vb.render=Tb;var Cb=Vb,Nb=Object(r["createElementVNode"])("br",null,null,-1),Eb={class:"followStepsHeading"},Sb={style:{"list-style":"inside decimal"}};function wb(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TrackingCodeCommon");return Object(r["openBlock"])(),Object(r["createBlock"])(Object(r["resolveDynamicComponent"])("getTrackingMethodsForSite"===e.currentAction?"div":"ContentBlock"),{anchor:"tagmanager","content-title":e.translate("TagManager_MatomoTagManager")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("TagManager_MtmTrackingCodeIntro")),1),Nb,Object(r["createElementVNode"])("p",Eb,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SitesManager_SiteWithoutDataCloudflareFollowStepsIntro")),1)]),Object(r["createElementVNode"])("ol",Sb,[Object(r["createVNode"])(l,{"show-container-row":e.showContainerRow,showBottom:!0,showDescription:!1,showPlainMtmSteps:!0,showAdvancedOptions:"trackingCodeGenerator"===e.currentAction,showTestSection:"getTrackingMethodsForSite"===e.currentAction&&e.isJsTrackerInstallCheckAvailable,onFetchInstallInstructions:e.fetchInstallInstructions,ref:"trackingCodeCommon"},null,8,["show-container-row","showAdvancedOptions","showTestSection","onFetchInstallInstructions"])])]})),_:1},8,["content-title"])}var kb=Object(r["defineComponent"])({props:{currentAction:String,showContainerRow:Boolean,isJsTrackerInstallCheckAvailable:Boolean},components:{ContentBlock:u["ContentBlock"],TrackingCodeCommon:Cb},methods:{fetchInstallInstructions:function(){var e,t,n=this,a=this.$refs.trackingCodeCommon;a.installInstructions=[],null!==a&&void 0!==a&&null!==(e=a.site)&&void 0!==e&&e.id&&null!==a&&void 0!==a&&a.environment&&(a.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainerInstallInstructions",filter_limit:"-1",idContainer:null===a||void 0===a?void 0:a.idContainer,environment:null===a||void 0===a?void 0:a.environment,idSite:null===a||void 0===a||null===(t=a.site)||void 0===t?void 0:t.id}).then((function(e){a.installInstructions=e,Object(r["nextTick"])((function(){var e=Array.isArray(n.$refs.codeblock)?n.$refs.codeblock:[n.$refs.codeblock];e.forEach((function(e){$(e).effect("highlight",{},1500)}))}))})).finally((function(){a.isLoading=!1})))}}});kb.render=wb;var Mb=kb,_b={class:"list-style-decimal"},Db={ref:"step1"},Ab=["innerHTML"],xb=["innerHTML"],Bb=["textContent"],Lb=["innerHTML"],Ub=["textContent"],Pb=["innerHTML"],Ib=["innerHTML"],Fb=["innerHTML"],Hb=["textContent"],Gb={style:{"list-style":"lower-alpha","list-style-position":"inside"}},$b=["innerHTML"],Rb=["innerHTML"],qb=["innerHTML"],zb=["textContent"],Wb=["textContent"],Xb=["innerHTML"],Kb=["textContent"],Jb=["innerHTML"],Yb=["innerHTML"],Zb=["textContent"];function Qb(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("TrackingCodeCommon"),c=Object(r["resolveDirective"])("copy-to-clipboard");return Object(r["openBlock"])(),Object(r["createElementBlock"])("ol",_b,[Object(r["withDirectives"])(Object(r["createElementVNode"])("li",Db,[Object(r["createVNode"])(l,{"show-container-row":e.showContainerRow,showBottom:!1,showDescription:!1,onFetchInstallInstructions:e.fetchInstallInstructionsSPA,ref:"trackingCodeCommon"},null,8,["show-container-row","onFetchInstallInstructions"])],512),[[r["vShow"],e.step1HasContent]]),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.setupStep2)},null,8,Ab),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep3)},null,8,xb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("TagManager_CreateNewTrigger"))},null,8,Bb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep5)},null,8,Lb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("TagManager_CreateNewTrigger"))},null,8,Ub),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.setupStep7)},null,8,Pb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep8)},null,8,Ib),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep9)},null,8,Fb),Object(r["createElementVNode"])("li",null,[Object(r["createElementVNode"])("span",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep10)},null,8,Hb),Object(r["createElementVNode"])("ol",Gb,[Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep10a)},null,8,$b),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep10b)},null,8,Rb)])]),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep11)},null,8,qb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchClickX("General_Update"))},null,8,zb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep13)},null,8,Wb),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.fetchFollowStep14)},null,8,Xb),Object(r["createElementVNode"])("li",{textContent:Object(r["toDisplayString"])(e.fetchFollowStep15)},null,8,Kb),Object(r["createElementVNode"])("li",null,["react"===e.jsFramework?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:0,innerHTML:e.$sanitize(e.fetchFollowStep16React)},null,8,Jb)):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:1,innerHTML:e.$sanitize(e.fetchFollowStep16SPA)},null,8,Yb)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.installInstructions,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:t},[Object(r["withDirectives"])(Object(r["createElementVNode"])("pre",{class:"codeblock",textContent:Object(r["toDisplayString"])(e.embedCode),ref:"codeblock"},null,8,Zb),[[c,{}]])])})),128))])])}var em=Object(r["defineComponent"])({props:{showContainerRow:Boolean,jsFramework:String},components:{TrackingCodeCommon:Cb},directives:{CopyToClipboard:u["CopyToClipboard"]},data:function(){return{setupStep1:"",setupStep2:"",setupStep7:"",installInstructions:[]}},methods:{fetchInstallInstructionsSPA:function(){var e,t,n=this,a=this.$refs.trackingCodeCommon;if(this.installInstructions=[],null!==a&&void 0!==a&&a.idContainer&&null!==a&&void 0!==a&&a.environment&&null!==a&&void 0!==a&&null!==(e=a.site)&&void 0!==e&&e.id){var i=this.linkTo("manageContainers",a.site.id,a.idContainer);this.setupStep1=Object(u["translate"])("TagManager_SPAFollowStep1","
","",''),"");var o=this.linkTo("manageTriggers",a.site.id,a.idContainer);this.setupStep2=Object(u["translate"])("TagManager_SPAFollowStep2",''),"");var l=this.linkTo("manageTags",a.site.id,a.idContainer);this.setupStep7=Object(u["translate"])("TagManager_SPAFollowStep7",''),""),a.isLoading=!0,u["AjaxHelper"].fetch({method:"TagManager.getContainerInstallInstructions",filter_limit:"-1",idContainer:null===a||void 0===a?void 0:a.idContainer,environment:null===a||void 0===a?void 0:a.environment,idSite:null===a||void 0===a||null===(t=a.site)||void 0===t?void 0:t.id,jsFramework:this.jsFramework}).then((function(e){n.installInstructions=e,Object(r["nextTick"])((function(){var e=Array.isArray(n.$refs.codeblock)?n.$refs.codeblock:[n.$refs.codeblock];e.forEach((function(e){$(e).effect("highlight",{},1500)}))}))})).finally((function(){a.isLoading=!1}))}},linkTo:function(e,t,n,a){var i=u["MatomoUrl"].stringify(Object.assign(Object.assign({},u["MatomoUrl"].urlParsed.value),{},{module:"TagManager",action:e,idSite:t,idContainer:n}));return a&&(i+="#?".concat(u["MatomoUrl"].stringify(a))),"?".concat(i)},fetchClickX:function(e){return Object(u["translate"])("General_ClickX",Object(u["translate"])(e))}},computed:{step1HasContent:function(){var e=this.$refs.step1;return e&&""!==e.textContent},fetchFollowStep3:function(){return Object(u["translate"])("TagManager_SPAFollowStep3","".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),""),Object(u["translate"])("TagManager_PageViewTriggerName"),Object(u["externalLink"])("https://matomo.org/faq/tag-manager/how-do-i-track-pageviews-of-my-website-using-matomo-tag-manager/#create-pageview-trigger"),"")},fetchFollowStep5:function(){return Object(u["translate"])("TagManager_SPAFollowStep5","".concat(Object(u["translate"])("TagManager_HistoryChangeTriggerName"),""),Object(u["translate"])("TagManager_CategoryUserEngagement"))},fetchFollowStep8:function(){return Object(u["translate"])("TagManager_SPAFollowStep8","".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),""),"".concat(Object(u["translate"])("TagManager_MatomoTagName"),""),Object(u["translate"])("TagManager_PageViewTriggerName"),Object(u["externalLink"])("https://matomo.org/faq/tag-manager/how-do-i-track-pageviews-of-my-website-using-matomo-tag-manager/#create-pageview-tag"),"")},fetchFollowStep9:function(){return Object(u["translate"])("TagManager_SPAFollowStep9",Object(u["translate"])("TagManager_ConfigureWhatTagDoes"),Object(u["translate"])("TagManager_CustomTitle"),"","")},fetchFollowStep10:function(){return Object(u["translate"])("TagManager_SPAFollowStep10",Object(u["translate"])("TagManager_CustomUrl"))},fetchFollowStep10a:function(){return Object(u["translate"])("TagManager_SPAFollowStep10a","","",Object(u["translate"])("TagManager_CustomUrl"))},fetchFollowStep10b:function(){return Object(u["translate"])("TagManager_SPAFollowStep10b",Object(u["translate"])("TagManager_CustomUrl"),"","")},fetchFollowStep11:function(){return Object(u["translate"])("TagManager_SPAFollowStep11",Object(u["translate"])("TagManager_ConfigureWhenTagDoes"),Object(u["translate"])("TagManager_FireTriggerTitle"),"".concat(Object(u["translate"])("TagManager_HistoryChangeTriggerName"),""),"".concat(Object(u["translate"])("TagManager_PageViewTriggerName"),""))},fetchFollowStep13:function(){return Object(u["translate"])("TagManager_SPAFollowStep13",Object(u["translate"])("TagManager_Publish"))},fetchFollowStep14:function(){return Object(u["translate"])("TagManager_SPAFollowStep14",Object(u["translate"])("TagManager_VersionName"),"","")},fetchFollowStep15:function(){return Object(u["translate"])("TagManager_SPAFollowStep15",Object(u["translate"])("TagManager_CreateVersionAndPublishRelease"))},fetchFollowStep16SPA:function(){return Object(u["translate"])("TagManager_SPAFollowStep16","</head>",Object(u["externalLink"])("https://developer.matomo.org/guides/tagmanager/embedding"),"")},fetchFollowStep16React:function(){return Object(u["translate"])("TagManager_ReactFollowStep16","","","App.js","React.useEffect","Hello World","React.js")}}});em.render=Qb;var tm,nm,am=em,im={class:"nav-wrapper"},rm={class:"pull-right"},om=Object(r["createElementVNode"])("svg",{class:"tm-icon tm-icon-close"},[Object(r["createElementVNode"])("use",{"xlink:href":"#tm-icon-close"})],-1),lm=[om],cm={class:"pull-right"},sm=Object(r["createElementVNode"])("svg",{"aria-hidden":"true",style:{position:"absolute",width:"0",height:"0",overflow:"hidden"},version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[Object(r["createElementVNode"])("defs",null,[Object(r["createElementVNode"])("symbol",{id:"tm-icon-checkmark",viewBox:"0 0 32 32"},[Object(r["createElementVNode"])("path",{d:"M27 4l-15 15-7-7-5 5 12 12 20-20z"})])])],-1),dm=Object(r["createElementVNode"])("svg",{"aria-hidden":"true",style:{position:"absolute",width:"0",height:"0",overflow:"hidden"},version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[Object(r["createElementVNode"])("symbol",{id:"tm-icon-close",viewBox:"0 0 32 32"},[Object(r["createElementVNode"])("path",{d:"M31.33 0.67c0.893 0.893 0.893 2.34 0 3.232l-27.427 27.427c-0.893 0.893-2.34\n 0.893-3.232 0s-0.893-2.34 0-3.232l27.427-27.427c0.892-0.893 2.34-0.893 3.232 0z"}),Object(r["createElementVNode"])("path",{d:"M0.67 0.67c0.893-0.893 2.34-0.893 3.232 0l27.427 27.427c0.893 0.892 0.893\n 2.34 0 3.232s-2.34 0.892-3.232 0l-27.427-27.427c-0.893-0.893-0.893-2.34 0-3.232z"})])],-1),um={class:"page",style:{clear:"both"}},gm={key:0,id:"secondNavBar",class:"Menu--dashboard z-depth-1"},bm={class:"navbar",role:"menu",style:{padding:"0"}},mm={class:"menuTab",role:"menuitem"},pm={class:"item",style:{"font-weight":"normal"}},hm=Object(r["createTextVNode"])(" Events "),fm={key:0},vm=Object(r["createElementVNode"])("br",null,null,-1),jm=Object(r["createElementVNode"])("br",null,null,-1),Om=Object(r["createElementVNode"])("label",{for:"onlyfiredTags",class:"lbl-onlyfiredTags"},"Only fired tags",-1),Tm={key:0,style:{padding:"0 0 1rem 1.2rem"}},ym=["onClick","title"],Vm={title:"This tag was fired"},Cm=Object(r["createElementVNode"])("svg",{class:"tm-icon tm-icon-checkmark"},[Object(r["createElementVNode"])("use",{"xlink:href":"#tm-icon-checkmark"})],-1),Nm=[Cm],Em={class:"pageWrap"},Sm={class:"home",id:"content"},wm=Object(r["createElementVNode"])("h3",null,"Fired Tags",-1),km={class:"entityTable"},Mm=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Action"),Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type"),Object(r["createElementVNode"])("th",null,"Fired count")])],-1),_m={key:0},Dm=Object(r["createElementVNode"])("td",{colspan:"4"},"No tags",-1),Am=[Dm],xm=Object(r["createElementVNode"])("h3",{style:{"margin-top":"30px"}},"Not Yet Fired Tags",-1),Bm={class:"entityTable"},Lm=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type")])],-1),Um=Object(r["createElementVNode"])("td",{colspan:"4"},"No tags",-1),Pm=[Um],Im=Object(r["createElementVNode"])("h3",null,"Triggers",-1),Fm={class:"entityTable"},Hm=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type")])],-1),Gm={key:0},$m=Object(r["createElementVNode"])("td",{colspan:"4"},"No trigger",-1),Rm=[$m],qm={key:1},zm=Object(r["createElementVNode"])("h3",null,"Pushed data by this event",-1),Wm={class:"entityTable"},Xm={style:{"word-break":"break-all"}},Km=Object(r["createElementVNode"])("br",null,null,-1),Jm=Object(r["createElementVNode"])("h3",null,"Content after this event",-1),Ym={class:"entityTable"},Zm={style:{"word-break":"break-all"}},Qm={class:"entityTable"},ep=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Name"),Object(r["createElementVNode"])("th",null,"Type"),Object(r["createElementVNode"])("th",null,"Value")])],-1),tp={key:0},np=Object(r["createElementVNode"])("td",{colspan:"3"},"No variables",-1),ap=[np],ip={style:{"word-break":"break-all"}},rp={class:"entityTable"},op=Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,"Time"),Object(r["createElementVNode"])("th",null,"Message")])],-1),lp={style:{"word-break":"break-all"}},cp=Object(r["createElementVNode"])("br",null,null,-1);function sp(e,t,n,a,i,o){var l,c,s,d,u,g,b,m,p,h;return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createElementVNode"])("nav",null,[Object(r["createElementVNode"])("div",im,[Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",null,[Object(r["renderSlot"])(e.$slots,"logo")]),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"tags"===e.contentTab||!e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[0]||(t[0]=function(t){return e.contentTab="tags"})},"Tags")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"triggers"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[1]||(t[1]=function(t){return e.contentTab="triggers"})},"Triggers")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"variables"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[2]||(t[2]=function(t){return e.contentTab="variables"})},"Variables")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"dataLayer"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[3]||(t[3]=function(t){return e.contentTab="dataLayer"})},"Data Layer")],2),Object(r["createElementVNode"])("li",{class:Object(r["normalizeClass"])({active:"logs"===e.contentTab})},[Object(r["createElementVNode"])("a",{onClick:t[4]||(t[4]=function(t){return e.contentTab="logs"})},"Logs")],2),Object(r["createElementVNode"])("li",rm,[Object(r["createElementVNode"])("a",{id:"mtmCloseDebug",onClick:t[5]||(t[5]=function(t){return e.mtmCloseDebugWindow()})},lm)]),Object(r["createElementVNode"])("li",cm,[Object(r["createElementVNode"])("a",{id:"mtmUpdateDebugPosition",onClick:t[6]||(t[6]=function(t){return e.mtmUpdateDebugPosition()})},Object(r["toDisplayString"])(e.positionText),1)])])])]),sm,dm,Object(r["createElementVNode"])("div",um,["logs"!==e.contentTab?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",gm,[Object(r["createElementVNode"])("ul",bm,[Object(r["createElementVNode"])("li",mm,[Object(r["createElementVNode"])("span",pm,[hm,e.mtmEvents.length>0?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",fm,[vm,jm,Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{type:"checkbox",class:"onlyFiredTags-chk",name:"onlyfiredTags",id:"onlyfiredTags",value:"1","onUpdate:modelValue":t[7]||(t[7]=function(t){return e.onlyfiredTags=t}),style:{"margin-right":"3.5px"}},null,512),[[r["vModelCheckbox"],e.onlyfiredTags]]),Om])):Object(r["createCommentVNode"])("",!0)])]),0===e.mtmEvents.length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",Tm,"No event executed")):Object(r["createCommentVNode"])("",!0),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.mtmEventsReversed,(function(t,n){var a,i;return Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{class:Object(r["normalizeClass"])(["menuTab",{active:n===e.selectedEventIndex}]),role:"menuitem",key:n},[(t.tags||[]).length||!e.onlyfiredTags?(Object(r["openBlock"])(),Object(r["createElementBlock"])("a",{key:0,class:"item",onClick:function(n){return e.selectEvent(t.index0)},title:"Time: ".concat(t.time,". Trigger: ").concat(null===(a=t.metTrigger)||void 0===a?void 0:a.name)},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.index)+": "+Object(r["toDisplayString"])(t.name)+" ",1),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Vm,Nm,512),[[r["vShow"],null===(i=t.tags)||void 0===i?void 0:i.length]])],8,ym)):Object(r["createCommentVNode"])("",!0)],2)})),128))])])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",Em,[Object(r["createElementVNode"])("div",Sm,[Object(r["withDirectives"])(Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.homeTabTitle),513),[[r["vShow"],"logs"!==e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[wm,Object(r["createElementVNode"])("table",km,[Mm,Object(r["createElementVNode"])("tbody",null,[null!==(l=e.selectedEvent)&&void 0!==l&&null!==(c=l.tags)&&void 0!==c&&c.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",_m,Am)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])((null===(s=e.selectedEvent)||void 0===s?void 0:s.tags)||[],(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.action),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.type),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.numExecuted),1)])})),128))])]),xm,Object(r["createElementVNode"])("table",Bm,[Lm,Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,Pm,512),[[r["vShow"],0===e.notFiredTags.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.notFiredTags,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.type),1)])})),128))])])],512),[[r["vShow"],"tags"===e.contentTab||!e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Im,Object(r["createElementVNode"])("table",Fm,[Hm,Object(r["createElementVNode"])("tbody",null,[null!==(d=e.selectedEvent)&&void 0!==d&&d.metTrigger?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Gm,Rm)),null!==(u=e.selectedEvent)&&void 0!==u&&u.metTrigger?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",qm,[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.selectedEvent.metTrigger.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.selectedEvent.metTrigger.type),1)])):Object(r["createCommentVNode"])("",!0)])])],512),[[r["vShow"],"triggers"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[zm,Object(r["createElementVNode"])("table",Wm,[Object(r["createElementVNode"])("tbody",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Xm,Object(r["toDisplayString"])(e.selectedEventData),1)])])]),Km,Jm,Object(r["createElementVNode"])("table",Ym,[Object(r["createElementVNode"])("tbody",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Zm,Object(r["toDisplayString"])(e.selectedEventContainerDataLayer),1)])])])],512),[[r["vShow"],"dataLayer"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("table",Qm,[ep,Object(r["createElementVNode"])("tbody",null,[null!==(g=e.selectedEvent)&&void 0!==g&&null!==(b=g.container)&&void 0!==b&&null!==(m=b.variables)&&void 0!==m&&m.length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",tp,ap)),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])((null===(p=e.selectedEvent)||void 0===p||null===(h=p.container)||void 0===h?void 0:h.variables)||[],(function(t,n){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:n},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.type),1),Object(r["createElementVNode"])("td",ip,Object(r["toDisplayString"])(e.stringifySelectedVariable(t)),1)])})),128))])])],512),[[r["vShow"],"variables"===e.contentTab]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("table",rp,[op,Object(r["createElementVNode"])("tbody",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.mtmLogs,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:t},[Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.time),1),Object(r["createElementVNode"])("td",lp,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.messages,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:t},[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e),1),cp])})),128))])])})),128))])])],512),[[r["vShow"],"logs"===e.contentTab]])])])])])}function dp(e){return mp(e)||bp(e)||gp(e)||up()}function up(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gp(e,t){if(e){if("string"===typeof e)return pp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pp(e,t):void 0}}function bp(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function mp(e){if(Array.isArray(e))return pp(e)}function pp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nt||n.push.apply(n,dp(e.tags.map((function(e){return e.name}))))}));var a=[];return this.selectedEvent.container.tags.forEach((function(e){-1===n.indexOf(e.name)&&a.push(e)})),a},selectedEvent:function(){return this.mtmEvents[this.selectedEventIndex]},mtmEvents:function(){return window.mtmDbgData.mtmEvents},mtmEventsReversed:function(){var e=dp(this.mtmEvents);return e.reverse(),e},mtmLogs:function(){return window.mtmDbgData.mtmLogs},selectedEventData:function(){var e;return(null===(e=this.selectedEvent)||void 0===e?void 0:e.eventData)&&JSON.stringify(this.selectedEvent.eventData,Op())},selectedEventContainerDataLayer:function(){var e,t;return(null===(e=this.selectedEvent)||void 0===e||null===(t=e.container)||void 0===t?void 0:t.dataLayer)&&JSON.stringify(this.selectedEvent.container.dataLayer,Op())}}});Tp.render=sp;var yp=Tp,Vp={class:"copyMtmObjectDialog"},Cp=["innerHTML"];function Np(e,t,n,a,i,o){var l=Object(r["resolveComponent"])("Field"),c=Object(r["resolveDirective"])("form");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Vp,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.getCopyDialogTitle),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.getCopyDescription),1),Object(r["withDirectives"])(Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{uicontrol:"site",name:"destinationSite",title:e.translate("TagManager_ChooseWebsite"),modelValue:e.site,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.site=t})},null,8,["title","modelValue"]),"container"!==e.copyType.toLowerCase()?(Object(r["openBlock"])(),Object(r["createBlock"])(l,{key:0,uicontrol:"select",name:"idDestinationContainer",options:e.containerOptions,disabled:e.containerOptions.length<=1,"full-width":!0,title:e.translate("TagManager_Container"),modelValue:e.idDestinationContainer,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.idDestinationContainer=t})},null,8,["options","disabled","title","modelValue"])):Object(r["createCommentVNode"])("",!0),"container"===e.copyType.toLowerCase()?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:1,class:"copyNote",innerHTML:e.$sanitize(e.getCopyContainerNote)},null,8,Cp)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("button",{class:"btn",onClick:t[2]||(t[2]=function(){return e.performCopy&&e.performCopy.apply(e,arguments)})},Object(r["toDisplayString"])(e.translate("General_Copy")),1)],512),[[c]])])}var Ep=Object(r["defineComponent"])({props:{defaultSite:{type:Object,required:!0},copyType:{type:String,required:!0},copyNonce:{type:String,required:!1,default:""},idToCopy:{type:[String,Number],required:!0},idSourceContainer:{type:String,required:!1,default:""},idContainerVersion:{type:Number,required:!1,default:0}},directives:{Form:g["Form"]},components:{Field:g["Field"]},data:function(){return{site:this.defaultSite,idDestinationContainer:"",containerOptions:[]}},created:function(){this.onSiteChange(),this.idDestinationContainer=this.idSourceContainer},watch:{site:function(){this.onSiteChange()}},methods:{onSiteChange:function(){var e,t=this;"container"!==this.copyType.toLowerCase()&&(this.containerOptions=[],this.idDestinationContainer="",null!==(e=this.site)&&void 0!==e&&e.id&&u["AjaxHelper"].fetch({method:"TagManager.getContainers",filter_limit:"-1",idSite:this.site.id}).then((function(e){if(t.containerOptions=[],null===e||void 0===e||!e.length)return t.idDestinationContainer="",void t.containerOptions.push({key:"",value:t.translate("TagManager_NoContainersFound")});e.forEach((function(e){t.idDestinationContainer||(t.idDestinationContainer=e.idcontainer),t.containerOptions.push({key:e.idcontainer,value:e.name})}))})))},performCopy:function(){var e,t=this,n={module:"TagManager",action:"",idSite:this.defaultSite.id,idDestinationSite:null!==(e=this.site)&&void 0!==e&&e.id?this.site.id:0,nonce:this.copyNonce,idDestinationContainer:"",idSourceContainer:"",idContainerVersion:0,idContainer:0,idTag:0,idTrigger:0,idVariable:0};switch(this.copyType.toLowerCase()){case"container":n.action="copyContainer",n.idContainer=this.idToCopy;break;case"tag":n.action="copyTag",n.idTag=this.idToCopy;break;case"trigger":n.action="copyTrigger",n.idTrigger=this.idToCopy;break;case"variable":n.action="copyVariable",n.idVariable=this.idToCopy;break;default:throw Error("Unrecognised copy object type.")}this.idDestinationContainer&&(n.idDestinationContainer=this.idDestinationContainer),this.idSourceContainer&&(n.idSourceContainer=this.idSourceContainer),this.idContainerVersion>0&&(n.idContainerVersion=this.idContainerVersion),u["AjaxHelper"].fetch(n).then((function(e){if(!e||!e.isSuccess||!e.urlToNewCopy){var n=Object(u["translate"])("General_ErrorRequest","",""),a=u["NotificationsStore"].show({message:n,id:"CopyDialogResultNotification",context:"error",type:"transient"});return u["NotificationsStore"].scrollToNotification(a),void window.Piwik_Popover.close()}t.reloadEntityStore(),t.displaySuccessNotification(e.urlToNewCopy),window.Piwik_Popover.close()}))},reloadEntityStore:function(){switch(this.copyType.toLowerCase()){case"container":ud.reload();break;case"tag":mo.reload(this.idSourceContainer,this.idContainerVersion);break;case"trigger":ya.fetchTriggers(this.idSourceContainer,this.idContainerVersion);break;case"variable":ft.fetchVariables(this.idSourceContainer,this.idContainerVersion);break;default:throw Error("Unrecognised copy object type.")}},displaySuccessNotification:function(e){var t="TagManager_CopyXSuccess",n="";switch(this.copyType.toLowerCase()){case"container":n="TagManager_ContainerLowercase";break;case"tag":n="TagManager_TagLowercase";break;case"trigger":n="TagManager_TriggerLowercase";break;case"variable":n="TagManager_VariableLowercase";break;default:throw Error("Unrecognised copy object type.")}var a=Object(u["translate"])(t,[''),Object(u["translate"])(n),""]),i=u["NotificationsStore"].show({message:a,id:"CopyDialogResultNotification",context:"success",type:"transient"});u["NotificationsStore"].scrollToNotification(i)}},computed:{getCopyDialogTitle:function(){var e="";switch(this.copyType.toLowerCase()){case"container":e=Object(u["translate"])("TagManager_Container");break;case"tag":e=Object(u["translate"])("TagManager_Tag");break;case"trigger":e=Object(u["translate"])("TagManager_Trigger");break;case"variable":e=Object(u["translate"])("TagManager_Variable");break;default:throw Error("Unrecognised copy object type.")}return Object(u["translate"])("TagManager_CopyX",e)},getCopyDescription:function(){if("container"===this.copyType.toLowerCase())return Object(u["translate"])("TagManager_CopyContainerDescription");var e="";switch(this.copyType.toLowerCase()){case"tag":e=Object(u["translate"])("TagManager_TagLowercase");break;case"trigger":e=Object(u["translate"])("TagManager_TriggerLowercase");break;case"variable":e=Object(u["translate"])("TagManager_VariableLowercase");break;default:throw Error("Unrecognised copy object type.")}return Object(u["translate"])("TagManager_CopyXDescription",e)},getCopyContainerNote:function(){return Object(u["translate"])("TagManager_CopyContainerNote","","")},getCopyUrl:function(){var e,t={module:"TagManager",action:"",idSite:this.defaultSite.id,idDestinationSite:null!==(e=this.site)&&void 0!==e&&e.id?this.site.id:0,nonce:this.copyNonce,idDestinationContainer:"",idSourceContainer:"",idContainerVersion:0,idContainer:0,idTag:0,idTrigger:0,idVariable:0};switch(this.copyType.toLowerCase()){case"container":t.action="copyContainer",t.idContainer=this.idToCopy;break;case"tag":t.action="copyTag",t.idTag=this.idToCopy;break;case"trigger":t.action="copyTrigger",t.idTrigger=this.idToCopy;break;case"variable":t.action="copyVariable",t.idVariable=this.idToCopy;break;default:throw Error("Unrecognised copy object type.")}return this.idDestinationContainer&&(t.idDestinationContainer=this.idDestinationContainer),this.idSourceContainer&&(t.idSourceContainer=this.idSourceContainer),this.idContainerVersion>0&&(t.idContainerVersion=this.idContainerVersion),"?".concat(u["MatomoUrl"].stringify(t))}}});Ep.render=Np;var Sp=Ep; /*! * Matomo - free/libre analytics platform * diff --git a/vue/src/CopyDialog/CopyDialog.less b/vue/src/CopyDialog/CopyDialog.less index 986e5ed2c..3e0c29327 100644 --- a/vue/src/CopyDialog/CopyDialog.less +++ b/vue/src/CopyDialog/CopyDialog.less @@ -2,7 +2,7 @@ div.copyMtmObjectDialog { width: 500px; padding: 0.2rem; - a.btn { + button.btn { float: right; margin: 2rem 1rem 1rem 1rem; } @@ -12,7 +12,7 @@ div.copyMtmObjectDialog { } } -div.mtmCopyContainer { +div.mtmCopyContainer, div.mtmCopyTag { #Piwik_Popover { overflow: visible; } diff --git a/vue/src/CopyDialog/CopyDialog.vue b/vue/src/CopyDialog/CopyDialog.vue index f1f3f61bb..6bce38916 100644 --- a/vue/src/CopyDialog/CopyDialog.vue +++ b/vue/src/CopyDialog/CopyDialog.vue @@ -9,7 +9,6 @@ :title="translate('TagManager_ChooseWebsite')" v-model="site" /> -

- {{ translate('General_Copy') }} + @@ -34,7 +33,7 @@ import { } from 'vue'; import { AjaxHelper, - MatomoUrl, + MatomoUrl, NotificationsStore, SiteRef, translate, } from 'CoreHome'; @@ -42,8 +41,11 @@ import { Form, Field, } from 'CorePluginsAdmin'; -import { ContainerSelector } from '../index.ts'; import { Container } from '../types.ts'; +import TagsStore from '../Tag/Tags.store'; +import ContainersStore from '../Container/Containers.store'; +import TriggersStore from '../Trigger/Triggers.store'; +import VariablesStore from '../Variable/Variables.store'; interface Option { key: string; @@ -56,6 +58,21 @@ interface CopyDialogState { site: SiteRef|null; } +interface CopyRequestParams { + module: string; + action: string; + idSite: number; + idDestinationSite: string|number; + nonce: string; + idDestinationContainer: string; + idSourceContainer: string; + idContainerVersion: number; + idContainer: string|number; + idTag: string|number; + idTrigger: string|number; + idVariable: string|number; +} + export default defineComponent({ props: { defaultSite: { @@ -75,13 +92,22 @@ export default defineComponent({ type: [String, Number], required: true, }, + idSourceContainer: { + type: String, + required: false, + default: '', + }, + idContainerVersion: { + type: Number, + required: false, + default: 0, + }, }, directives: { Form, }, components: { Field, - ContainerSelector, }, data(): CopyDialogState { return { @@ -92,6 +118,7 @@ export default defineComponent({ }, created() { this.onSiteChange(); + this.idDestinationContainer = this.idSourceContainer; }, watch: { site() { @@ -140,6 +167,133 @@ export default defineComponent({ }); }); }, + performCopy() { + const requestParams: CopyRequestParams = { + module: 'TagManager', + action: '', + idSite: this.defaultSite.id, + idDestinationSite: this.site?.id ? this.site.id : 0, + nonce: this.copyNonce, + idDestinationContainer: '', + idSourceContainer: '', + idContainerVersion: 0, + idContainer: 0, + idTag: 0, + idTrigger: 0, + idVariable: 0, + }; + + switch (this.copyType.toLowerCase()) { + case 'container': + requestParams.action = 'copyContainer'; + requestParams.idContainer = this.idToCopy; + break; + case 'tag': + requestParams.action = 'copyTag'; + requestParams.idTag = this.idToCopy; + break; + case 'trigger': + requestParams.action = 'copyTrigger'; + requestParams.idTrigger = this.idToCopy; + break; + case 'variable': + requestParams.action = 'copyVariable'; + requestParams.idVariable = this.idToCopy; + break; + default: + throw Error('Unrecognised copy object type.'); + } + + if (this.idDestinationContainer) { + requestParams.idDestinationContainer = this.idDestinationContainer; + } + + if (this.idSourceContainer) { + requestParams.idSourceContainer = this.idSourceContainer; + } + + if (this.idContainerVersion > 0) { + requestParams.idContainerVersion = this.idContainerVersion; + } + + AjaxHelper.fetch(requestParams).then((response) => { + // If there was an issue with the response, display a generic error + if (!response || !response.isSuccess || !response.urlToNewCopy) { + const message = translate('General_ErrorRequest', '', ''); + const notificationInstanceId = NotificationsStore.show({ + message, + id: 'CopyDialogResultNotification', + context: 'error', + type: 'transient', + }); + NotificationsStore.scrollToNotification(notificationInstanceId); + + window.Piwik_Popover.close(); + return; + } + + // Close the modal, reload the store, and display notification + this.reloadEntityStore(); + this.displaySuccessNotification(response.urlToNewCopy); + window.Piwik_Popover.close(); + }); + }, + reloadEntityStore() { + switch (this.copyType.toLowerCase()) { + case 'container': + ContainersStore.reload(); + break; + case 'tag': + TagsStore.reload(this.idSourceContainer, this.idContainerVersion); + break; + case 'trigger': + TriggersStore.fetchTriggers(this.idSourceContainer, this.idContainerVersion); + break; + case 'variable': + VariablesStore.fetchVariables(this.idSourceContainer, this.idContainerVersion); + break; + default: + throw Error('Unrecognised copy object type.'); + } + }, + displaySuccessNotification(urlToNewCopy: string) { + const mainTranslation = 'TagManager_CopyXSuccess'; + let typeTranslation = ''; + + switch (this.copyType.toLowerCase()) { + case 'container': + typeTranslation = 'TagManager_ContainerLowercase'; + break; + case 'tag': + typeTranslation = 'TagManager_TagLowercase'; + break; + case 'trigger': + typeTranslation = 'TagManager_TriggerLowercase'; + break; + case 'variable': + typeTranslation = 'TagManager_VariableLowercase'; + break; + default: + throw Error('Unrecognised copy object type.'); + } + + const message = translate( + mainTranslation, + [ + ``, + translate(typeTranslation), + '', + ], + ); + + const notificationInstanceId = NotificationsStore.show({ + message, + id: 'CopyDialogResultNotification', + context: 'success', + type: 'transient', + }); + NotificationsStore.scrollToNotification(notificationInstanceId); + }, }, computed: { getCopyDialogTitle() { @@ -189,38 +343,54 @@ export default defineComponent({ return translate('TagManager_CopyContainerNote', '', ''); }, getCopyUrl() { - let actionName = ''; + const requestParams: CopyRequestParams = { + module: 'TagManager', + action: '', + idSite: this.defaultSite.id, + idDestinationSite: this.site?.id ? this.site.id : 0, + nonce: this.copyNonce, + idDestinationContainer: '', + idSourceContainer: '', + idContainerVersion: 0, + idContainer: 0, + idTag: 0, + idTrigger: 0, + idVariable: 0, + }; + switch (this.copyType.toLowerCase()) { case 'container': - actionName = 'copyContainer'; + requestParams.action = 'copyContainer'; + requestParams.idContainer = this.idToCopy; break; case 'tag': - actionName = 'copyTag'; + requestParams.action = 'copyTag'; + requestParams.idTag = this.idToCopy; break; case 'trigger': - actionName = 'copyTrigger'; + requestParams.action = 'copyTrigger'; + requestParams.idTrigger = this.idToCopy; break; case 'variable': - actionName = 'copyVariable'; + requestParams.action = 'copyVariable'; + requestParams.idVariable = this.idToCopy; break; default: throw Error('Unrecognised copy object type.'); } - const requestParams = { - module: 'TagManager', - action: actionName, - idSite: this.defaultSite.id, - idDestinationSite: this.site?.id, - idContainer: this.idToCopy, - nonce: this.copyNonce, - idDestinationContainer: '', - }; - if (this.idDestinationContainer) { requestParams.idDestinationContainer = this.idDestinationContainer; } + if (this.idSourceContainer) { + requestParams.idSourceContainer = this.idSourceContainer; + } + + if (this.idContainerVersion > 0) { + requestParams.idContainerVersion = this.idContainerVersion; + } + return `?${MatomoUrl.stringify(requestParams)}`; }, }, diff --git a/vue/src/Tag/TagList.vue b/vue/src/Tag/TagList.vue index b97391671..d9bea5bc4 100644 --- a/vue/src/Tag/TagList.vue +++ b/vue/src/Tag/TagList.vue @@ -135,7 +135,7 @@ {{ tag.updated_date_pretty }} + @@ -385,6 +394,18 @@ export default defineComponent({ NotificationsStore.scrollToNotification(instanceId); }, 200); }, + openCopyDialog(tag: Tag) { + const url = MatomoUrl.stringify({ + module: 'TagManager', + action: 'copyTagDialog', + idSite: tag.idsite, + idContainer: this.idContainer, + idTag: tag.idtag, + idContainerVersion: this.idContainerVersion, + }); + + window.Piwik_Popover.createPopupAndLoadUrl(url, '', 'mtmCopyTag'); + }, }, computed: { triggers() { @@ -456,6 +477,10 @@ export default defineComponent({ actionTranslatedText(): string { return this.translate('TagManager_TagsActionDescription'); }, + getActionClasses(): string { + const copyClass = this.hasPublishCapability() ? ' hasCopyAction' : ''; + return `action${copyClass}`; + }, }, });