diff --git a/API.php b/API.php index 02986e0f4..99699c0d6 100644 --- a/API.php +++ b/API.php @@ -40,6 +40,9 @@ use Piwik\Plugins\TagManager\Template\Variable\VariablesProvider; use Exception; use Piwik\UrlHelper; +use Piwik\Validators\BaseValidator; +use Piwik\Validators\CharacterLength; +use Piwik\Validators\NotEmpty; /** * API for plugin Tag Manager. @@ -1167,6 +1170,7 @@ public function createContainerVersion($idSite, $idContainer, $name, $descriptio $this->accessValidator->checkUseCustomTemplatesCapability($idSite); } $this->containers->checkContainerExists($idSite, $idContainer); + BaseValidator::check(Piwik::translate('TagManager_VersionName'), $name, [new NotEmpty(), new CharacterLength(1, 30)]); if (empty($idContainerVersion)) { $idContainerVersion = $this->getContainerDraftVersion($idSite, $idContainer); @@ -1196,6 +1200,7 @@ public function updateContainerVersion($idSite, $idContainer, $idContainerVersio if (!Piwik::isUserHasCapability($idSite, PublishLiveContainer::ID) && !Piwik::isUserHasCapability($idSite, PublishLiveContainer::ID)) { $this->accessValidator->checkUseCustomTemplatesCapability($idSite); } + BaseValidator::check(Piwik::translate('TagManager_VersionName'), $name, [new NotEmpty(), new CharacterLength(1, 30)]); $this->containers->checkContainerVersionExists($idSite, $idContainer, $idContainerVersion); return $this->containers->updateContainerVersion($idSite, $idContainer, $idContainerVersion, $name, $description); diff --git a/tests/Fixtures/TagManagerFixture.php b/tests/Fixtures/TagManagerFixture.php index dccbcfc75..4e1c6f3bd 100644 --- a/tests/Fixtures/TagManagerFixture.php +++ b/tests/Fixtures/TagManagerFixture.php @@ -161,7 +161,7 @@ public function setUpContainers() $this->idContainer1Version3 = $this->api->createContainerVersion($this->idSite2, $this->idContainer1, 'container1_v3', 'Version from draft with tags, triggers and variables'); $this->idContainer1Version4 = $this->api->createContainerVersion($this->idSite2, $this->idContainer1, 'container1_v4_reversioned', 'new version from an older version', $this->idContainer1Version2); - $this->idContainerQuotesVersion1 = $this->api->createContainerVersion($this->idSite2, $this->idContainerQuotes, 'container1_v4_reversioned "Quotes"', 'new version for quotes container'); + $this->idContainerQuotesVersion1 = $this->api->createContainerVersion($this->idSite2, $this->idContainerQuotes, 'container1_v4_rev "Quotes"', 'new version for quotes container'); $this->addContainerVariable($this->idSite2, $this->idContainer1, $this->idContainer1DraftVersion, null, 'My Var 3', array('dataLayerName' => 'dataVarName'), false, [], 'My Var 3 description'); diff --git a/tests/Integration/APITest.php b/tests/Integration/APITest.php index c08ac7138..5568312ea 100644 --- a/tests/Integration/APITest.php +++ b/tests/Integration/APITest.php @@ -384,6 +384,16 @@ public function test_updateContainerVersion_shouldFailWhenContainerVersionDoesNo $this->api->updateContainerVersion($this->idSite, $this->idContainer, 99999, 'TheName'); } + public function test_updateContainerVersion_shouldThrowExceptionForInvalidNameLength() + { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Version name: The value contains "48" characters but should contain at most 30 characters.'); + + $this->setSuperUser(); + $idContainerVersion = $this->api->createContainerVersion($this->idSite, $this->idContainer, 'My Name'); + $this->api->updateContainerVersion($this->idSite, $this->idContainer, $idContainerVersion, 'My Name very long name should throw an exception', 'TheName'); + } + public function test_createContainerVersion_shouldFailWhenNotHavingViewPermissions() { $this->expectException(\Piwik\NoAccessException::class); @@ -402,6 +412,15 @@ public function test_createContainerVersion_shouldFailWhenContainerVersionDoesNo $this->api->createContainerVersion($this->idSite, $this->idContainer, 'TheName'); } + public function test_createContainerVersion_shouldThrowExceptionForInvalidNameLength() + { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Version name: The value contains "48" characters but should contain at most 30 characters.'); + + $this->setSuperUser(); + $this->api->createContainerVersion($this->idSite, $this->idContainer, 'My Name very long name should throw an exception'); + } + public function test_deleteContainerVersion_shouldFailWhenNotHavingViewPermissions() { $this->expectException(\Piwik\NoAccessException::class); diff --git a/tests/System/expected/test_with_containers__TagManager.getContainers.xml b/tests/System/expected/test_with_containers__TagManager.getContainers.xml index 5c8e2643b..3523bfb49 100644 --- a/tests/System/expected/test_with_containers__TagManager.getContainers.xml +++ b/tests/System/expected/test_with_containers__TagManager.getContainers.xml @@ -21,7 +21,7 @@ 2 active 1 - container1_v4_reversioned "Quotes" + container1_v4_rev "Quotes" new version for quotes container @@ -45,7 +45,7 @@ superUserLogin - container1_v4_reversioned "Quotes" + container1_v4_rev "Quotes" 6 @@ -57,7 +57,7 @@ superUserLogin - container1_v4_reversioned "Quotes" + container1_v4_rev "Quotes" 7 @@ -69,7 +69,7 @@ superUserLogin - container1_v4_reversioned "Quotes" + container1_v4_rev "Quotes" 8 diff --git a/vue/dist/TagManager.umd.js b/vue/dist/TagManager.umd.js index 2c065c588..d911415bf 100644 --- a/vue/dist/TagManager.umd.js +++ b/vue/dist/TagManager.umd.js @@ -6027,60 +6027,60 @@ function TagManagevue_type_template_id_02e1fe94_render(_ctx, _cache, $props, $se TagManagevue_type_script_lang_ts.render = TagManagevue_type_template_id_02e1fe94_render /* harmony default export */ var TagManage = (TagManagevue_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/Version/VersionEdit.vue?vue&type=template&id=325d9698 +// 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/Version/VersionEdit.vue?vue&type=template&id=434fe2da -var VersionEditvue_type_template_id_325d9698_hoisted_1 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_1 = { class: "editVersion tagManagerManageEdit" }; -var VersionEditvue_type_template_id_325d9698_hoisted_2 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_2 = { class: "loadingPiwik" }; -var VersionEditvue_type_template_id_325d9698_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +var VersionEditvue_type_template_id_434fe2da_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); -var VersionEditvue_type_template_id_325d9698_hoisted_4 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_4 = { class: "loadingPiwik" }; -var VersionEditvue_type_template_id_325d9698_hoisted_5 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +var VersionEditvue_type_template_id_434fe2da_hoisted_5 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); -var VersionEditvue_type_template_id_325d9698_hoisted_6 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_6 = { key: 0 }; -var VersionEditvue_type_template_id_325d9698_hoisted_7 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_7 = { key: 0 }; -var VersionEditvue_type_template_id_325d9698_hoisted_8 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_8 = { key: 1 }; -var VersionEditvue_type_template_id_325d9698_hoisted_9 = ["innerHTML"]; -var VersionEditvue_type_template_id_325d9698_hoisted_10 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_9 = ["innerHTML"]; +var VersionEditvue_type_template_id_434fe2da_hoisted_10 = { key: 2, class: "versionChanges" }; -var VersionEditvue_type_template_id_325d9698_hoisted_11 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_11 = { key: 0 }; -var VersionEditvue_type_template_id_325d9698_hoisted_12 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_12 = { colspan: "4" }; -var VersionEditvue_type_template_id_325d9698_hoisted_13 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_13 = { key: 1 }; -var VersionEditvue_type_template_id_325d9698_hoisted_14 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_14 = { colspan: "4" }; -var VersionEditvue_type_template_id_325d9698_hoisted_15 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_15 = { class: "lastUpdated" }; -var VersionEditvue_type_template_id_325d9698_hoisted_16 = { +var VersionEditvue_type_template_id_434fe2da_hoisted_16 = { class: "entityCancel" }; -function VersionEditvue_type_template_id_325d9698_render(_ctx, _cache, $props, $setup, $data, $options) { +function VersionEditvue_type_template_id_434fe2da_render(_ctx, _cache, $props, $setup, $data, $options) { var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); var _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); @@ -6091,18 +6091,18 @@ function VersionEditvue_type_template_id_325d9698_render(_ctx, _cache, $props, $ 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", VersionEditvue_type_template_id_325d9698_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", VersionEditvue_type_template_id_434fe2da_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { feature: "Tag Manager", "content-title": _ctx.editTitle }, { default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { var _ctx$version$environm; - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", VersionEditvue_type_template_id_325d9698_hoisted_2, [VersionEditvue_type_template_id_325d9698_hoisted_3, 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]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", VersionEditvue_type_template_id_325d9698_hoisted_4, [VersionEditvue_type_template_id_325d9698_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_UpdatingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", VersionEditvue_type_template_id_434fe2da_hoisted_2, [VersionEditvue_type_template_id_434fe2da_hoisted_3, 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]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", VersionEditvue_type_template_id_434fe2da_hoisted_4, [VersionEditvue_type_template_id_434fe2da_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_UpdatingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { onSubmit: _cache[6] || (_cache[6] = function ($event) { return _ctx.edit ? _ctx.updateVersion() : _ctx.createVersion(); }) - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [_ctx.hasPublishCapability() || _ctx.hasWriteCapability() && _ctx.hasPublishToLiveCapability() ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", VersionEditvue_type_template_id_325d9698_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [_ctx.hasPublishCapability() || _ctx.hasWriteCapability() && _ctx.hasPublishToLiveCapability() ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", VersionEditvue_type_template_id_434fe2da_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "text", name: "name", "inline-help": _ctx.versionNameHelpText, @@ -6138,7 +6138,7 @@ function VersionEditvue_type_template_id_325d9698_render(_ctx, _cache, $props, $ disabled: _ctx.isUpdating || !_ctx.isDirty, saving: _ctx.isUpdating, value: _ctx.edit ? _ctx.translate('CoreUpdater_UpdateTitle') : _ctx.translate('TagManager_CreateVersionWithoutPublishing') - }, null, 8, ["disabled", "saving", "value"]), _ctx.create && _ctx.environments.length ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", VersionEditvue_type_template_id_325d9698_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, ["disabled", "saving", "value"]), _ctx.create && _ctx.environments.length ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", VersionEditvue_type_template_id_434fe2da_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "select", name: "environment", "inline-help": _ctx.selectTagManagerEnvironmentHelp, @@ -6163,17 +6163,17 @@ function VersionEditvue_type_template_id_325d9698_render(_ctx, _cache, $props, $ disabled: _ctx.isUpdating || !_ctx.isDirty, saving: _ctx.isUpdating, value: _ctx.translate('TagManager_CreateVersionAndPublishRelease') - }, null, 8, ["disabled", "saving", "value"])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", VersionEditvue_type_template_id_325d9698_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + }, null, 8, ["disabled", "saving", "value"])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", VersionEditvue_type_template_id_434fe2da_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "alert alert-warning", innerHTML: _ctx.$sanitize(_ctx.showNoAccessErrorMessage) - }, null, 8, VersionEditvue_type_template_id_325d9698_hoisted_9)])), _ctx.lastVersion ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", VersionEditvue_type_template_id_325d9698_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_ChangesSinceLastVersion')) + ":", 1), 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", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SitesManager_Type')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_Change')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_LastUpdated')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [_ctx.isLoadingVersionChanges ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", VersionEditvue_type_template_id_325d9698_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", VersionEditvue_type_template_id_325d9698_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ActivityIndicator, { + }, null, 8, VersionEditvue_type_template_id_434fe2da_hoisted_9)])), _ctx.lastVersion ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", VersionEditvue_type_template_id_434fe2da_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_ChangesSinceLastVersion')) + ":", 1), 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", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SitesManager_Type')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_Change')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('TagManager_LastUpdated')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [_ctx.isLoadingVersionChanges ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", VersionEditvue_type_template_id_434fe2da_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", VersionEditvue_type_template_id_434fe2da_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ActivityIndicator, { "loading-message": _ctx.translate('TagManager_DetectingChanges'), loading: true - }, null, 8, ["loading-message"])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.versionChanges.length && !_ctx.isLoadingVersionChanges ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", VersionEditvue_type_template_id_325d9698_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", VersionEditvue_type_template_id_325d9698_hoisted_14, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UserCountryMap_None')), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), (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"])(_ctx.versionChanges, function (versionChange, index) { + }, null, 8, ["loading-message"])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.versionChanges.length && !_ctx.isLoadingVersionChanges ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", VersionEditvue_type_template_id_434fe2da_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", VersionEditvue_type_template_id_434fe2da_hoisted_14, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UserCountryMap_None')), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), (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"])(_ctx.versionChanges, function (versionChange, index) { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { key: index - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate(versionChange.entityType)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(versionChange.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate(versionChange.type)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", VersionEditvue_type_template_id_325d9698_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(versionChange.lastChanged), 1)])]); - }), 128))])], 512), [[_directive_content_table]])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", VersionEditvue_type_template_id_325d9698_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate(versionChange.entityType)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(versionChange.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate(versionChange.type)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", VersionEditvue_type_template_id_434fe2da_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(versionChange.lastChanged), 1)])]); + }), 128))])], 512), [[_directive_content_table]])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", VersionEditvue_type_template_id_434fe2da_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { onClick: _cache[5] || (_cache[5] = function ($event) { return _ctx.cancel(); }) @@ -6182,7 +6182,7 @@ function VersionEditvue_type_template_id_325d9698_render(_ctx, _cache, $props, $ _: 1 }, 8, ["content-title"])]); } -// CONCATENATED MODULE: ./plugins/TagManager/vue/src/Version/VersionEdit.vue?vue&type=template&id=325d9698 +// CONCATENATED MODULE: ./plugins/TagManager/vue/src/Version/VersionEdit.vue?vue&type=template&id=434fe2da // CONCATENATED MODULE: ./plugins/TagManager/vue/src/AvailableEnvironments.store.ts function AvailableEnvironments_store_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -6790,7 +6790,7 @@ var VersionEditvue_type_script_lang_ts_notificationId = 'versiontagmanagement'; var lastContainerVersion = null; if (_this.create && (_versions$ = versions[0]) !== null && _versions$ !== void 0 && _versions$.name) { - _this.lastVersion = versions[0].name; + _this.lastVersion = external_CoreHome_["Matomo"].helper.htmlEntities(versions[0].name); lastContainerVersion = versions[0].idcontainerversion; } else if (_this.edit) { versions.forEach(function (v, i) { @@ -6800,7 +6800,7 @@ var VersionEditvue_type_script_lang_ts_notificationId = 'versiontagmanagement'; } if (v.idcontainerversion === _this.idContainerVersion && versions[i + 1]) { - _this.lastVersion = versions[i + 1].name; + _this.lastVersion = external_CoreHome_["Matomo"].helper.htmlEntities(versions[i + 1].name); lastContainerVersion = versions[i + 1].idcontainerversion; } }); @@ -7058,7 +7058,7 @@ var VersionEditvue_type_script_lang_ts_notificationId = 'versiontagmanagement'; -VersionEditvue_type_script_lang_ts.render = VersionEditvue_type_template_id_325d9698_render +VersionEditvue_type_script_lang_ts.render = VersionEditvue_type_template_id_434fe2da_render /* harmony default export */ var VersionEdit = (VersionEditvue_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/Version/VersionList.vue?vue&type=template&id=a804e98a diff --git a/vue/dist/TagManager.umd.min.js b/vue/dist/TagManager.umd.min.js index b016a772c..a73c85394 100644 --- a/vue/dist/TagManager.umd.min.js +++ b/vue/dist/TagManager.umd.min.js @@ -46,7 +46,7 @@ * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var Oc=function(){function e(){var t=this;hc(this,e),jc(this,"privateState",Object(r["reactive"])({versions:[],isLoadingVersions:!1,isLoadingSingle:!1,isUpdating:!1})),jc(this,"state",Object(r["computed"])((function(){return Object(r["readonly"])(t.privateState)}))),jc(this,"isLoading",Object(r["computed"])((function(){var e=t.state.value;return e.isLoadingVersions||e.isLoadingSingle}))),jc(this,"isUpdating",Object(r["computed"])((function(){return t.state.value.isUpdating}))),jc(this,"versions",Object(r["computed"])((function(){return t.state.value.versions}))),jc(this,"fetchPromise",null)}return vc(e,[{key:"reload",value:function(e){return this.privateState.versions=[],this.fetchPromise=null,this.fetchVersions(e)}},{key:"fetchVersions",value:function(e){var t=this;return this.privateState.isLoadingVersions=!0,this.privateState.versions=[],this.fetchPromise||(this.fetchPromise=u["AjaxHelper"].fetch({method:"TagManager.getContainerVersions",idContainer:e,filter_limit:"-1"})),Promise.resolve(this.fetchPromise).then((function(e){return t.privateState.versions=e,t.privateState.isLoadingVersions=!1,t.versions.value})).finally((function(){t.privateState.isLoadingVersions=!1}))}},{key:"findVersion",value:function(e,t){var n=this,a=this.versions.value.find((function(e){return e.idcontainerversion===t}));return a?Promise.resolve(a):(this.privateState.isLoadingSingle=!0,u["AjaxHelper"].fetch({idContainerVersion:t,idContainer:e,method:"TagManager.getContainerVersion",filter_limit:"-1"}).then((function(e){return n.privateState.versions=[].concat(dc(n.privateState.versions),[e]),Object(r["readonly"])(e)})).finally((function(){n.privateState.isLoadingSingle=!1})))}},{key:"deleteVersion",value:function(e,t){var n=this;return this.privateState.isUpdating=!0,this.privateState.versions=[],u["AjaxHelper"].fetch({idContainerVersion:t,idContainer:e,method:"TagManager.deleteContainerVersion"},{withTokenInUrl:!0}).finally((function(){n.privateState.isUpdating=!1}))}},{key:"publishVersion",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,u["AjaxHelper"].fetch({idContainer:e,idContainerVersion:t,environment:n,method:"TagManager.publishContainerVersion"}).finally((function(){a.privateState.isUpdating=!1}))}},{key:"createOrUpdateVersion",value:function(e,t,n){var a=this;return this.privateState.isUpdating=!0,u["AjaxHelper"].post({method:t,idContainer:n,idContainerVersion:e.idcontainerversion},{name:e.name,description:e.description},{withTokenInUrl:!0}).finally((function(){a.privateState.isUpdating=!1}))}}]),e}(),Tc=new Oc,yc={id:"versionNameHelpText",class:"inline-help-node"},Vc=Object(r["createElementVNode"])("br",null,null,-1),Cc=Object(r["createElementVNode"])("br",null,null,-1),Nc=["innerHTML"];function Ec(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",yc,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("TagManager_VersionNameHelp"))+" ",1),Vc,Cc,Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("TagManager_NameOfLatestVersion","".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=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;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;n { @@ -270,7 +270,7 @@ export default defineComponent({ } if (v.idcontainerversion === this.idContainerVersion && versions[i + 1]) { - this.lastVersion = versions[i + 1].name; + this.lastVersion = Matomo.helper.htmlEntities(versions[i + 1].name); lastContainerVersion = versions[i + 1].idcontainerversion; } });