1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
(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["MultiSites"]=t(require("CoreHome"),require("vue")):e["MultiSites"]=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/MultiSites/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,"MultisitesSite",(function(){return G})),n.d(t,"DashboadStore",(function(){return De})),n.d(t,"Dashboard",(function(){return Ge})),"undefined"!==typeof window){var r=window.document.currentScript,a=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);a&&(n.p=a[1])}var o=n("19dc"),i=n("8bbf"),s={key:0,class:"multisites-label label"},l=["href"],c={key:0},u=["href","title"],d=Object(i["createElementVNode"])("span",{class:"icon icon-outlink"},null,-1),m=[d],b={key:1,class:"multisites-label label"},p={class:"value"},v={class:"multisites-column"},f={class:"value"},h={class:"multisites-column"},g={class:"value"},O={key:2,class:"multisites-column"},j={class:"value"},S=["title"],_={key:0,class:"visits value"},y=Object(i["createElementVNode"])("img",{class:"multisites_icon",src:"plugins/MultiSites/images/arrow_up.png",alt:""},null,-1),w=Object(i["createTextVNode"])(),k={style:{color:"green"}},V=Object(i["createElementVNode"])("img",{class:"multisites_icon",src:"plugins/MultiSites/images/stop.png",alt:""},null,-1),N=Object(i["createTextVNode"])(),E=Object(i["createElementVNode"])("img",{class:"multisites_icon",src:"plugins/MultiSites/images/arrow_down.png",alt:""},null,-1),C=Object(i["createTextVNode"])(),M={style:{color:"red"}},B={key:4,style:{width:"180px"}},P={key:0,class:"sparkline",style:{width:"100px",margin:"auto"}},T=["href","title"],A=["src"];function D(e,t,n,r,a,o){return Object(i["openBlock"])(),Object(i["createElementBlock"])("tr",{class:Object(i["normalizeClass"])({groupedWebsite:e.website.group,website:!e.website.group,group:e.website.isGroup}),ref:"root"},[e.website.isGroup?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",s,[Object(i["createElementVNode"])("a",{title:"View reports",class:"value truncated-text-line",href:e.dashboardUrl(e.website)},Object(i["toDisplayString"])(e.websiteLabel),9,l),e.website.main_url?(Object(i["openBlock"])(),Object(i["createElementBlock"])("span",c,[Object(i["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.website.main_url,title:e.translate("General_GoTo",e.website.main_url)},m,8,u)])):Object(i["createCommentVNode"])("",!0)])),e.website.isGroup?(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",b,[Object(i["createElementVNode"])("span",p,Object(i["toDisplayString"])(e.websiteLabel),1)])):Object(i["createCommentVNode"])("",!0),Object(i["createElementVNode"])("td",v,[Object(i["createElementVNode"])("span",f,Object(i["toDisplayString"])(e.website.nb_visits),1)]),Object(i["createElementVNode"])("td",h,[Object(i["createElementVNode"])("span",g,Object(i["toDisplayString"])(e.website.nb_pageviews),1)]),e.displayRevenueColumn?(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",O,[Object(i["createElementVNode"])("span",j,Object(i["toDisplayString"])(e.website.revenue),1)])):Object(i["createCommentVNode"])("",!0),"range"!==e.period?(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",{key:3,class:"multisites-evolution",title:e.website.tooltip},[e.website.isGroup?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",_,[Object(i["withDirectives"])(Object(i["createElementVNode"])("span",null,[y,w,Object(i["createElementVNode"])("span",k,Object(i["toDisplayString"])(e.website[e.evolutionMetric]),1)],512),[[i["vShow"],1===e.website["".concat(e.evolutionMetric,"_trend")]]]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",null,[V,N,Object(i["createElementVNode"])("span",null,Object(i["toDisplayString"])(e.website[e.evolutionMetric]),1)],512),[[i["vShow"],0===e.website["".concat(e.evolutionMetric,"_trend")]]]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",null,[E,C,Object(i["createElementVNode"])("span",M,Object(i["toDisplayString"])(e.website[e.evolutionMetric]),1)],512),[[i["vShow"],-1===e.website["".concat(e.evolutionMetric,"_trend")]]])]))],8,S)):Object(i["createCommentVNode"])("",!0),e.showSparklines?(Object(i["openBlock"])(),Object(i["createElementBlock"])("td",B,[e.website.isGroup?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",P,[Object(i["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.dashboardUrl(e.website),title:e.translate("General_GoTo",e.translate("Dashboard_DashboardOf",e.websiteLabel))},[Object(i["createElementVNode"])("img",{alt:"",width:"100",height:"25",src:e.sparklineImage(e.website)},null,8,A)],8,T)]))])):Object(i["createCommentVNode"])("",!0)],2)}var x=Object(i["defineComponent"])({props:{website:{type:Object,required:!0},evolutionMetric:{type:String,required:!0},showSparklines:Boolean,dateSparkline:String,displayRevenueColumn:Boolean,metric:String},mounted:function(){o["Matomo"].postEvent("MultiSites.MultiSitesSite.mounted",{element:this.$refs.root})},unmounted:function(){o["Matomo"].postEvent("MultiSites.MultiSitesSite.unmounted",{element:this.$refs.root})},methods:{dashboardUrl:function(e){return"index.php?module=CoreHome&action=index&date=".concat(this.date,"&period=").concat(this.period)+"&idSite=".concat(e.idsite).concat(this.tokenParam)},sparklineImage:function(e){var t=this.metric;switch(this.evolutionMetric){case"visits_evolution":t="nb_visits";break;case"pageviews_evolution":t="nb_pageviews";break;case"revenue_evolution":t="revenue";break;default:break}return"index.php?module=MultiSites&action=getEvolutionGraph&period=".concat(this.period,"&date=")+"".concat(this.dateSparkline,"&evolutionBy=").concat(t,"&columns=").concat(t,"&idSite=").concat(e.idsite)+"&idsite=".concat(e.idsite,"&viewDataTable=sparkline").concat(this.tokenParam,"&colors=")+"".concat(encodeURIComponent(JSON.stringify(o["Matomo"].getSparklineColors())))}},computed:{tokenParam:function(){var e=o["MatomoUrl"].urlParsed.value.token_auth;return e?"&token_auth=".concat(e):""},period:function(){return o["Matomo"].period},date:function(){return o["MatomoUrl"].urlParsed.value.date},websiteLabel:function(){return o["Matomo"].helper.htmlDecode(this.website.label)}}});x.render=D;var G=x,R=(Object(o["createAngularJsAdapter"])({component:G,scope:{website:{angularJsBind:"="},evolutionMetric:{angularJsBind:"="},showSparklines:{angularJsBind:"="},dateSparkline:{angularJsBind:"="},displayRevenueColumn:{angularJsBind:"="},metric:{angularJsBind:"="}},directiveName:"piwikMultisitesSite"}),{ref:"root"}),L={class:"card-title"},I=["innerHTML","title"],z={id:"mt",class:"dataTable card-table",cellspacing:"0"},U={class:"heading"},J={class:"heading"},H={class:"heading"},F={class:"heading"},q=["colspan"],W=["value"],$={value:"visits_evolution"},K={value:"pageviews_evolution"},Y={key:0,value:"revenue_evolution"},Q={key:0},X={colspan:"7",class:"allWebsitesLoading"},Z={key:1},ee={key:0},te={colspan:"7"},ne={class:"notification system notification-error"},re=Object(i["createElementVNode"])("br",null,null,-1),ae=Object(i["createElementVNode"])("br",null,null,-1),oe={rel:"noreferrer noopener",target:"_blank",href:"https://matomo.org/faq/troubleshooting/faq_19489/"},ie=Object(i["createTextVNode"])(" – "),se={rel:"noreferrer noopener",target:"_blank",href:"https://forum.matomo.org/"},le=["href"],ce=Object(i["createTextVNode"])(". "),ue={colspan:"8",class:"paging"},de={class:"row"},me={class:"col s3 add_new_site"},be=["href"],pe=Object(i["createElementVNode"])("span",{class:"icon-add"},null,-1),ve={class:"col s6"},fe={style:{cursor:"pointer"}},he={class:"dataTablePages"},ge={id:"counter"},Oe={style:{cursor:"pointer"},class:"pointer"},je=Object(i["createElementVNode"])("div",{class:"col s3"}," ",-1),Se={row_id:"last"},_e={colspan:"8",class:"site_search"},ye={class:"row"},we={class:"input-field col s12"},ke=["placeholder"],Ve=["title"];
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/function Ne(e,t,n,r,a,o){var s=this,l=Object(i["resolveComponent"])("EnrichedHeadline"),c=Object(i["resolveComponent"])("ActivityIndicator"),u=Object(i["resolveComponent"])("MultisitesSite");return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",R,[Object(i["createElementVNode"])("h2",L,[Object(i["createVNode"])(l,{"help-url":"https://matomo.org/docs/manage-websites/#all-websites-dashboard","feature-name":e.translate("General_AllWebsitesDashboard")},{default:Object(i["withCtx"])((function(){return[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("General_AllWebsitesDashboard"))+" ",1),Object(i["createElementVNode"])("span",{class:"smallTitle",innerHTML:e.$sanitize(s.smallTitleContent),title:e.smallTitleTooltip},null,8,I)]})),_:1},8,["feature-name"])]),Object(i["createElementVNode"])("table",z,[Object(i["createElementVNode"])("thead",null,[Object(i["createElementVNode"])("tr",null,[Object(i["createElementVNode"])("th",{id:"names",class:Object(i["normalizeClass"])(["label",{columnSorted:"label"===e.sortColumn}]),onClick:t[0]||(t[0]=function(t){return e.sortBy("label")})},[Object(i["createElementVNode"])("span",U,Object(i["toDisplayString"])(e.translate("General_Website")),1),Object(i["createElementVNode"])("span",{class:Object(i["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&"label"===e.sortColumn,multisites_desc:e.reverse&&"label"===e.sortColumn}]),style:{"margin-left":"3.5px"}},null,2)],2),Object(i["createElementVNode"])("th",{id:"visits",class:Object(i["normalizeClass"])(["multisites-column",{columnSorted:"nb_visits"===e.sortColumn}]),onClick:t[1]||(t[1]=function(t){return e.sortBy("nb_visits")})},[Object(i["createElementVNode"])("span",{class:Object(i["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&"nb_visits"===e.sortColumn,multisites_desc:e.reverse&&"nb_visits"===e.sortColumn}]),style:{"margin-right":"3.5px"}},null,2),Object(i["createElementVNode"])("span",J,Object(i["toDisplayString"])(e.translate("General_ColumnNbVisits")),1)],2),Object(i["createElementVNode"])("th",{id:"pageviews",class:Object(i["normalizeClass"])(["multisites-column",{columnSorted:"nb_pageviews"===e.sortColumn}]),onClick:t[2]||(t[2]=function(t){return e.sortBy("nb_pageviews")})},[Object(i["createElementVNode"])("span",{class:Object(i["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&"nb_pageviews"===e.sortColumn,multisites_desc:e.reverse&&"nb_pageviews"===e.sortColumn}]),style:{"margin-right":"3.5px"}},null,2),Object(i["createElementVNode"])("span",H,Object(i["toDisplayString"])(e.translate("General_ColumnPageviews")),1)],2),e.displayRevenueColumn?(Object(i["openBlock"])(),Object(i["createElementBlock"])("th",{key:0,id:"revenue",class:Object(i["normalizeClass"])(["multisites-column",{columnSorted:"revenue"===e.sortColumn}]),onClick:t[3]||(t[3]=function(t){return e.sortBy("revenue")})},[Object(i["createElementVNode"])("span",{class:Object(i["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&"revenue"===e.sortColumn,multisites_desc:e.reverse&&"revenue"===e.sortColumn}]),style:{"margin-right":"3.5px"}},null,2),Object(i["createElementVNode"])("span",F,Object(i["toDisplayString"])(e.translate("General_ColumnRevenue")),1)],2)):Object(i["createCommentVNode"])("",!0),Object(i["createElementVNode"])("th",{id:"evolution",class:Object(i["normalizeClass"])({columnSorted:e.evolutionSelector===e.sortColumn}),colspan:e.showSparklines?2:1},[Object(i["createElementVNode"])("span",{class:Object(i["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&e.evolutionSelector===e.sortColumn,multisites_desc:e.reverse&&e.evolutionSelector===e.sortColumn}]),style:{"margin-right":"3.5px"}},null,2),Object(i["createElementVNode"])("span",{class:"evolution",onClick:t[4]||(t[4]=function(t){return e.sortBy(e.evolutionSelector)}),style:{"margin-right":"3.5px"}},Object(i["toDisplayString"])(e.translate("MultiSites_Evolution")),1),Object(i["createElementVNode"])("select",{class:"selector browser-default",id:"evolution_selector",value:e.evolutionSelector,onChange:t[5]||(t[5]=function(t){e.evolutionSelector=t.target.value,e.sortBy(e.evolutionSelector)})},[Object(i["createElementVNode"])("option",$,Object(i["toDisplayString"])(e.translate("General_ColumnNbVisits")),1),Object(i["createElementVNode"])("option",K,Object(i["toDisplayString"])(e.translate("General_ColumnPageviews")),1),e.displayRevenueColumn?(Object(i["openBlock"])(),Object(i["createElementBlock"])("option",Y,Object(i["toDisplayString"])(e.translate("General_ColumnRevenue")),1)):Object(i["createCommentVNode"])("",!0)],40,W)],10,q)])]),e.isLoading?(Object(i["openBlock"])(),Object(i["createElementBlock"])("tbody",Q,[Object(i["createElementVNode"])("tr",null,[Object(i["createElementVNode"])("td",X,[Object(i["createVNode"])(c,{"loading-message":e.loadingMessage,loading:e.isLoading},null,8,["loading-message","loading"])])])])):Object(i["createCommentVNode"])("",!0),e.isLoading?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("tbody",Z,[e.errorLoadingSites?(Object(i["openBlock"])(),Object(i["createElementBlock"])("tr",ee,[Object(i["createElementVNode"])("td",te,[Object(i["createElementVNode"])("div",ne,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("General_ErrorRequest","",""))+" ",1),re,ae,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_NeedMoreHelp"))+" ",1),Object(i["createElementVNode"])("a",oe,Object(i["toDisplayString"])(e.translate("General_Faq")),1),ie,Object(i["createElementVNode"])("a",se,Object(i["toDisplayString"])(e.translate("Feedback_CommunityHelp")),1),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",null," – ",512),[[i["vShow"],e.areAdsForProfessionalServicesEnabled]]),Object(i["withDirectives"])(Object(i["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.professionalHelpUrl},Object(i["toDisplayString"])(e.translate("Feedback_ProfessionalHelp")),9,le),[[i["vShow"],e.areAdsForProfessionalServicesEnabled]]),ce])])])):Object(i["createCommentVNode"])("",!0),(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])(e.sites,(function(t){return Object(i["openBlock"])(),Object(i["createBlock"])(u,{key:t.idsite,website:t,"evolution-metric":e.evolutionSelector,"date-sparkline":e.dateSparkline,"show-sparklines":e.showSparklines,metric:e.sortColumn,"display-revenue-column":e.displayRevenueColumn},null,8,["website","evolution-metric","date-sparkline","show-sparklines","metric","display-revenue-column"])})),128))])),Object(i["createElementVNode"])("tfoot",null,[Object(i["createElementVNode"])("tr",null,[Object(i["createElementVNode"])("td",ue,[Object(i["createElementVNode"])("div",de,[Object(i["createElementVNode"])("div",me,[e.hasSuperUserAccess?(Object(i["openBlock"])(),Object(i["createElementBlock"])("a",{key:0,href:e.addSiteUrl},[pe,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("SitesManager_AddSite")),1)],8,be)):Object(i["createCommentVNode"])("",!0)]),Object(i["createElementVNode"])("div",ve,[Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{id:"prev",class:"previous dataTablePrevious",onClick:t[6]||(t[6]=function(t){return e.previousPage()})},[Object(i["createElementVNode"])("span",fe,"« "+Object(i["toDisplayString"])(e.translate("General_Previous")),1)],512),[[i["vShow"],!(0===e.currentPage)]]),Object(i["createElementVNode"])("span",he,[Object(i["createElementVNode"])("span",ge,Object(i["toDisplayString"])(e.translate("General_Pagination",e.paginationLowerBound,e.paginationUpperBound,e.numberOfFilteredSites)),1)]),Object(i["withDirectives"])(Object(i["createElementVNode"])("span",{id:"next",class:"next dataTableNext",onClick:t[7]||(t[7]=function(t){return e.nextPage()})},[Object(i["createElementVNode"])("span",Oe,Object(i["toDisplayString"])(e.translate("General_Next"))+" »",1)],512),[[i["vShow"],!(e.currentPage>=e.numberOfPages)]])]),je])])]),Object(i["createElementVNode"])("tr",Se,[Object(i["createElementVNode"])("td",_e,[Object(i["createElementVNode"])("div",ye,[Object(i["createElementVNode"])("div",we,[Object(i["withDirectives"])(Object(i["createElementVNode"])("input",{type:"text",onKeydown:t[8]||(t[8]=Object(i["withKeys"])((function(t){return e.searchSite(e.searchTerm)}),["enter"])),"onUpdate:modelValue":t[9]||(t[9]=function(t){return e.searchTerm=t}),placeholder:e.translate("Actions_SubmenuSitesearch")},null,40,ke),[[i["vModelText"],e.searchTerm]]),Object(i["createElementVNode"])("span",{class:"icon-search search_ico",onClick:t[10]||(t[10]=function(t){return e.searchSite(e.searchTerm)}),title:e.translate("General_ClickToSearch")},null,8,Ve)])])])])])])],512)}function Ee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ce(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 Me(e,t,n){return t&&Ce(e.prototype,t),n&&Ce(e,n),e}function Be(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 Pe=window,Te=Pe.NumberFormatter,Ae=function(){function e(){var t=this;Ee(this,e),Be(this,"privateState",Object(i["reactive"])({sites:[],isLoading:!1,pageSize:25,currentPage:0,totalVisits:"?",totalPageviews:"?",totalActions:"?",totalRevenue:"?",searchTerm:"",lastVisits:"?",lastVisitsDate:"?",numberOfSites:0,loadingMessage:Object(o["translate"])("MultiSites_LoadingWebsites"),reverse:!0,sortColumn:"nb_visits",refreshInterval:0,errorLoadingSites:!1})),Be(this,"refreshTimeout",null),Be(this,"fetchAbort",null),Be(this,"state",Object(i["computed"])((function(){return Object(i["readonly"])(t.privateState)}))),Be(this,"numberOfFilteredSites",Object(i["computed"])((function(){return t.state.value.numberOfSites}))),Be(this,"numberOfPages",Object(i["computed"])((function(){return Math.ceil(t.numberOfFilteredSites.value/t.state.value.pageSize-1)}))),Be(this,"currentPagingOffset",Object(i["computed"])((function(){return Math.ceil(t.state.value.currentPage*t.state.value.pageSize)}))),Be(this,"paginationLowerBound",Object(i["computed"])((function(){return t.currentPagingOffset.value+1}))),Be(this,"paginationUpperBound",Object(i["computed"])((function(){var e=t.currentPagingOffset.value+t.state.value.pageSize,n=t.numberOfFilteredSites.value;return e>n&&(e=n),e})))}return Me(e,[{key:"cancelRefereshInterval",value:function(){this.refreshTimeout&&(clearTimeout(this.refreshTimeout),this.refreshTimeout=null)}},{key:"updateWebsitesList",value:function(e){var t=this;if(e){var n=e.sites;n.forEach((function(e){if(1!==e.ratio&&"1"!==e.ratio){var n=Te.formatPercent(Math.round(100*parseInt(e.ratio,10))),r=null,a="0",i="0",s="0",l="0";if("nb_visits"!==t.state.value.sortColumn&&"visits_evolution"!==t.state.value.sortColumn||(a=Te.formatNumber(e.previous_nb_visits),i=Te.formatNumber(e.nb_visits),s=Te.formatPercent(e.visits_evolution),r=Object(o["translate"])("General_ColumnNbVisits"),l=Te.formatNumber(Math.round(parseInt(e.previous_nb_visits,10)*parseInt(e.ratio,10)))),"pageviews_evolution"===t.state.value.sortColumn&&(a="".concat(e.previous_Actions_nb_pageviews),i="".concat(e.nb_pageviews),s=Te.formatPercent(e.pageviews_evolution),r=Object(o["translate"])("General_ColumnPageviews"),l=Te.formatNumber(Math.round(parseInt(e.previous_Actions_nb_pageviews,10)*parseInt(e.ratio,10)))),"revenue_evolution"===t.state.value.sortColumn&&(a=Te.formatCurrency(e.previous_Goal_revenue,e.currencySymbol),i=Te.formatCurrency(e.revenue,e.currencySymbol),s=Te.formatPercent(e.revenue_evolution),r=Object(o["translate"])("General_ColumnRevenue"),l=Te.formatCurrency(Math.round(parseInt(e.previous_Goal_revenue,10)*parseInt(e.ratio,10)),e.currencySymbol)),r)switch(e.tooltip="".concat(Object(o["translate"])("MultiSites_EvolutionComparisonIncomplete",[n]),"\n"),e.tooltip+="".concat(Object(o["translate"])("MultiSites_EvolutionComparisonProportional",[n,"".concat(l),r,"".concat(a)]),"\n"),e.periodName){case"day":e.tooltip+=Object(o["translate"])("MultiSites_EvolutionComparisonDay",["".concat(i),r,"".concat(l),e.previousRange,"".concat(s)]);break;case"week":e.tooltip+=Object(o["translate"])("MultiSites_EvolutionComparisonWeek",["".concat(i),r,"".concat(l),e.previousRange,"".concat(s)]);break;case"month":e.tooltip+=Object(o["translate"])("MultiSites_EvolutionComparisonMonth",["".concat(i),r,"".concat(l),e.previousRange,"".concat(s)]);break;case"year":e.tooltip+=Object(o["translate"])("MultiSites_EvolutionComparisonYear",["".concat(i),r,"".concat(l),e.previousRange,"".concat(s)]);break;default:break}}})),this.privateState.totalVisits=e.totals.nb_visits,this.privateState.totalPageviews=e.totals.nb_pageviews,this.privateState.totalActions=e.totals.nb_actions,this.privateState.totalRevenue=e.totals.revenue,this.privateState.lastVisits=e.totals.nb_visits_lastdate,this.privateState.sites=n,this.privateState.numberOfSites=e.numSites,this.privateState.lastVisitsDate=e.lastDate}else this.onError()}},{key:"sortBy",value:function(e){this.state.value.sortColumn===e&&(this.privateState.reverse=!this.state.value.reverse),this.privateState.sortColumn=e,this.fetchAllSites()}},{key:"previousPage",value:function(){this.privateState.currentPage=this.state.value.currentPage-1,this.fetchAllSites()}},{key:"nextPage",value:function(){this.privateState.currentPage=this.state.value.currentPage+1,this.fetchAllSites()}},{key:"searchSite",value:function(e){this.privateState.searchTerm=e,this.privateState.currentPage=0,this.fetchAllSites()}},{key:"fetchAllSites",value:function(){var e=this;this.fetchAbort&&(this.fetchAbort.abort(),this.fetchAbort=null,this.cancelRefereshInterval()),this.privateState.isLoading=!0,this.privateState.errorLoadingSites=!1;var t={method:"MultiSites.getAllWithGroups",hideMetricsDoc:"1",filter_sort_order:"asc",filter_limit:this.state.value.pageSize,filter_offset:this.currentPagingOffset.value,showColumns:["label","nb_visits","nb_pageviews","visits_evolution","visits_evolution_trend","pageviews_evolution","pageviews_evolution_trend","revenue_evolution","revenue_evolution_trend","nb_actions,revenue"].join(",")};return this.privateState.searchTerm&&(t.pattern=this.privateState.searchTerm),this.privateState.sortColumn&&(t.filter_sort_column=this.privateState.sortColumn),this.privateState.reverse&&(t.filter_sort_order="desc"),this.fetchAbort=new AbortController,o["AjaxHelper"].fetch(t,{abortController:this.fetchAbort}).then((function(t){e.updateWebsitesList(t)})).catch((function(){e.onError()})).finally((function(){e.privateState.isLoading=!1,e.fetchAbort=null,e.state.value.refreshInterval&&e.state.value.refreshInterval>0&&(e.cancelRefereshInterval(),e.refreshTimeout=setTimeout((function(){e.refreshTimeout=null,e.fetchAllSites()}),1e3*e.state.value.refreshInterval))}))}},{key:"onError",value:function(){this.privateState.errorLoadingSites=!0,this.privateState.sites=[]}},{key:"setRefreshInterval",value:function(e){this.privateState.refreshInterval=e}},{key:"setPageSize",value:function(e){this.privateState.pageSize=e}}]),e}(),De=new Ae,xe=Object(i["defineComponent"])({props:{displayRevenueColumn:Boolean,showSparklines:Boolean,dateSparkline:String,pageSize:Number,autoRefreshTodayReport:Number},components:{EnrichedHeadline:o["EnrichedHeadline"],ActivityIndicator:o["ActivityIndicator"],MultisitesSite:G},data:function(){return{evolutionSelector:"visits_evolution",searchTerm:""}},created:function(){this.pageSize&&De.setPageSize(this.pageSize),this.refresh(this.autoRefreshTodayReport)},methods:{refresh:function(e){De.setRefreshInterval(e),De.fetchAllSites()},sortBy:function(e){De.sortBy(e)},previousPage:function(){De.previousPage()},nextPage:function(){De.nextPage()},searchSite:function(){De.searchSite(this.searchTerm)}},computed:{hasSuperUserAccess:function(){return o["Matomo"].hasSuperUserAccess},date:function(){return o["MatomoUrl"].urlParsed.value.date},idSite:function(){return o["MatomoUrl"].urlParsed.value.idSite},url:function(){return o["Matomo"].piwik_url},period:function(){return o["Matomo"].period},areAdsForProfessionalServicesEnabled:function(){return o["Matomo"].config&&o["Matomo"].config.are_ads_enabled},sortColumn:function(){return De.state.value.sortColumn},reverse:function(){return De.state.value.reverse},smallTitleContent:function(){var e=De.state.value;return Object(o["translate"])("General_TotalVisitsPageviewsActionsRevenue","<strong>".concat(e.totalVisits,"</strong>"),"<strong>".concat(e.totalPageviews,"</strong>"),"<strong>".concat(e.totalActions,"</strong>"),"<strong>".concat(e.totalRevenue,"</strong>"))},smallTitleTooltip:function(){var e=De.state.value;return Object(o["translate"])("General_EvolutionSummaryGeneric",Object(o["translate"])("General_NVisits","".concat(e.totalVisits)),this.date,"".concat(e.lastVisits),e.lastVisitsDate,Object(o["getFormattedEvolution"])(e.totalVisits,e.lastVisits))},loadingMessage:function(){return De.state.value.loadingMessage},isLoading:function(){return De.state.value.isLoading},errorLoadingSites:function(){return De.state.value.errorLoadingSites},sites:function(){return De.state.value.sites},numberOfPages:function(){return De.numberOfPages.value},currentPage:function(){return De.state.value.currentPage},paginationLowerBound:function(){return De.paginationLowerBound.value},paginationUpperBound:function(){return De.paginationUpperBound.value},numberOfFilteredSites:function(){return De.numberOfFilteredSites.value},professionalHelpUrl:function(){return"https://matomo.org/support-plans/?pk_campaign=Help&pk_medium=AjaxError&pk_content=MultiSites&pk_source=Matomo_App"},addSiteUrl:function(){return"index.php?module=SitesManager&action=index&showaddsite=1&period=".concat(this.period,"&")+"date=".concat(this.date,"&idSite=").concat(this.idSite)}}});xe.render=Ne;var Ge=xe;
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/Object(o["createAngularJsAdapter"])({component:Ge,scope:{displayRevenueColumn:{angularJsBind:"@",transform:o["transformAngularJsBoolAttr"]},showSparklines:{angularJsBind:"@",transform:o["transformAngularJsBoolAttr"]},dateSparkline:{angularJsBind:"@"},pageSize:{angularJsBind:"@",transform:o["transformAngularJsIntAttr"]},autoRefreshTodayReport:{angularJsBind:"@",transform:o["transformAngularJsIntAttr"]}},directiveName:"piwikMultisitesDashboard"})}})}));
//# sourceMappingURL=MultiSites.umd.min.js.map
|