File size: 11,657 Bytes
9046370
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue")):"function"===typeof define&&define.amd?define(["CoreHome"],t):"object"===typeof exports?exports["CustomVariables"]=t(require("CoreHome"),require("vue")):e["CustomVariables"]=t(e["CoreHome"],e["Vue"])})("undefined"!==typeof self?self:this,(function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},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/CustomVariables/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"ManageCustomVarsStore",(function(){return j})),n.d(t,"ManageCustomVars",(function(){return H})),"undefined"!==typeof window){var r=window.document.currentScript,a=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);a&&(n.p=a[1])}var o=n("8bbf"),l=n("19dc");function i(e,t){return m(e)||b(e,t)||s(e,t)||c()}function c(){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 s(e,t){if(e){if("string"===typeof e)return u(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)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done);l=!0)if(o.push(r.value),t&&o.length===t)break}catch(c){i=!0,a=c}finally{try{l||null==n["return"]||n["return"]()}finally{if(i)throw a}}return o}}function m(e){if(Array.isArray(e))return e}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
/*!
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */var O=function(){function e(){var t=this;d(this,e),v(this,"privateState",Object(o["reactive"])({customVariables:[],isLoading:!1,hasCustomVariablesInGeneral:!1,hasAtLeastOneUsage:!1,numSlotsAvailable:5})),v(this,"state",Object(o["computed"])((function(){return Object(o["readonly"])(t.privateState)})))}return p(e,[{key:"init",value:function(){return this.fetchUsages()}},{key:"fetchCustomVariables",value:function(){var e=this;return l["AjaxHelper"].fetch({method:"CustomVariables.getCustomVariables",period:"year",date:"today",filter_limit:1}).then((function(t){e.privateState.hasCustomVariablesInGeneral=(null===t||void 0===t?void 0:t.length)>0}))}},{key:"fetchUsages",value:function(){var e=this;return this.privateState.isLoading=!0,Promise.all([this.fetchCustomVariables(),l["AjaxHelper"].fetch({method:"CustomVariables.getUsagesOfSlots",filter_limit:"-1"})]).then((function(t){var n=i(t,2),r=n[1];e.privateState.customVariables=r,r.forEach((function(t){t.index>e.state.value.numSlotsAvailable&&(e.privateState.numSlotsAvailable=t.index),t.usages&&t.usages.length>0&&(e.privateState.hasAtLeastOneUsage=!0)}))})).finally((function(){e.privateState.isLoading=!1}))}}]),e}(),j=new O,h={class:"manageCustomVars"},g=["innerHTML"],y={class:"index"},V=["title"],C={key:0},S=Object(o["createElementVNode"])("br",null,null,-1),E=Object(o["createElementVNode"])("br",null,null,-1),N=["innerHTML"],w=Object(o["createElementVNode"])("br",null,null,-1),x=Object(o["createElementVNode"])("br",null,null,-1),_=Object(o["createElementVNode"])("br",null,null,-1),k=["textContent"];function A(e,t,n,r,a,l){var i=Object(o["resolveComponent"])("EnrichedHeadline"),c=Object(o["resolveComponent"])("ContentBlock"),s=Object(o["resolveDirective"])("content-intro"),u=Object(o["resolveDirective"])("content-table"),b=Object(o["resolveDirective"])("select-on-focus");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",h,[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("h2",null,[Object(o["createVNode"])(i,{"help-url":"https://matomo.org/docs/custom-variables/"},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("CustomVariables_CustomVariables")),1)]})),_:1})]),Object(o["createElementVNode"])("p",null,[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("CustomVariables_ManageDescription",e.siteName))},null,8,g)])],512),[[s]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",{class:"alert alert-info"},Object(o["toDisplayString"])(e.translate("CustomVariables_SlotsReportIsGeneratedOverTime")),513),[[o["vShow"],!e.isLoading&&e.hasCustomVariablesInGeneral&&!e.hasAtLeastOneUsage]]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.scopes,(function(t){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:t.name},[Object(o["createVNode"])(c,{"content-title":e.translate("CustomVariables_ScopeX",t.name)},{default:Object(o["withCtx"])((function(){return[Object(o["withDirectives"])(Object(o["createElementVNode"])("table",null,[Object(o["createElementVNode"])("thead",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("th",null,Object(o["toDisplayString"])(e.translate("CustomVariables_Index")),1),Object(o["createElementVNode"])("th",null,Object(o["toDisplayString"])(e.translate("CustomVariables_Usages")),1)])]),Object(o["createElementVNode"])("tbody",null,[Object(o["createElementVNode"])("tr",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("td",{colspan:"3"},Object(o["toDisplayString"])(e.translate("General_Loading")),513),[[o["vShow"],e.isLoading]])]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.customVariablesByScope[t.value],(function(t,n){return Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",{key:n},[Object(o["createElementVNode"])("td",y,Object(o["toDisplayString"])(t.index),1),Object(o["createElementVNode"])("td",null,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"unused"},Object(o["toDisplayString"])(e.translate("CustomVariables_Unused")),513),[[o["vShow"],0===t.usages.length]]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.sortUsages(t),(function(n,r){return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:r},[Object(o["createElementVNode"])("span",{title:e.translate("CustomVariables_UsageDetails",n.nb_visits?n.nb_visits:0,n.nb_actions?n.nb_actions:0)},Object(o["toDisplayString"])(n.name),9,V),r<t.usages.length-1?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",C,", ")):Object(o["createCommentVNode"])("",!0)],512)),[[o["vShow"],t.usages.length]])})),128))])])})),128))])],512),[[u]])]})),_:2},1032,["content-title"])])})),128)),Object(o["withDirectives"])(Object(o["createVNode"])(c,{id:"CustomVariablesCreateNewSlot","content-title":e.translate("CustomVariables_CreateNewSlot")},{default:Object(o["withCtx"])((function(){return[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",null,[Object(o["createElementVNode"])("p",null,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("CustomVariables_CreatingCustomVariableTakesTime"))+" ",1),S,E,Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(e.currentAvailableCustomVariablesText)},null,8,N),w,x,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("CustomVariables_ToCreateCustomVarExecute"))+" ",1),_]),Object(o["withDirectives"])(Object(o["createElementVNode"])("pre",null,[Object(o["createElementVNode"])("code",{textContent:Object(o["toDisplayString"])(e.setMaxCustomVariablesCmd)},null,8,k)],512),[[b,{}]])],512),[[o["vShow"],!e.isLoading]])]})),_:1},8,["content-title"]),[[o["vShow"],!e.isLoading]])])}function D(e){return I(e)||B(e)||T(e)||L()}function L(){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 T(e,t){if(e){if("string"===typeof e)return M(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)?M(e,t):void 0}}function B(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e){if(Array.isArray(e))return M(e)}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var U=Object(o["defineComponent"])({components:{EnrichedHeadline:l["EnrichedHeadline"],ContentBlock:l["ContentBlock"]},directives:{ContentIntro:l["ContentIntro"],ContentTable:l["ContentTable"],SelectOnFocus:l["SelectOnFocus"]},data:function(){return{siteName:l["Matomo"].siteName,scopes:[{value:"visit",name:Object(l["translate"])("General_TrackingScopeVisit")},{value:"page",name:Object(l["translate"])("General_TrackingScopePage")}]}},created:function(){j.init()},methods:{sortUsages:function(e){var t=D(e.usages);return t.sort((function(e,t){var n="".concat(t.nb_actions),r="".concat(e.nb_actions);return parseInt(n,10)-parseInt(r,10)})),t}},computed:{isLoading:function(){return j.state.value.isLoading},hasCustomVariablesInGeneral:function(){return j.state.value.hasCustomVariablesInGeneral},hasAtLeastOneUsage:function(){return j.state.value.hasAtLeastOneUsage},numSlotsAvailable:function(){return j.state.value.numSlotsAvailable},customVariablesByScope:function(){var e={};return j.state.value.customVariables.forEach((function(t){e[t.scope]=e[t.scope]||[],e[t.scope].push(t)})),e},currentAvailableCustomVariablesText:function(){return Object(l["translate"])("CustomVariables_CurrentAvailableCustomVariables","<strong>".concat(this.numSlotsAvailable,"</strong>"))},setMaxCustomVariablesCmd:function(){return"./console customvariables:set-max-custom-variables ".concat(this.numSlotsAvailable+1)}}});U.render=A;var H=U;
/*!
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */}})}));
//# sourceMappingURL=CustomVariables.umd.min.js.map