From 90ce1e9b9bf53042468ee8c18b492b3c8f0a8cb5 Mon Sep 17 00:00:00 2001 From: sgiehl Date: Tue, 12 Nov 2024 13:39:53 +0100 Subject: [PATCH] Use unformatted API data in new all websites dashboard --- plugins/MultiSites/vue/dist/MultiSites.umd.js | 137 +++++++++--------- .../MultiSites/vue/dist/MultiSites.umd.min.js | 6 +- .../AllWebsitesDashboard.store.ts | 70 ++++++--- .../src/AllWebsitesDashboard/SitesTable.vue | 5 +- .../AllWebsitesDashboard/SitesTableSite.vue | 41 ++++-- plugins/MultiSites/vue/src/types.ts | 20 +-- 6 files changed, 160 insertions(+), 119 deletions(-) diff --git a/plugins/MultiSites/vue/dist/MultiSites.umd.js b/plugins/MultiSites/vue/dist/MultiSites.umd.js index 9d51e4b4b78a..c45286f3723e 100644 --- a/plugins/MultiSites/vue/dist/MultiSites.umd.js +++ b/plugins/MultiSites/vue/dist/MultiSites.umd.js @@ -255,7 +255,6 @@ var AllWebsitesDashboard_store_DashboardStore = /*#__PURE__*/function () { isLoadingSites: false, numSites: 0, paginationCurrentPage: 0, - sparklineDate: '', sortColumn: DEFAULT_SORT_COLUMN, sortOrder: DEFAULT_SORT_ORDER })); @@ -389,11 +388,12 @@ var AllWebsitesDashboard_store_DashboardStore = /*#__PURE__*/function () { this.privateState.isLoadingKPIs = !onlySites; this.privateState.isLoadingSites = true; var params = { - method: 'MultiSites.mockDashboardData', + method: 'MultiSites.getAllWithGroups', filter_limit: this.pageSize, filter_offset: this.currentPagingOffset.value, filter_sort_column: this.privateState.sortColumn, filter_sort_order: this.privateState.sortOrder, + format_metrics: 0, showColumns: ['hits_evolution', 'hits_evolution_trend', 'label', 'hits', 'nb_pageviews', 'nb_visits', 'pageviews_evolution', 'pageviews_evolution_trend', 'revenue', 'revenue_evolution', 'revenue_evolution_trend', 'visits_evolution', 'visits_evolution_trend'].join(',') }; @@ -453,18 +453,18 @@ var AllWebsitesDashboard_store_DashboardStore = /*#__PURE__*/function () { value: function updateDashboardKPIs(response) { this.privateState.dashboardKPIs = { evolutionPeriod: external_CoreHome_["Matomo"].period, - hits: response.totals.hits, - hitsEvolution: response.totals.hits_evolution, - hitsTrend: response.totals.hits_evolution_trend, - pageviews: response.totals.nb_pageviews, - pageviewsEvolution: response.totals.pageviews_evolution, - pageviewsTrend: response.totals.pageviews_evolution_trend, - revenue: response.totals.revenue, - revenueEvolution: response.totals.revenue_evolution, - revenueTrend: response.totals.revenue_evolution_trend, - visits: response.totals.nb_visits, - visitsEvolution: response.totals.visits_evolution, - visitsTrend: response.totals.visits_evolution_trend + hits: external_CoreHome_["NumberFormatter"].formatNumber(response.totals.hits), + hitsEvolution: external_CoreHome_["NumberFormatter"].calculateAndFormatEvolution(response.totals.hits, response.totals.previous_hits, true), + hitsTrend: Math.sign(response.totals.hits - response.totals.previous_hits), + pageviews: external_CoreHome_["NumberFormatter"].formatNumber(response.totals.nb_pageviews), + pageviewsEvolution: external_CoreHome_["NumberFormatter"].calculateAndFormatEvolution(response.totals.nb_pageviews, response.totals.previous_nb_pageviews, true), + pageviewsTrend: Math.sign(response.totals.nb_pageviews - response.totals.previous_nb_pageviews), + revenue: external_CoreHome_["NumberFormatter"].formatCurrency(response.totals.revenue, ''), + revenueEvolution: external_CoreHome_["NumberFormatter"].calculateAndFormatEvolution(response.totals.revenue, response.totals.previous_revenue, true), + revenueTrend: Math.sign(response.totals.revenue - response.totals.previous_revenue), + visits: external_CoreHome_["NumberFormatter"].formatNumber(response.totals.nb_visits), + visitsEvolution: external_CoreHome_["NumberFormatter"].calculateAndFormatEvolution(response.totals.nb_visits, response.totals.previous_nb_visits, true), + visitsTrend: Math.sign(response.totals.nb_visits - response.totals.previous_nb_visits) }; } }, { @@ -472,7 +472,6 @@ var AllWebsitesDashboard_store_DashboardStore = /*#__PURE__*/function () { value: function updateDashboardSites(response) { this.privateState.dashboardSites = response.sites; this.privateState.numSites = response.numSites; - this.privateState.sparklineDate = response.sparklineDate; } }]); @@ -673,28 +672,28 @@ KPICardvue_type_script_lang_ts.render = KPICardvue_type_template_id_3c2758fa_ren KPICardContainervue_type_script_lang_ts.render = KPICardContainervue_type_template_id_87c62b90_render /* harmony default export */ var KPICardContainer = (KPICardContainervue_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/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue?vue&type=template&id=345ec591 +// 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/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue?vue&type=template&id=198e6bf1 -var SitesTablevue_type_template_id_345ec591_hoisted_1 = { +var SitesTablevue_type_template_id_198e6bf1_hoisted_1 = { class: "sitesTableContainer" }; -var SitesTablevue_type_template_id_345ec591_hoisted_2 = { +var SitesTablevue_type_template_id_198e6bf1_hoisted_2 = { class: "card-table dataTable sitesTable" }; -var SitesTablevue_type_template_id_345ec591_hoisted_3 = { +var SitesTablevue_type_template_id_198e6bf1_hoisted_3 = { class: "sitesTableEvolutionSelector" }; -var SitesTablevue_type_template_id_345ec591_hoisted_4 = ["value"]; -var SitesTablevue_type_template_id_345ec591_hoisted_5 = { +var SitesTablevue_type_template_id_198e6bf1_hoisted_4 = ["value"]; +var SitesTablevue_type_template_id_198e6bf1_hoisted_5 = { value: "hits_evolution" }; -var SitesTablevue_type_template_id_345ec591_hoisted_6 = { +var SitesTablevue_type_template_id_198e6bf1_hoisted_6 = { value: "visits_evolution" }; -var SitesTablevue_type_template_id_345ec591_hoisted_7 = { +var SitesTablevue_type_template_id_198e6bf1_hoisted_7 = { value: "pageviews_evolution" }; -var SitesTablevue_type_template_id_345ec591_hoisted_8 = { +var SitesTablevue_type_template_id_198e6bf1_hoisted_8 = { key: 0, value: "revenue_evolution" }; @@ -735,12 +734,12 @@ var _hoisted_21 = { var _hoisted_22 = { class: "dataTablePages" }; -function SitesTablevue_type_template_id_345ec591_render(_ctx, _cache, $props, $setup, $data, $options) { +function SitesTablevue_type_template_id_198e6bf1_render(_ctx, _cache, $props, $setup, $data, $options) { var _component_MatomoLoader = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("MatomoLoader"); var _component_SitesTableSite = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SitesTableSite"); - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), 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_["createElementVNode"])("div", SitesTablevue_type_template_id_345ec591_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("table", SitesTablevue_type_template_id_345ec591_hoisted_2, [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", { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), 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_["createElementVNode"])("div", SitesTablevue_type_template_id_198e6bf1_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("table", SitesTablevue_type_template_id_198e6bf1_hoisted_2, [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", { onClick: _cache[0] || (_cache[0] = function ($event) { return _ctx.sortBy('label'); }), @@ -784,13 +783,13 @@ function SitesTablevue_type_template_id_345ec591_render(_ctx, _cache, $props, $s }, [_ctx.sortColumn === _ctx.evolutionSelector ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { key: 0, class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(_ctx.sortColumnClass) - }, null, 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('MultiSites_Evolution')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", SitesTablevue_type_template_id_345ec591_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("select", { + }, null, 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('MultiSites_Evolution')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", SitesTablevue_type_template_id_198e6bf1_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("select", { class: "browser-default", value: _ctx.evolutionSelector, onChange: _cache[6] || (_cache[6] = function ($event) { return _ctx.changeEvolutionSelector($event.target.value); }) - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("option", SitesTablevue_type_template_id_345ec591_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ColumnHits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("option", SitesTablevue_type_template_id_345ec591_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ColumnNbVisits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("option", SitesTablevue_type_template_id_345ec591_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ColumnPageviews')), 1), _ctx.displayRevenue ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("option", SitesTablevue_type_template_id_345ec591_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ColumnRevenue')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 40, SitesTablevue_type_template_id_345ec591_hoisted_4)])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [_ctx.isLoading ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", _hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", _hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_MatomoLoader)])])) : _ctx.errorLoading ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", _hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", _hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ErrorRequest', '', '')) + " ", 1), _hoisted_14, _hoisted_15, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_NeedMoreHelp')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("option", SitesTablevue_type_template_id_198e6bf1_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ColumnHits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("option", SitesTablevue_type_template_id_198e6bf1_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ColumnNbVisits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("option", SitesTablevue_type_template_id_198e6bf1_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ColumnPageviews')), 1), _ctx.displayRevenue ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("option", SitesTablevue_type_template_id_198e6bf1_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ColumnRevenue')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 40, SitesTablevue_type_template_id_198e6bf1_hoisted_4)])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [_ctx.isLoading ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", _hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", _hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_MatomoLoader)])])) : _ctx.errorLoading ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", _hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", _hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_ErrorRequest', '', '')) + " ", 1), _hoisted_14, _hoisted_15, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_NeedMoreHelp')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { rel: "noreferrer noopener", target: "_blank", href: _ctx.externalRawLink('https://matomo.org/faq/troubleshooting/faq_19489/') @@ -810,9 +809,9 @@ function SitesTablevue_type_template_id_345ec591_render(_ctx, _cache, $props, $s "evolution-metric": _ctx.evolutionMetric, key: "site-".concat(site.idsite), "model-value": site, - "sparkline-date": _ctx.sparklineDate, + "display-sparkline": _ctx.displaySparklines, "sparkline-metric": _ctx.sparklineMetric - }, null, 8, ["display-revenue", "evolution-metric", "model-value", "sparkline-date", "sparkline-metric"]); + }, null, 8, ["display-revenue", "evolution-metric", "model-value", "display-sparkline", "sparkline-metric"]); }), 128))])])]), !_ctx.isLoading || _ctx.paginationUpperBound > 0 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_21, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "dataTablePrevious", onClick: _cache[7] || (_cache[7] = function ($event) { @@ -825,76 +824,76 @@ function SitesTablevue_type_template_id_345ec591_render(_ctx, _cache, $props, $s }) }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Next')) + " » ", 513), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.paginationCurrentPage < _ctx.paginationMaxPage]])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 64); } -// CONCATENATED MODULE: ./plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue?vue&type=template&id=345ec591 +// CONCATENATED MODULE: ./plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue?vue&type=template&id=198e6bf1 -// 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/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue?vue&type=template&id=234c7c03 +// 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/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue?vue&type=template&id=00161366 -var SitesTableSitevue_type_template_id_234c7c03_hoisted_1 = { +var SitesTableSitevue_type_template_id_00161366_hoisted_1 = { class: "label" }; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_2 = ["href", "title"]; +var SitesTableSitevue_type_template_id_00161366_hoisted_2 = ["href", "title"]; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +var SitesTableSitevue_type_template_id_00161366_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "icon icon-outlink" }, null, -1); -var SitesTableSitevue_type_template_id_234c7c03_hoisted_4 = [SitesTableSitevue_type_template_id_234c7c03_hoisted_3]; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_5 = ["href"]; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_6 = { +var SitesTableSitevue_type_template_id_00161366_hoisted_4 = [SitesTableSitevue_type_template_id_00161366_hoisted_3]; +var SitesTableSitevue_type_template_id_00161366_hoisted_5 = ["href"]; +var SitesTableSitevue_type_template_id_00161366_hoisted_6 = { key: 1, class: "value" }; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_7 = { +var SitesTableSitevue_type_template_id_00161366_hoisted_7 = { class: "value" }; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_8 = { +var SitesTableSitevue_type_template_id_00161366_hoisted_8 = { class: "value" }; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_9 = { +var SitesTableSitevue_type_template_id_00161366_hoisted_9 = { class: "value" }; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_10 = { +var SitesTableSitevue_type_template_id_00161366_hoisted_10 = { key: 0 }; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_11 = { +var SitesTableSitevue_type_template_id_00161366_hoisted_11 = { class: "value" }; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_12 = ["colspan"]; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_13 = ["src"]; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_14 = { +var SitesTableSitevue_type_template_id_00161366_hoisted_12 = ["colspan"]; +var SitesTableSitevue_type_template_id_00161366_hoisted_13 = ["src"]; +var SitesTableSitevue_type_template_id_00161366_hoisted_14 = { key: 1, class: "sitesTableSparkline" }; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_15 = ["href", "title"]; -var SitesTableSitevue_type_template_id_234c7c03_hoisted_16 = ["src"]; -function SitesTableSitevue_type_template_id_234c7c03_render(_ctx, _cache, $props, $setup, $data, $options) { +var SitesTableSitevue_type_template_id_00161366_hoisted_15 = ["href", "title"]; +var SitesTableSitevue_type_template_id_00161366_hoisted_16 = ["src"]; +function SitesTableSitevue_type_template_id_00161366_render(_ctx, _cache, $props, $setup, $data, $options) { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])({ sitesTableGroup: !!_ctx.site.isGroup, sitesTableGroupSite: !_ctx.site.isGroup && !!_ctx.site.group, sitesTableSite: !_ctx.site.isGroup && !_ctx.site.group }) - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", SitesTableSitevue_type_template_id_234c7c03_hoisted_1, [!_ctx.site.isGroup ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], { + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", SitesTableSitevue_type_template_id_00161366_hoisted_1, [!_ctx.site.isGroup ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], { key: 0 }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { rel: "noreferrer noopener", target: "_blank", href: _ctx.site.main_url, title: _ctx.translate('General_GoTo', _ctx.site.main_url) - }, SitesTableSitevue_type_template_id_234c7c03_hoisted_4, 8, SitesTableSitevue_type_template_id_234c7c03_hoisted_2), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, SitesTableSitevue_type_template_id_00161366_hoisted_4, 8, SitesTableSitevue_type_template_id_00161366_hoisted_2), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { title: "View reports", class: "value", href: _ctx.dashboardUrl - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.siteLabel), 9, SitesTableSitevue_type_template_id_234c7c03_hoisted_5)], 64)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", SitesTableSitevue_type_template_id_234c7c03_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.siteLabel), 1))]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SitesTableSitevue_type_template_id_234c7c03_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.site.nb_visits), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SitesTableSitevue_type_template_id_234c7c03_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.site.nb_pageviews), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SitesTableSitevue_type_template_id_234c7c03_hoisted_9, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.site.hits), 1)]), _ctx.displayRevenue ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", SitesTableSitevue_type_template_id_234c7c03_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SitesTableSitevue_type_template_id_234c7c03_hoisted_11, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.site.revenue), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.siteLabel), 9, SitesTableSitevue_type_template_id_00161366_hoisted_5)], 64)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", SitesTableSitevue_type_template_id_00161366_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.siteLabel), 1))]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SitesTableSitevue_type_template_id_00161366_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.formatNumber(_ctx.site.nb_visits)), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SitesTableSitevue_type_template_id_00161366_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.formatNumber(_ctx.site.nb_pageviews)), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SitesTableSitevue_type_template_id_00161366_hoisted_9, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.formatNumber(_ctx.site.hits)), 1)]), _ctx.displayRevenue ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", SitesTableSitevue_type_template_id_00161366_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SitesTableSitevue_type_template_id_00161366_hoisted_11, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.formatCurrency(_ctx.site.revenue, _ctx.site.currencySymbol)), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { colspan: _ctx.displaySparkline ? 1 : 2 }, [!_ctx.site.isGroup && !!_ctx.site[_ctx.evolutionMetric] ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], { key: 0 }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: _ctx.evolutionIconSrc, alt: "" - }, null, 8, SitesTableSitevue_type_template_id_234c7c03_hoisted_13), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + }, null, 8, SitesTableSitevue_type_template_id_00161366_hoisted_13), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(_ctx.evolutionTrendClass) - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.site[_ctx.evolutionMetric]), 3)], 64)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 8, SitesTableSitevue_type_template_id_234c7c03_hoisted_12), _ctx.displaySparkline ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", SitesTableSitevue_type_template_id_234c7c03_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.calculateAndFormatEvolution(_ctx.site[_ctx.sparklineMetric], _ctx.site["previous_".concat(_ctx.sparklineMetric)], true)), 3)], 64)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 8, SitesTableSitevue_type_template_id_00161366_hoisted_12), _ctx.displaySparkline ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", SitesTableSitevue_type_template_id_00161366_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { rel: "noreferrer noopener", target: "_blank", href: _ctx.dashboardUrl, @@ -904,9 +903,9 @@ function SitesTableSitevue_type_template_id_234c7c03_render(_ctx, _cache, $props width: "100", height: "25", src: _ctx.evolutionSparklineSrc - }, null, 8, SitesTableSitevue_type_template_id_234c7c03_hoisted_16)], 8, SitesTableSitevue_type_template_id_234c7c03_hoisted_15)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 2); + }, null, 8, SitesTableSitevue_type_template_id_00161366_hoisted_16)], 8, SitesTableSitevue_type_template_id_00161366_hoisted_15)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 2); } -// CONCATENATED MODULE: ./plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue?vue&type=template&id=234c7c03 +// CONCATENATED MODULE: ./plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue?vue&type=template&id=00161366 // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue?vue&type=script&lang=ts @@ -925,8 +924,8 @@ function SitesTableSitevue_type_template_id_234c7c03_render(_ctx, _cache, $props type: Object, required: true }, - sparklineDate: String, - sparklineMetric: String + sparklineMetric: String, + displaySparkline: Boolean }, computed: { dashboardUrl: function dashboardUrl() { @@ -939,9 +938,6 @@ function SitesTableSitevue_type_template_id_234c7c03_render(_ctx, _cache, $props }); return "?".concat(dashboardParams).concat(this.tokenParam); }, - displaySparkline: function displaySparkline() { - return !this.site.isGroup && this.sparklineDate && this.sparklineMetric; - }, evolutionIconSrc: function evolutionIconSrc() { if (this.evolutionTrend === 1) { return 'plugins/MultiSites/images/arrow_up.png'; @@ -954,10 +950,20 @@ function SitesTableSitevue_type_template_id_234c7c03_render(_ctx, _cache, $props return 'plugins/MultiSites/images/stop.png'; }, evolutionSparklineSrc: function evolutionSparklineSrc() { + var sparklineDate = external_CoreHome_["Matomo"].currentDateString; + + if (external_CoreHome_["Matomo"].period !== 'range') { + var _Range$getLastNRange = external_CoreHome_["Range"].getLastNRange(external_CoreHome_["Matomo"].period, '30', external_CoreHome_["Matomo"].currentDateString), + startDate = _Range$getLastNRange.startDate, + endDate = _Range$getLastNRange.endDate; + + sparklineDate = "".concat(Object(external_CoreHome_["format"])(startDate), ",").concat(Object(external_CoreHome_["format"])(endDate)); + } + var sparklineParams = external_CoreHome_["MatomoUrl"].stringify({ module: 'MultiSites', action: 'getEvolutionGraph', - date: this.sparklineDate, + date: sparklineDate, period: external_CoreHome_["Matomo"].period, idSite: this.site.idsite, columns: this.sparklineMetric, @@ -1000,7 +1006,7 @@ function SitesTableSitevue_type_template_id_234c7c03_render(_ctx, _cache, $props -SitesTableSitevue_type_script_lang_ts.render = SitesTableSitevue_type_template_id_234c7c03_render +SitesTableSitevue_type_script_lang_ts.render = SitesTableSitevue_type_template_id_00161366_render /* harmony default export */ var SitesTableSite = (SitesTableSitevue_type_script_lang_ts); // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue?vue&type=script&lang=ts @@ -1089,9 +1095,6 @@ SitesTableSitevue_type_script_lang_ts.render = SitesTableSitevue_type_template_i default: return ''; } - }, - sparklineDate: function sparklineDate() { - return this.displaySparklines ? AllWebsitesDashboard_store.state.value.sparklineDate : null; } }, methods: { @@ -1116,7 +1119,7 @@ SitesTableSitevue_type_script_lang_ts.render = SitesTableSitevue_type_template_i -SitesTablevue_type_script_lang_ts.render = SitesTablevue_type_template_id_345ec591_render +SitesTablevue_type_script_lang_ts.render = SitesTablevue_type_template_id_198e6bf1_render /* harmony default export */ var SitesTable = (SitesTablevue_type_script_lang_ts); // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/MultiSites/vue/src/AllWebsitesDashboard/AllWebsitesDashboard.vue?vue&type=script&lang=ts diff --git a/plugins/MultiSites/vue/dist/MultiSites.umd.min.js b/plugins/MultiSites/vue/dist/MultiSites.umd.min.js index 69ffc17422fe..d81c82d651c5 100644 --- a/plugins/MultiSites/vue/dist/MultiSites.umd.min.js +++ b/plugins/MultiSites/vue/dist/MultiSites.umd.min.js @@ -1,16 +1,16 @@ -(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,"AllWebsitesDashboard",(function(){return De})),n.d(t,"MultisitesSite",(function(){return pt})),n.d(t,"DashboadStore",(function(){return ft})),n.d(t,"Dashboard",(function(){return mn})),"undefined"!==typeof window){var r=window.document.currentScript,a=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);a&&(n.p=a[1])}var o=n("8bbf"),i={class:"dashboardHeader"},s={class:"card-title"},l={class:"dashboardControls"},c={class:"siteSearch"},u=["placeholder"],d=["title"],b=["href"];function p(e,t,n,r,a,p){var m=Object(o["resolveComponent"])("EnrichedHeadline"),v=Object(o["resolveComponent"])("KPICardContainer"),h=Object(o["resolveComponent"])("SitesTable");return Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],null,[Object(o["createElementVNode"])("div",i,[Object(o["createElementVNode"])("h1",s,[Object(o["createVNode"])(m,{"feature-name":e.translate("MultiSites_AllWebsitesDashboardTitle")},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("MultiSites_AllWebsitesDashboardTitle")),1)]})),_:1},8,["feature-name"])])]),Object(o["createVNode"])(v,{"is-loading":e.isLoadingKPIs,"model-value":e.kpis},null,8,["is-loading","model-value"]),Object(o["createElementVNode"])("div",l,[Object(o["createElementVNode"])("div",c,[Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"text",onKeydown:t[0]||(t[0]=Object(o["withKeys"])((function(t){return e.searchSite(e.searchTerm)}),["enter"])),"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchTerm=t}),placeholder:e.translate("Actions_SubmenuSitesearch")},null,40,u),[[o["vModelText"],e.searchTerm]]),Object(o["createElementVNode"])("span",{class:"icon-search",onClick:t[2]||(t[2]=function(t){return e.searchSite(e.searchTerm)}),title:e.translate("General_ClickToSearch")},null,8,d)]),!e.isWidgetized&&e.isUserAllowedToAddSite?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:0,class:"btn",href:e.addSiteUrl},Object(o["toDisplayString"])(e.translate("SitesManager_AddSite")),9,b)):Object(o["createCommentVNode"])("",!0)]),Object(o["createVNode"])(h,{"display-revenue":e.displayRevenue,"display-sparklines":e.displaySparklines},null,8,["display-revenue","display-sparklines"])],64)}var m=n("19dc");function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0];this.fetchAbort&&(this.fetchAbort.abort(),this.fetchAbort=null,this.cancelAutoRefresh()),this.fetchAbort=new AbortController,this.privateState.errorLoading=!1,this.privateState.isLoadingKPIs=!t,this.privateState.isLoadingSites=!0;var n={method:"MultiSites.mockDashboardData",filter_limit:this.pageSize,filter_offset:this.currentPagingOffset.value,filter_sort_column:this.privateState.sortColumn,filter_sort_order:this.privateState.sortOrder,showColumns:["hits_evolution","hits_evolution_trend","label","hits","nb_pageviews","nb_visits","pageviews_evolution","pageviews_evolution_trend","revenue","revenue_evolution","revenue_evolution_trend","visits_evolution","visits_evolution_trend"].join(",")};return this.searchTerm&&(n.pattern=this.searchTerm),m["AjaxHelper"].fetch(n,{abortController:this.fetchAbort}).then((function(n){t||e.updateDashboardKPIs(n),e.updateDashboardSites(n)})).catch((function(){e.privateState.dashboardSites=[],e.privateState.errorLoading=!0})).finally((function(){e.privateState.isLoadingKPIs=!1,e.privateState.isLoadingSites=!1,e.fetchAbort=null,e.startAutoRefresh()}))}},{key:"startAutoRefresh",value:function(){var e=this;if(this.cancelAutoRefresh(),!(this.autoRefreshInterval<=0)){var t;try{t=m["Periods"].parse(m["Matomo"].period,m["Matomo"].currentDateString)}catch(n){}t&&t.containsToday()&&(this.autoRefreshTimeout=setTimeout((function(){e.autoRefreshTimeout=null,e.refreshData()}),1e3*this.autoRefreshInterval))}}},{key:"updateDashboardKPIs",value:function(e){this.privateState.dashboardKPIs={evolutionPeriod:m["Matomo"].period,hits:e.totals.hits,hitsEvolution:e.totals.hits_evolution,hitsTrend:e.totals.hits_evolution_trend,pageviews:e.totals.nb_pageviews,pageviewsEvolution:e.totals.pageviews_evolution,pageviewsTrend:e.totals.pageviews_evolution_trend,revenue:e.totals.revenue,revenueEvolution:e.totals.revenue_evolution,revenueTrend:e.totals.revenue_evolution_trend,visits:e.totals.nb_visits,visitsEvolution:e.totals.visits_evolution,visitsTrend:e.totals.visits_evolution_trend}}},{key:"updateDashboardSites",value:function(e){this.privateState.dashboardSites=e.sites,this.privateState.numSites=e.numSites,this.privateState.sparklineDate=e.sparklineDate}}]),e}(),k=new S,y={class:"kpiCardContainer"},_={key:0,class:"kpiCard kpiCardLoading"},C=Object(o["createElementVNode"])("div",{class:"kpiCardTitle"}," ",-1),E={class:"kpiCardValue"},N=Object(o["createElementVNode"])("div",{class:"kpiCardEvolution"},[Object(o["createElementVNode"])("span",{class:"kpiCardEvolutionTrend"}," ")],-1),V={key:0,class:"kpiCardBadge"};function w(e,t,n,r,a,i){var s=Object(o["resolveComponent"])("MatomoLoader"),l=Object(o["resolveComponent"])("KPICard");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",y,[e.isLoading?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",_,[C,Object(o["createElementVNode"])("div",E,[Object(o["createVNode"])(s)]),N,e.hasKpiBadge?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",V," ")):Object(o["createCommentVNode"])("",!0)])):(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],{key:1},Object(o["renderList"])(e.kpis,(function(t,n){return Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],{key:"kpi-card-".concat(n)},[n>0?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:0,class:Object(o["normalizeClass"])({kpiCardDivider:!0,kpiCardDividerBadge:e.hasKpiBadge})}," ",2)):Object(o["createCommentVNode"])("",!0),Object(o["createVNode"])(l,{"model-value":t},null,8,["model-value"])],64)})),128))])}var T={class:"kpiCard"},B={class:"kpiCardTitle"},P={class:"kpiCardValue"},M={class:"kpiCardEvolution"},D={key:1,class:"kpiCardEvolution"},x=Object(o["createElementVNode"])("span",{class:"kpiCardEvolutionTrend"}," ",-1),L=[x],G=["innerHTML"];function R(e,t,n,r,a,i){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",T,[Object(o["createElementVNode"])("div",B,[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])("kpiCardIcon ".concat(e.kpi.icon))},null,2),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate(e.kpi.title)),1)]),Object(o["createElementVNode"])("div",P,Object(o["toDisplayString"])(e.kpi.value),1),Object(o["createElementVNode"])("div",M,[""!==e.kpi.evolutionValue?(Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],{key:0},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])("kpiCardEvolutionTrend ".concat(e.evolutionTrendClass))},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])("kpiCardEvolutionIcon ".concat(e.evolutionTrendIcon))},null,2),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.kpi.evolutionValue),1)],2),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate(e.evolutionTrendFrom)),1)],64)):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",D,L))]),e.kpi.badge?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:0,innerHTML:e.$sanitize(e.kpi.badge),class:"kpiCardBadge"},null,8,G)):Object(o["createCommentVNode"])("",!0)])}var A=Object(o["defineComponent"])({props:{modelValue:{type:Object,required:!0}},computed:{evolutionTrendFrom:function(){switch(this.kpi.evolutionPeriod){case"day":return"MultiSites_EvolutionFromPreviousDay";case"week":return"MultiSites_EvolutionFromPreviousWeek";case"month":return"MultiSites_EvolutionFromPreviousMonth";case"year":return"MultiSites_EvolutionFromPreviousYear";default:return"MultiSites_EvolutionFromPreviousPeriod"}},evolutionTrendClass:function(){return 1===this.kpi.evolutionTrend?"kpiTrendPositive":-1===this.kpi.evolutionTrend?"kpiTrendNegative":"kpiTrendNeutral"},evolutionTrendIcon:function(){return 1===this.kpi.evolutionTrend?"icon-chevron-up":-1===this.kpi.evolutionTrend?"icon-chevron-down":"icon-circle"},kpi:function(){return this.modelValue}}});A.render=R;var I=A,z=Object(o["defineComponent"])({components:{MatomoLoader:m["MatomoLoader"],KPICard:I},props:{isLoading:Boolean,modelValue:{type:Array,required:!0}},computed:{hasKpiBadge:function(){return this.kpis.some((function(e){return!!e.badge}))},kpis:function(){return this.modelValue}}});z.render=w;var F=z,U={class:"sitesTableContainer"},H={class:"card-table dataTable sitesTable"},q={class:"sitesTableEvolutionSelector"},K=["value"],W={value:"hits_evolution"},$={value:"visits_evolution"},J={value:"pageviews_evolution"},Y={key:0,value:"revenue_evolution"},Q={key:0},X={class:"sitesTableLoading",colspan:"7"},Z={key:1},ee={colspan:"7"},te={class:"notification system notification-error"},ne=Object(o["createElementVNode"])("br",null,null,-1),re=Object(o["createElementVNode"])("br",null,null,-1),ae=["href"],oe=Object(o["createTextVNode"])(" – "),ie=["href"],se=["href"],le=Object(o["createTextVNode"])(". "),ce={key:0,class:"sitesTablePagination"},ue={class:"dataTablePages"};function de(e,t,n,r,a,i){var s=Object(o["resolveComponent"])("MatomoLoader"),l=Object(o["resolveComponent"])("SitesTableSite");return Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],null,[Object(o["createElementVNode"])("div",U,[Object(o["createElementVNode"])("table",H,[Object(o["createElementVNode"])("thead",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("th",{onClick:t[0]||(t[0]=function(t){return e.sortBy("label")}),class:"label"},[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_Website"))+" ",1),"label"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0)]),Object(o["createElementVNode"])("th",{onClick:t[1]||(t[1]=function(t){return e.sortBy("nb_visits")})},["nb_visits"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_ColumnNbVisits")),1)]),Object(o["createElementVNode"])("th",{onClick:t[2]||(t[2]=function(t){return e.sortBy("nb_pageviews")})},["nb_pageviews"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_ColumnPageviews")),1)]),Object(o["createElementVNode"])("th",{onClick:t[3]||(t[3]=function(t){return e.sortBy("hits")})},["hits"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_ColumnHits")),1)]),e.displayRevenue?(Object(o["openBlock"])(),Object(o["createElementBlock"])("th",{key:0,onClick:t[4]||(t[4]=function(t){return e.sortBy("revenue")})},["revenue"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_ColumnRevenue")),1)])):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("th",{onClick:t[5]||(t[5]=function(t){return e.sortBy(e.evolutionSelector)})},[e.sortColumn===e.evolutionSelector?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("MultiSites_Evolution")),1)]),Object(o["createElementVNode"])("th",q,[Object(o["createElementVNode"])("select",{class:"browser-default",value:e.evolutionSelector,onChange:t[6]||(t[6]=function(t){return e.changeEvolutionSelector(t.target.value)})},[Object(o["createElementVNode"])("option",W,Object(o["toDisplayString"])(e.translate("General_ColumnHits")),1),Object(o["createElementVNode"])("option",$,Object(o["toDisplayString"])(e.translate("General_ColumnNbVisits")),1),Object(o["createElementVNode"])("option",J,Object(o["toDisplayString"])(e.translate("General_ColumnPageviews")),1),e.displayRevenue?(Object(o["openBlock"])(),Object(o["createElementBlock"])("option",Y,Object(o["toDisplayString"])(e.translate("General_ColumnRevenue")),1)):Object(o["createCommentVNode"])("",!0)],40,K)])])]),Object(o["createElementVNode"])("tbody",null,[e.isLoading?(Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",Q,[Object(o["createElementVNode"])("td",X,[Object(o["createVNode"])(s)])])):e.errorLoading?(Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",Z,[Object(o["createElementVNode"])("td",ee,[Object(o["createElementVNode"])("div",te,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_ErrorRequest","",""))+" ",1),ne,re,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_NeedMoreHelp"))+" ",1),Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://matomo.org/faq/troubleshooting/faq_19489/")},Object(o["toDisplayString"])(e.translate("General_Faq")),9,ae),oe,Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://forum.matomo.org/")},Object(o["toDisplayString"])(e.translate("Feedback_CommunityHelp")),9,ie),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",null," – ",512),[[o["vShow"],e.errorShowProfessionalHelp]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://matomo.org/support-plans/")},Object(o["toDisplayString"])(e.translate("Feedback_ProfessionalHelp")),9,se),[[o["vShow"],e.errorShowProfessionalHelp]]),le])])])):(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],{key:2},Object(o["renderList"])(e.sites,(function(t){return Object(o["openBlock"])(),Object(o["createBlock"])(l,{"display-revenue":e.displayRevenue,"evolution-metric":e.evolutionMetric,key:"site-".concat(t.idsite),"model-value":t,"sparkline-date":e.sparklineDate,"sparkline-metric":e.sparklineMetric},null,8,["display-revenue","evolution-metric","model-value","sparkline-date","sparkline-metric"])})),128))])])]),!e.isLoading||e.paginationUpperBound>0?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ce,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"dataTablePrevious",onClick:t[7]||(t[7]=function(t){return e.navigatePreviousPage()})}," « "+Object(o["toDisplayString"])(e.translate("General_Previous")),513),[[o["vShow"],0!==e.paginationCurrentPage]]),Object(o["createElementVNode"])("span",ue,Object(o["toDisplayString"])(e.translate("General_Pagination",e.paginationLowerBound,e.paginationUpperBound,e.numberOfFilteredSites)),1),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"dataTableNext",onClick:t[8]||(t[8]=function(t){return e.navigateNextPage()})},Object(o["toDisplayString"])(e.translate("General_Next"))+" » ",513),[[o["vShow"],e.paginationCurrentPage0&&void 0!==arguments[0]&&arguments[0];this.fetchAbort&&(this.fetchAbort.abort(),this.fetchAbort=null,this.cancelAutoRefresh()),this.fetchAbort=new AbortController,this.privateState.errorLoading=!1,this.privateState.isLoadingKPIs=!t,this.privateState.isLoadingSites=!0;var n={method:"MultiSites.getAllWithGroups",filter_limit:this.pageSize,filter_offset:this.currentPagingOffset.value,filter_sort_column:this.privateState.sortColumn,filter_sort_order:this.privateState.sortOrder,format_metrics:0,showColumns:["hits_evolution","hits_evolution_trend","label","hits","nb_pageviews","nb_visits","pageviews_evolution","pageviews_evolution_trend","revenue","revenue_evolution","revenue_evolution_trend","visits_evolution","visits_evolution_trend"].join(",")};return this.searchTerm&&(n.pattern=this.searchTerm),p["AjaxHelper"].fetch(n,{abortController:this.fetchAbort}).then((function(n){t||e.updateDashboardKPIs(n),e.updateDashboardSites(n)})).catch((function(){e.privateState.dashboardSites=[],e.privateState.errorLoading=!0})).finally((function(){e.privateState.isLoadingKPIs=!1,e.privateState.isLoadingSites=!1,e.fetchAbort=null,e.startAutoRefresh()}))}},{key:"startAutoRefresh",value:function(){var e=this;if(this.cancelAutoRefresh(),!(this.autoRefreshInterval<=0)){var t;try{t=p["Periods"].parse(p["Matomo"].period,p["Matomo"].currentDateString)}catch(n){}t&&t.containsToday()&&(this.autoRefreshTimeout=setTimeout((function(){e.autoRefreshTimeout=null,e.refreshData()}),1e3*this.autoRefreshInterval))}}},{key:"updateDashboardKPIs",value:function(e){this.privateState.dashboardKPIs={evolutionPeriod:p["Matomo"].period,hits:p["NumberFormatter"].formatNumber(e.totals.hits),hitsEvolution:p["NumberFormatter"].calculateAndFormatEvolution(e.totals.hits,e.totals.previous_hits,!0),hitsTrend:Math.sign(e.totals.hits-e.totals.previous_hits),pageviews:p["NumberFormatter"].formatNumber(e.totals.nb_pageviews),pageviewsEvolution:p["NumberFormatter"].calculateAndFormatEvolution(e.totals.nb_pageviews,e.totals.previous_nb_pageviews,!0),pageviewsTrend:Math.sign(e.totals.nb_pageviews-e.totals.previous_nb_pageviews),revenue:p["NumberFormatter"].formatCurrency(e.totals.revenue,""),revenueEvolution:p["NumberFormatter"].calculateAndFormatEvolution(e.totals.revenue,e.totals.previous_revenue,!0),revenueTrend:Math.sign(e.totals.revenue-e.totals.previous_revenue),visits:p["NumberFormatter"].formatNumber(e.totals.nb_visits),visitsEvolution:p["NumberFormatter"].calculateAndFormatEvolution(e.totals.nb_visits,e.totals.previous_nb_visits,!0),visitsTrend:Math.sign(e.totals.nb_visits-e.totals.previous_nb_visits)}}},{key:"updateDashboardSites",value:function(e){this.privateState.dashboardSites=e.sites,this.privateState.numSites=e.numSites}}]),e}(),k=new S,y={class:"kpiCardContainer"},_={key:0,class:"kpiCard kpiCardLoading"},N=Object(o["createElementVNode"])("div",{class:"kpiCardTitle"}," ",-1),C={class:"kpiCardValue"},E=Object(o["createElementVNode"])("div",{class:"kpiCardEvolution"},[Object(o["createElementVNode"])("span",{class:"kpiCardEvolutionTrend"}," ")],-1),V={key:0,class:"kpiCardBadge"};function w(e,t,n,r,a,i){var s=Object(o["resolveComponent"])("MatomoLoader"),l=Object(o["resolveComponent"])("KPICard");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",y,[e.isLoading?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",_,[N,Object(o["createElementVNode"])("div",C,[Object(o["createVNode"])(s)]),E,e.hasKpiBadge?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",V," ")):Object(o["createCommentVNode"])("",!0)])):(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],{key:1},Object(o["renderList"])(e.kpis,(function(t,n){return Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],{key:"kpi-card-".concat(n)},[n>0?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:0,class:Object(o["normalizeClass"])({kpiCardDivider:!0,kpiCardDividerBadge:e.hasKpiBadge})}," ",2)):Object(o["createCommentVNode"])("",!0),Object(o["createVNode"])(l,{"model-value":t},null,8,["model-value"])],64)})),128))])}var T={class:"kpiCard"},B={class:"kpiCardTitle"},P={class:"kpiCardValue"},M={class:"kpiCardEvolution"},D={key:1,class:"kpiCardEvolution"},x=Object(o["createElementVNode"])("span",{class:"kpiCardEvolutionTrend"}," ",-1),L=[x],A=["innerHTML"];function R(e,t,n,r,a,i){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",T,[Object(o["createElementVNode"])("div",B,[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])("kpiCardIcon ".concat(e.kpi.icon))},null,2),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate(e.kpi.title)),1)]),Object(o["createElementVNode"])("div",P,Object(o["toDisplayString"])(e.kpi.value),1),Object(o["createElementVNode"])("div",M,[""!==e.kpi.evolutionValue?(Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],{key:0},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])("kpiCardEvolutionTrend ".concat(e.evolutionTrendClass))},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])("kpiCardEvolutionIcon ".concat(e.evolutionTrendIcon))},null,2),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.kpi.evolutionValue),1)],2),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate(e.evolutionTrendFrom)),1)],64)):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",D,L))]),e.kpi.badge?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:0,innerHTML:e.$sanitize(e.kpi.badge),class:"kpiCardBadge"},null,8,A)):Object(o["createCommentVNode"])("",!0)])}var G=Object(o["defineComponent"])({props:{modelValue:{type:Object,required:!0}},computed:{evolutionTrendFrom:function(){switch(this.kpi.evolutionPeriod){case"day":return"MultiSites_EvolutionFromPreviousDay";case"week":return"MultiSites_EvolutionFromPreviousWeek";case"month":return"MultiSites_EvolutionFromPreviousMonth";case"year":return"MultiSites_EvolutionFromPreviousYear";default:return"MultiSites_EvolutionFromPreviousPeriod"}},evolutionTrendClass:function(){return 1===this.kpi.evolutionTrend?"kpiTrendPositive":-1===this.kpi.evolutionTrend?"kpiTrendNegative":"kpiTrendNeutral"},evolutionTrendIcon:function(){return 1===this.kpi.evolutionTrend?"icon-chevron-up":-1===this.kpi.evolutionTrend?"icon-chevron-down":"icon-circle"},kpi:function(){return this.modelValue}}});G.render=R;var F=G,I=Object(o["defineComponent"])({components:{MatomoLoader:p["MatomoLoader"],KPICard:F},props:{isLoading:Boolean,modelValue:{type:Array,required:!0}},computed:{hasKpiBadge:function(){return this.kpis.some((function(e){return!!e.badge}))},kpis:function(){return this.modelValue}}});I.render=w;var z=I,U={class:"sitesTableContainer"},H={class:"card-table dataTable sitesTable"},q={class:"sitesTableEvolutionSelector"},K=["value"],W={value:"hits_evolution"},$={value:"visits_evolution"},J={value:"pageviews_evolution"},Y={key:0,value:"revenue_evolution"},Q={key:0},X={class:"sitesTableLoading",colspan:"7"},Z={key:1},ee={colspan:"7"},te={class:"notification system notification-error"},ne=Object(o["createElementVNode"])("br",null,null,-1),re=Object(o["createElementVNode"])("br",null,null,-1),ae=["href"],oe=Object(o["createTextVNode"])(" – "),ie=["href"],se=["href"],le=Object(o["createTextVNode"])(". "),ce={key:0,class:"sitesTablePagination"},ue={class:"dataTablePages"};function de(e,t,n,r,a,i){var s=Object(o["resolveComponent"])("MatomoLoader"),l=Object(o["resolveComponent"])("SitesTableSite");return Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],null,[Object(o["createElementVNode"])("div",U,[Object(o["createElementVNode"])("table",H,[Object(o["createElementVNode"])("thead",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("th",{onClick:t[0]||(t[0]=function(t){return e.sortBy("label")}),class:"label"},[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_Website"))+" ",1),"label"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0)]),Object(o["createElementVNode"])("th",{onClick:t[1]||(t[1]=function(t){return e.sortBy("nb_visits")})},["nb_visits"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_ColumnNbVisits")),1)]),Object(o["createElementVNode"])("th",{onClick:t[2]||(t[2]=function(t){return e.sortBy("nb_pageviews")})},["nb_pageviews"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_ColumnPageviews")),1)]),Object(o["createElementVNode"])("th",{onClick:t[3]||(t[3]=function(t){return e.sortBy("hits")})},["hits"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_ColumnHits")),1)]),e.displayRevenue?(Object(o["openBlock"])(),Object(o["createElementBlock"])("th",{key:0,onClick:t[4]||(t[4]=function(t){return e.sortBy("revenue")})},["revenue"===e.sortColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_ColumnRevenue")),1)])):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("th",{onClick:t[5]||(t[5]=function(t){return e.sortBy(e.evolutionSelector)})},[e.sortColumn===e.evolutionSelector?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,class:Object(o["normalizeClass"])(e.sortColumnClass)},null,2)):Object(o["createCommentVNode"])("",!0),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("MultiSites_Evolution")),1)]),Object(o["createElementVNode"])("th",q,[Object(o["createElementVNode"])("select",{class:"browser-default",value:e.evolutionSelector,onChange:t[6]||(t[6]=function(t){return e.changeEvolutionSelector(t.target.value)})},[Object(o["createElementVNode"])("option",W,Object(o["toDisplayString"])(e.translate("General_ColumnHits")),1),Object(o["createElementVNode"])("option",$,Object(o["toDisplayString"])(e.translate("General_ColumnNbVisits")),1),Object(o["createElementVNode"])("option",J,Object(o["toDisplayString"])(e.translate("General_ColumnPageviews")),1),e.displayRevenue?(Object(o["openBlock"])(),Object(o["createElementBlock"])("option",Y,Object(o["toDisplayString"])(e.translate("General_ColumnRevenue")),1)):Object(o["createCommentVNode"])("",!0)],40,K)])])]),Object(o["createElementVNode"])("tbody",null,[e.isLoading?(Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",Q,[Object(o["createElementVNode"])("td",X,[Object(o["createVNode"])(s)])])):e.errorLoading?(Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",Z,[Object(o["createElementVNode"])("td",ee,[Object(o["createElementVNode"])("div",te,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_ErrorRequest","",""))+" ",1),ne,re,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_NeedMoreHelp"))+" ",1),Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://matomo.org/faq/troubleshooting/faq_19489/")},Object(o["toDisplayString"])(e.translate("General_Faq")),9,ae),oe,Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://forum.matomo.org/")},Object(o["toDisplayString"])(e.translate("Feedback_CommunityHelp")),9,ie),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",null," – ",512),[[o["vShow"],e.errorShowProfessionalHelp]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://matomo.org/support-plans/")},Object(o["toDisplayString"])(e.translate("Feedback_ProfessionalHelp")),9,se),[[o["vShow"],e.errorShowProfessionalHelp]]),le])])])):(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],{key:2},Object(o["renderList"])(e.sites,(function(t){return Object(o["openBlock"])(),Object(o["createBlock"])(l,{"display-revenue":e.displayRevenue,"evolution-metric":e.evolutionMetric,key:"site-".concat(t.idsite),"model-value":t,"display-sparkline":e.displaySparklines,"sparkline-metric":e.sparklineMetric},null,8,["display-revenue","evolution-metric","model-value","display-sparkline","sparkline-metric"])})),128))])])]),!e.isLoading||e.paginationUpperBound>0?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ce,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"dataTablePrevious",onClick:t[7]||(t[7]=function(t){return e.navigatePreviousPage()})}," « "+Object(o["toDisplayString"])(e.translate("General_Previous")),513),[[o["vShow"],0!==e.paginationCurrentPage]]),Object(o["createElementVNode"])("span",ue,Object(o["toDisplayString"])(e.translate("General_Pagination",e.paginationLowerBound,e.paginationUpperBound,e.numberOfFilteredSites)),1),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"dataTableNext",onClick:t[8]||(t[8]=function(t){return e.navigateNextPage()})},Object(o["toDisplayString"])(e.translate("General_Next"))+" » ",513),[[o["vShow"],e.paginationCurrentPagen&&(e=n),e})))}return ht(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=m["NumberFormatter"].formatPercent(Math.round(100*parseInt(e.ratio,10))),r=null,a="0",o="0",i="0",s="0";if("nb_visits"!==t.state.value.sortColumn&&"visits_evolution"!==t.state.value.sortColumn||(a=m["NumberFormatter"].formatNumber(e.previous_nb_visits),o=m["NumberFormatter"].formatNumber(e.nb_visits),i=m["NumberFormatter"].formatPercent(e.visits_evolution),r=Object(m["translate"])("General_ColumnNbVisits"),s=m["NumberFormatter"].formatNumber(Math.round(parseInt(e.previous_nb_visits,10)*parseInt(e.ratio,10)))),"pageviews_evolution"===t.state.value.sortColumn&&(a="".concat(e.previous_nb_pageviews),o="".concat(e.nb_pageviews),i=m["NumberFormatter"].formatPercent(e.pageviews_evolution),r=Object(m["translate"])("General_ColumnPageviews"),s=m["NumberFormatter"].formatNumber(Math.round(parseInt(e.previous_nb_pageviews,10)*parseInt(e.ratio,10)))),"hits_evolution"===t.state.value.sortColumn&&(a="".concat(e.previous_hits),o="".concat(e.hits),i=m["NumberFormatter"].formatPercent(e.hits_evolution),r=Object(m["translate"])("General_ColumnHits"),s=m["NumberFormatter"].formatNumber(Math.round(parseInt(e.previous_hits,10)*parseInt(e.ratio,10)))),"revenue_evolution"===t.state.value.sortColumn&&(a=m["NumberFormatter"].formatCurrency(e.previous_revenue,e.currencySymbol),o=m["NumberFormatter"].formatCurrency(e.revenue,e.currencySymbol),i=m["NumberFormatter"].formatPercent(e.revenue_evolution),r=Object(m["translate"])("General_ColumnRevenue"),s=m["NumberFormatter"].formatCurrency(Math.round(parseInt(e.previous_revenue,10)*parseInt(e.ratio,10)),e.currencySymbol)),r)switch(e.tooltip="".concat(Object(m["translate"])("MultiSites_EvolutionComparisonIncomplete",[n]),"\n"),e.tooltip+="".concat(Object(m["translate"])("MultiSites_EvolutionComparisonProportional",[n,"".concat(s),r,"".concat(a)]),"\n"),e.periodName){case"day":e.tooltip+=Object(m["translate"])("MultiSites_EvolutionComparisonDay",["".concat(o),r,"".concat(s),e.previousRange,"".concat(i)]);break;case"week":e.tooltip+=Object(m["translate"])("MultiSites_EvolutionComparisonWeek",["".concat(o),r,"".concat(s),e.previousRange,"".concat(i)]);break;case"month":e.tooltip+=Object(m["translate"])("MultiSites_EvolutionComparisonMonth",["".concat(o),r,"".concat(s),e.previousRange,"".concat(i)]);break;case"year":e.tooltip+=Object(m["translate"])("MultiSites_EvolutionComparisonYear",["".concat(o),r,"".concat(s),e.previousRange,"".concat(i)]);break;default:break}}})),this.privateState.totalVisits=e.totals.nb_visits,this.privateState.totalPageviews=e.totals.nb_pageviews,this.privateState.totalHits=e.totals.hits,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","hits","visits_evolution","visits_evolution_trend","pageviews_evolution","pageviews_evolution_trend","hits_evolution","hits_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,m["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}(),ft=new jt,gt={ref:"root"},St={class:"card-title"},kt=["innerHTML","title"],yt={id:"mt",class:"dataTable card-table",cellspacing:"0"},_t={class:"heading"},Ct={class:"heading"},Et={class:"heading"},Nt={class:"heading"},Vt={class:"heading"},wt=["colspan"],Tt=["value"],Bt={value:"visits_evolution"},Pt={value:"pageviews_evolution"},Mt={value:"hits_evolution"},Dt={key:0,value:"revenue_evolution"},xt={key:0},Lt={colspan:"7",class:"allWebsitesLoading"},Gt={key:1},Rt={key:0},At={colspan:"7"},It={class:"notification system notification-error"},zt=Object(o["createElementVNode"])("br",null,null,-1),Ft=Object(o["createElementVNode"])("br",null,null,-1),Ut=["href"],Ht=Object(o["createTextVNode"])(" – "),qt=["href"],Kt=["href"],Wt=Object(o["createTextVNode"])(". "),$t={colspan:"8",class:"paging"},Jt={class:"row"},Yt={class:"col s3 add_new_site"},Qt=["href"],Xt=Object(o["createElementVNode"])("span",{class:"icon-add"},null,-1),Zt={class:"col s6"},en={style:{cursor:"pointer"}},tn={class:"dataTablePages"},nn={id:"counter"},rn={style:{cursor:"pointer"},class:"pointer"},an=Object(o["createElementVNode"])("div",{class:"col s3"}," ",-1),on={row_id:"last"},sn={colspan:"8",class:"site_search"},ln={class:"row"},cn={class:"input-field col s12"},un=["placeholder"],dn=["title"];function bn(e,t,n,r,a,i){var s=this,l=Object(o["resolveComponent"])("EnrichedHeadline"),c=Object(o["resolveComponent"])("ActivityIndicator"),u=Object(o["resolveComponent"])("MultisitesSite");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",gt,[Object(o["createElementVNode"])("h2",St,[Object(o["createVNode"])(l,{"help-url":e.externalRawLink("https://matomo.org/faq/new-to-piwik/all-websites-dashboard/"),"feature-name":e.translate("General_AllWebsitesDashboard")},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_AllWebsitesDashboard"))+" ",1),Object(o["createElementVNode"])("span",{class:"smallTitle",innerHTML:e.$sanitize(s.smallTitleContent),title:e.smallTitleTooltip},null,8,kt)]})),_:1},8,["help-url","feature-name"])]),Object(o["createElementVNode"])("table",yt,[Object(o["createElementVNode"])("thead",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("th",{id:"names",class:Object(o["normalizeClass"])(["label",{columnSorted:"label"===e.sortColumn}]),onClick:t[0]||(t[0]=function(t){return e.sortBy("label")})},[Object(o["createElementVNode"])("span",_t,Object(o["toDisplayString"])(e.translate("General_Website")),1),Object(o["createElementVNode"])("span",{class:Object(o["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(o["createElementVNode"])("th",{id:"visits",class:Object(o["normalizeClass"])(["multisites-column",{columnSorted:"nb_visits"===e.sortColumn}]),onClick:t[1]||(t[1]=function(t){return e.sortBy("nb_visits")})},[Object(o["createElementVNode"])("span",{class:Object(o["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(o["createElementVNode"])("span",Ct,Object(o["toDisplayString"])(e.translate("General_ColumnNbVisits")),1)],2),Object(o["createElementVNode"])("th",{id:"pageviews",class:Object(o["normalizeClass"])(["multisites-column",{columnSorted:"nb_pageviews"===e.sortColumn}]),onClick:t[2]||(t[2]=function(t){return e.sortBy("nb_pageviews")})},[Object(o["createElementVNode"])("span",{class:Object(o["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(o["createElementVNode"])("span",Et,Object(o["toDisplayString"])(e.translate("General_ColumnPageviews")),1)],2),Object(o["createElementVNode"])("th",{id:"hits",class:Object(o["normalizeClass"])(["multisites-column",{columnSorted:"hits"===e.sortColumn}]),onClick:t[3]||(t[3]=function(t){return e.sortBy("hits")})},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&"hits"===e.sortColumn,multisites_desc:e.reverse&&"hits"===e.sortColumn}]),style:{"margin-right":"3.5px"}},null,2),Object(o["createElementVNode"])("span",Nt,Object(o["toDisplayString"])(e.translate("General_ColumnHits")),1)],2),e.displayRevenueColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("th",{key:0,id:"revenue",class:Object(o["normalizeClass"])(["multisites-column",{columnSorted:"revenue"===e.sortColumn}]),onClick:t[4]||(t[4]=function(t){return e.sortBy("revenue")})},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&"revenue"===e.sortColumn,multisites_desc:e.reverse&&"revenue"===e.sortColumn}]),style:{"margin-right":"3.5px"}},null,2),Object(o["createElementVNode"])("span",Vt,Object(o["toDisplayString"])(e.translate("General_ColumnRevenue")),1)],2)):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("th",{id:"evolution",class:Object(o["normalizeClass"])({columnSorted:e.evolutionSelector===e.sortColumn}),colspan:e.showSparklines?2:1},[Object(o["createElementVNode"])("span",{class:Object(o["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(o["createElementVNode"])("span",{class:"evolution",onClick:t[5]||(t[5]=function(t){return e.sortBy(e.evolutionSelector)}),style:{"margin-right":"3.5px"}},Object(o["toDisplayString"])(e.translate("MultiSites_Evolution")),1),Object(o["createElementVNode"])("select",{class:"selector browser-default",id:"evolution_selector",value:e.evolutionSelector,onChange:t[6]||(t[6]=function(t){e.evolutionSelector=t.target.value,e.sortBy(e.evolutionSelector)})},[Object(o["createElementVNode"])("option",Bt,Object(o["toDisplayString"])(e.translate("General_ColumnNbVisits")),1),Object(o["createElementVNode"])("option",Pt,Object(o["toDisplayString"])(e.translate("General_ColumnPageviews")),1),Object(o["createElementVNode"])("option",Mt,Object(o["toDisplayString"])(e.translate("General_ColumnHits")),1),e.displayRevenueColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("option",Dt,Object(o["toDisplayString"])(e.translate("General_ColumnRevenue")),1)):Object(o["createCommentVNode"])("",!0)],40,Tt)],10,wt)])]),e.isLoading?(Object(o["openBlock"])(),Object(o["createElementBlock"])("tbody",xt,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("td",Lt,[Object(o["createVNode"])(c,{"loading-message":e.loadingMessage,loading:e.isLoading},null,8,["loading-message","loading"])])])])):Object(o["createCommentVNode"])("",!0),e.isLoading?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("tbody",Gt,[e.errorLoadingSites?(Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",Rt,[Object(o["createElementVNode"])("td",At,[Object(o["createElementVNode"])("div",It,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_ErrorRequest","",""))+" ",1),zt,Ft,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_NeedMoreHelp"))+" ",1),Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://matomo.org/faq/troubleshooting/faq_19489/")},Object(o["toDisplayString"])(e.translate("General_Faq")),9,Ut),Ht,Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://forum.matomo.org/")},Object(o["toDisplayString"])(e.translate("Feedback_CommunityHelp")),9,qt),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",null," – ",512),[[o["vShow"],e.areAdsForProfessionalServicesEnabled]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.professionalHelpUrl},Object(o["toDisplayString"])(e.translate("Feedback_ProfessionalHelp")),9,Kt),[[o["vShow"],e.areAdsForProfessionalServicesEnabled]]),Wt])])])):Object(o["createCommentVNode"])("",!0),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.sites,(function(t){return Object(o["openBlock"])(),Object(o["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(o["createElementVNode"])("tfoot",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("td",$t,[Object(o["createElementVNode"])("div",Jt,[Object(o["createElementVNode"])("div",Yt,[e.hasSuperUserAccess?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:0,href:e.addSiteUrl},[Xt,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("SitesManager_AddSite")),1)],8,Qt)):Object(o["createCommentVNode"])("",!0)]),Object(o["createElementVNode"])("div",Zt,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{id:"prev",class:"previous dataTablePrevious",onClick:t[7]||(t[7]=function(t){return e.previousPage()})},[Object(o["createElementVNode"])("span",en,"« "+Object(o["toDisplayString"])(e.translate("General_Previous")),1)],512),[[o["vShow"],!(0===e.currentPage)]]),Object(o["createElementVNode"])("span",tn,[Object(o["createElementVNode"])("span",nn,Object(o["toDisplayString"])(e.translate("General_Pagination",e.paginationLowerBound,e.paginationUpperBound,e.numberOfFilteredSites)),1)]),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{id:"next",class:"next dataTableNext",onClick:t[8]||(t[8]=function(t){return e.nextPage()})},[Object(o["createElementVNode"])("span",rn,Object(o["toDisplayString"])(e.translate("General_Next"))+" »",1)],512),[[o["vShow"],!(e.currentPage>=e.numberOfPages)]])]),an])])]),Object(o["createElementVNode"])("tr",on,[Object(o["createElementVNode"])("td",sn,[Object(o["createElementVNode"])("div",ln,[Object(o["createElementVNode"])("div",cn,[Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"text",onKeydown:t[9]||(t[9]=Object(o["withKeys"])((function(t){return e.searchSite(e.searchTerm)}),["enter"])),"onUpdate:modelValue":t[10]||(t[10]=function(t){return e.searchTerm=t}),placeholder:e.translate("Actions_SubmenuSitesearch")},null,40,un),[[o["vModelText"],e.searchTerm]]),Object(o["createElementVNode"])("span",{class:"icon-search search_ico",onClick:t[11]||(t[11]=function(t){return e.searchSite(e.searchTerm)}),title:e.translate("General_ClickToSearch")},null,8,dn)])])])])])])],512)}var pn=Object(o["defineComponent"])({props:{displayRevenueColumn:Boolean,showSparklines:Boolean,dateSparkline:String,pageSize:Number,autoRefreshTodayReport:Number},components:{EnrichedHeadline:m["EnrichedHeadline"],ActivityIndicator:m["ActivityIndicator"],MultisitesSite:pt},data:function(){return{evolutionSelector:"visits_evolution",searchTerm:""}},created:function(){this.pageSize&&ft.setPageSize(this.pageSize),this.refresh(this.autoRefreshTodayReport)},methods:{refresh:function(e){ft.setRefreshInterval(e),ft.fetchAllSites()},sortBy:function(e){ft.sortBy(e)},previousPage:function(){ft.previousPage()},nextPage:function(){ft.nextPage()},searchSite:function(){ft.searchSite(this.searchTerm)}},computed:{hasSuperUserAccess:function(){return m["Matomo"].hasSuperUserAccess},date:function(){return m["MatomoUrl"].urlParsed.value.date},idSite:function(){return m["MatomoUrl"].urlParsed.value.idSite},url:function(){return m["Matomo"].piwik_url},period:function(){return m["Matomo"].period},areAdsForProfessionalServicesEnabled:function(){return m["Matomo"].config&&m["Matomo"].config.are_ads_enabled},sortColumn:function(){return ft.state.value.sortColumn},reverse:function(){return ft.state.value.reverse},smallTitleContent:function(){var e=ft.state.value;return Object(m["translate"])("General_TotalVisitsPageviewsActionsRevenue","".concat(e.totalVisits,""),"".concat(e.totalPageviews,""),"".concat(e.totalActions,""),"".concat(e.totalRevenue,""))},smallTitleTooltip:function(){var e=ft.state.value;return Object(m["translate"])("General_EvolutionSummaryGeneric",Object(m["translate"])("General_NVisits","".concat(e.totalVisits)),this.date,"".concat(e.lastVisits),e.lastVisitsDate,Object(m["calculateAndFormatEvolution"])(e.totalVisits,e.lastVisits))},loadingMessage:function(){return ft.state.value.loadingMessage},isLoading:function(){return ft.state.value.isLoading},errorLoadingSites:function(){return ft.state.value.errorLoadingSites},sites:function(){return ft.state.value.sites},numberOfPages:function(){return ft.numberOfPages.value},currentPage:function(){return ft.state.value.currentPage},paginationLowerBound:function(){return ft.paginationLowerBound.value},paginationUpperBound:function(){return ft.paginationUpperBound.value},numberOfFilteredSites:function(){return ft.numberOfFilteredSites.value},professionalHelpUrl:function(){return Object(m["externalRawLink"])("https://matomo.org/support-plans/")},addSiteUrl:function(){return"index.php?module=SitesManager&action=index&showaddsite=1&period=".concat(this.period,"&")+"date=".concat(this.date,"&idSite=").concat(this.idSite)}}});pn.render=bn;var mn=pn; + */var ft=function(){function e(){var t=this;pt(this,e),Ot(this,"privateState",Object(o["reactive"])({sites:[],isLoading:!1,pageSize:25,currentPage:0,totalVisits:"?",totalPageviews:"?",totalHits:"?",totalActions:"?",totalRevenue:"?",searchTerm:"",lastVisits:"?",lastVisitsDate:"?",numberOfSites:0,loadingMessage:Object(p["translate"])("MultiSites_LoadingWebsites"),reverse:!0,sortColumn:"nb_visits",refreshInterval:0,errorLoadingSites:!1})),Ot(this,"refreshTimeout",null),Ot(this,"fetchAbort",null),Ot(this,"state",Object(o["computed"])((function(){return Object(o["readonly"])(t.privateState)}))),Ot(this,"numberOfFilteredSites",Object(o["computed"])((function(){return t.state.value.numberOfSites}))),Ot(this,"numberOfPages",Object(o["computed"])((function(){return Math.ceil(t.numberOfFilteredSites.value/t.state.value.pageSize-1)}))),Ot(this,"currentPagingOffset",Object(o["computed"])((function(){return Math.ceil(t.state.value.currentPage*t.state.value.pageSize)}))),Ot(this,"paginationLowerBound",Object(o["computed"])((function(){return t.currentPagingOffset.value+1}))),Ot(this,"paginationUpperBound",Object(o["computed"])((function(){var e=t.currentPagingOffset.value+t.state.value.pageSize,n=t.numberOfFilteredSites.value;return e>n&&(e=n),e})))}return ht(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=p["NumberFormatter"].formatPercent(Math.round(100*parseInt(e.ratio,10))),r=null,a="0",o="0",i="0",s="0";if("nb_visits"!==t.state.value.sortColumn&&"visits_evolution"!==t.state.value.sortColumn||(a=p["NumberFormatter"].formatNumber(e.previous_nb_visits),o=p["NumberFormatter"].formatNumber(e.nb_visits),i=p["NumberFormatter"].formatPercent(e.visits_evolution),r=Object(p["translate"])("General_ColumnNbVisits"),s=p["NumberFormatter"].formatNumber(Math.round(parseInt(e.previous_nb_visits,10)*parseInt(e.ratio,10)))),"pageviews_evolution"===t.state.value.sortColumn&&(a="".concat(e.previous_nb_pageviews),o="".concat(e.nb_pageviews),i=p["NumberFormatter"].formatPercent(e.pageviews_evolution),r=Object(p["translate"])("General_ColumnPageviews"),s=p["NumberFormatter"].formatNumber(Math.round(parseInt(e.previous_nb_pageviews,10)*parseInt(e.ratio,10)))),"hits_evolution"===t.state.value.sortColumn&&(a="".concat(e.previous_hits),o="".concat(e.hits),i=p["NumberFormatter"].formatPercent(e.hits_evolution),r=Object(p["translate"])("General_ColumnHits"),s=p["NumberFormatter"].formatNumber(Math.round(parseInt(e.previous_hits,10)*parseInt(e.ratio,10)))),"revenue_evolution"===t.state.value.sortColumn&&(a=p["NumberFormatter"].formatCurrency(e.previous_revenue,e.currencySymbol),o=p["NumberFormatter"].formatCurrency(e.revenue,e.currencySymbol),i=p["NumberFormatter"].formatPercent(e.revenue_evolution),r=Object(p["translate"])("General_ColumnRevenue"),s=p["NumberFormatter"].formatCurrency(Math.round(parseInt(e.previous_revenue,10)*parseInt(e.ratio,10)),e.currencySymbol)),r)switch(e.tooltip="".concat(Object(p["translate"])("MultiSites_EvolutionComparisonIncomplete",[n]),"\n"),e.tooltip+="".concat(Object(p["translate"])("MultiSites_EvolutionComparisonProportional",[n,"".concat(s),r,"".concat(a)]),"\n"),e.periodName){case"day":e.tooltip+=Object(p["translate"])("MultiSites_EvolutionComparisonDay",["".concat(o),r,"".concat(s),e.previousRange,"".concat(i)]);break;case"week":e.tooltip+=Object(p["translate"])("MultiSites_EvolutionComparisonWeek",["".concat(o),r,"".concat(s),e.previousRange,"".concat(i)]);break;case"month":e.tooltip+=Object(p["translate"])("MultiSites_EvolutionComparisonMonth",["".concat(o),r,"".concat(s),e.previousRange,"".concat(i)]);break;case"year":e.tooltip+=Object(p["translate"])("MultiSites_EvolutionComparisonYear",["".concat(o),r,"".concat(s),e.previousRange,"".concat(i)]);break;default:break}}})),this.privateState.totalVisits=e.totals.nb_visits,this.privateState.totalPageviews=e.totals.nb_pageviews,this.privateState.totalHits=e.totals.hits,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","hits","visits_evolution","visits_evolution_trend","pageviews_evolution","pageviews_evolution_trend","hits_evolution","hits_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,p["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}(),jt=new ft,gt={ref:"root"},St={class:"card-title"},kt=["innerHTML","title"],yt={id:"mt",class:"dataTable card-table",cellspacing:"0"},_t={class:"heading"},Nt={class:"heading"},Ct={class:"heading"},Et={class:"heading"},Vt={class:"heading"},wt=["colspan"],Tt=["value"],Bt={value:"visits_evolution"},Pt={value:"pageviews_evolution"},Mt={value:"hits_evolution"},Dt={key:0,value:"revenue_evolution"},xt={key:0},Lt={colspan:"7",class:"allWebsitesLoading"},At={key:1},Rt={key:0},Gt={colspan:"7"},Ft={class:"notification system notification-error"},It=Object(o["createElementVNode"])("br",null,null,-1),zt=Object(o["createElementVNode"])("br",null,null,-1),Ut=["href"],Ht=Object(o["createTextVNode"])(" – "),qt=["href"],Kt=["href"],Wt=Object(o["createTextVNode"])(". "),$t={colspan:"8",class:"paging"},Jt={class:"row"},Yt={class:"col s3 add_new_site"},Qt=["href"],Xt=Object(o["createElementVNode"])("span",{class:"icon-add"},null,-1),Zt={class:"col s6"},en={style:{cursor:"pointer"}},tn={class:"dataTablePages"},nn={id:"counter"},rn={style:{cursor:"pointer"},class:"pointer"},an=Object(o["createElementVNode"])("div",{class:"col s3"}," ",-1),on={row_id:"last"},sn={colspan:"8",class:"site_search"},ln={class:"row"},cn={class:"input-field col s12"},un=["placeholder"],dn=["title"];function bn(e,t,n,r,a,i){var s=this,l=Object(o["resolveComponent"])("EnrichedHeadline"),c=Object(o["resolveComponent"])("ActivityIndicator"),u=Object(o["resolveComponent"])("MultisitesSite");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",gt,[Object(o["createElementVNode"])("h2",St,[Object(o["createVNode"])(l,{"help-url":e.externalRawLink("https://matomo.org/faq/new-to-piwik/all-websites-dashboard/"),"feature-name":e.translate("General_AllWebsitesDashboard")},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_AllWebsitesDashboard"))+" ",1),Object(o["createElementVNode"])("span",{class:"smallTitle",innerHTML:e.$sanitize(s.smallTitleContent),title:e.smallTitleTooltip},null,8,kt)]})),_:1},8,["help-url","feature-name"])]),Object(o["createElementVNode"])("table",yt,[Object(o["createElementVNode"])("thead",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("th",{id:"names",class:Object(o["normalizeClass"])(["label",{columnSorted:"label"===e.sortColumn}]),onClick:t[0]||(t[0]=function(t){return e.sortBy("label")})},[Object(o["createElementVNode"])("span",_t,Object(o["toDisplayString"])(e.translate("General_Website")),1),Object(o["createElementVNode"])("span",{class:Object(o["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(o["createElementVNode"])("th",{id:"visits",class:Object(o["normalizeClass"])(["multisites-column",{columnSorted:"nb_visits"===e.sortColumn}]),onClick:t[1]||(t[1]=function(t){return e.sortBy("nb_visits")})},[Object(o["createElementVNode"])("span",{class:Object(o["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(o["createElementVNode"])("span",Nt,Object(o["toDisplayString"])(e.translate("General_ColumnNbVisits")),1)],2),Object(o["createElementVNode"])("th",{id:"pageviews",class:Object(o["normalizeClass"])(["multisites-column",{columnSorted:"nb_pageviews"===e.sortColumn}]),onClick:t[2]||(t[2]=function(t){return e.sortBy("nb_pageviews")})},[Object(o["createElementVNode"])("span",{class:Object(o["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(o["createElementVNode"])("span",Ct,Object(o["toDisplayString"])(e.translate("General_ColumnPageviews")),1)],2),Object(o["createElementVNode"])("th",{id:"hits",class:Object(o["normalizeClass"])(["multisites-column",{columnSorted:"hits"===e.sortColumn}]),onClick:t[3]||(t[3]=function(t){return e.sortBy("hits")})},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&"hits"===e.sortColumn,multisites_desc:e.reverse&&"hits"===e.sortColumn}]),style:{"margin-right":"3.5px"}},null,2),Object(o["createElementVNode"])("span",Et,Object(o["toDisplayString"])(e.translate("General_ColumnHits")),1)],2),e.displayRevenueColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("th",{key:0,id:"revenue",class:Object(o["normalizeClass"])(["multisites-column",{columnSorted:"revenue"===e.sortColumn}]),onClick:t[4]||(t[4]=function(t){return e.sortBy("revenue")})},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])(["arrow",{multisites_asc:!e.reverse&&"revenue"===e.sortColumn,multisites_desc:e.reverse&&"revenue"===e.sortColumn}]),style:{"margin-right":"3.5px"}},null,2),Object(o["createElementVNode"])("span",Vt,Object(o["toDisplayString"])(e.translate("General_ColumnRevenue")),1)],2)):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("th",{id:"evolution",class:Object(o["normalizeClass"])({columnSorted:e.evolutionSelector===e.sortColumn}),colspan:e.showSparklines?2:1},[Object(o["createElementVNode"])("span",{class:Object(o["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(o["createElementVNode"])("span",{class:"evolution",onClick:t[5]||(t[5]=function(t){return e.sortBy(e.evolutionSelector)}),style:{"margin-right":"3.5px"}},Object(o["toDisplayString"])(e.translate("MultiSites_Evolution")),1),Object(o["createElementVNode"])("select",{class:"selector browser-default",id:"evolution_selector",value:e.evolutionSelector,onChange:t[6]||(t[6]=function(t){e.evolutionSelector=t.target.value,e.sortBy(e.evolutionSelector)})},[Object(o["createElementVNode"])("option",Bt,Object(o["toDisplayString"])(e.translate("General_ColumnNbVisits")),1),Object(o["createElementVNode"])("option",Pt,Object(o["toDisplayString"])(e.translate("General_ColumnPageviews")),1),Object(o["createElementVNode"])("option",Mt,Object(o["toDisplayString"])(e.translate("General_ColumnHits")),1),e.displayRevenueColumn?(Object(o["openBlock"])(),Object(o["createElementBlock"])("option",Dt,Object(o["toDisplayString"])(e.translate("General_ColumnRevenue")),1)):Object(o["createCommentVNode"])("",!0)],40,Tt)],10,wt)])]),e.isLoading?(Object(o["openBlock"])(),Object(o["createElementBlock"])("tbody",xt,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("td",Lt,[Object(o["createVNode"])(c,{"loading-message":e.loadingMessage,loading:e.isLoading},null,8,["loading-message","loading"])])])])):Object(o["createCommentVNode"])("",!0),e.isLoading?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("tbody",At,[e.errorLoadingSites?(Object(o["openBlock"])(),Object(o["createElementBlock"])("tr",Rt,[Object(o["createElementVNode"])("td",Gt,[Object(o["createElementVNode"])("div",Ft,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_ErrorRequest","",""))+" ",1),It,zt,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_NeedMoreHelp"))+" ",1),Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://matomo.org/faq/troubleshooting/faq_19489/")},Object(o["toDisplayString"])(e.translate("General_Faq")),9,Ut),Ht,Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://forum.matomo.org/")},Object(o["toDisplayString"])(e.translate("Feedback_CommunityHelp")),9,qt),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",null," – ",512),[[o["vShow"],e.areAdsForProfessionalServicesEnabled]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("a",{rel:"noreferrer noopener",target:"_blank",href:e.professionalHelpUrl},Object(o["toDisplayString"])(e.translate("Feedback_ProfessionalHelp")),9,Kt),[[o["vShow"],e.areAdsForProfessionalServicesEnabled]]),Wt])])])):Object(o["createCommentVNode"])("",!0),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.sites,(function(t){return Object(o["openBlock"])(),Object(o["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(o["createElementVNode"])("tfoot",null,[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("td",$t,[Object(o["createElementVNode"])("div",Jt,[Object(o["createElementVNode"])("div",Yt,[e.hasSuperUserAccess?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:0,href:e.addSiteUrl},[Xt,Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("SitesManager_AddSite")),1)],8,Qt)):Object(o["createCommentVNode"])("",!0)]),Object(o["createElementVNode"])("div",Zt,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{id:"prev",class:"previous dataTablePrevious",onClick:t[7]||(t[7]=function(t){return e.previousPage()})},[Object(o["createElementVNode"])("span",en,"« "+Object(o["toDisplayString"])(e.translate("General_Previous")),1)],512),[[o["vShow"],!(0===e.currentPage)]]),Object(o["createElementVNode"])("span",tn,[Object(o["createElementVNode"])("span",nn,Object(o["toDisplayString"])(e.translate("General_Pagination",e.paginationLowerBound,e.paginationUpperBound,e.numberOfFilteredSites)),1)]),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{id:"next",class:"next dataTableNext",onClick:t[8]||(t[8]=function(t){return e.nextPage()})},[Object(o["createElementVNode"])("span",rn,Object(o["toDisplayString"])(e.translate("General_Next"))+" »",1)],512),[[o["vShow"],!(e.currentPage>=e.numberOfPages)]])]),an])])]),Object(o["createElementVNode"])("tr",on,[Object(o["createElementVNode"])("td",sn,[Object(o["createElementVNode"])("div",ln,[Object(o["createElementVNode"])("div",cn,[Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"text",onKeydown:t[9]||(t[9]=Object(o["withKeys"])((function(t){return e.searchSite(e.searchTerm)}),["enter"])),"onUpdate:modelValue":t[10]||(t[10]=function(t){return e.searchTerm=t}),placeholder:e.translate("Actions_SubmenuSitesearch")},null,40,un),[[o["vModelText"],e.searchTerm]]),Object(o["createElementVNode"])("span",{class:"icon-search search_ico",onClick:t[11]||(t[11]=function(t){return e.searchSite(e.searchTerm)}),title:e.translate("General_ClickToSearch")},null,8,dn)])])])])])])],512)}var mn=Object(o["defineComponent"])({props:{displayRevenueColumn:Boolean,showSparklines:Boolean,dateSparkline:String,pageSize:Number,autoRefreshTodayReport:Number},components:{EnrichedHeadline:p["EnrichedHeadline"],ActivityIndicator:p["ActivityIndicator"],MultisitesSite:mt},data:function(){return{evolutionSelector:"visits_evolution",searchTerm:""}},created:function(){this.pageSize&&jt.setPageSize(this.pageSize),this.refresh(this.autoRefreshTodayReport)},methods:{refresh:function(e){jt.setRefreshInterval(e),jt.fetchAllSites()},sortBy:function(e){jt.sortBy(e)},previousPage:function(){jt.previousPage()},nextPage:function(){jt.nextPage()},searchSite:function(){jt.searchSite(this.searchTerm)}},computed:{hasSuperUserAccess:function(){return p["Matomo"].hasSuperUserAccess},date:function(){return p["MatomoUrl"].urlParsed.value.date},idSite:function(){return p["MatomoUrl"].urlParsed.value.idSite},url:function(){return p["Matomo"].piwik_url},period:function(){return p["Matomo"].period},areAdsForProfessionalServicesEnabled:function(){return p["Matomo"].config&&p["Matomo"].config.are_ads_enabled},sortColumn:function(){return jt.state.value.sortColumn},reverse:function(){return jt.state.value.reverse},smallTitleContent:function(){var e=jt.state.value;return Object(p["translate"])("General_TotalVisitsPageviewsActionsRevenue","".concat(e.totalVisits,""),"".concat(e.totalPageviews,""),"".concat(e.totalActions,""),"".concat(e.totalRevenue,""))},smallTitleTooltip:function(){var e=jt.state.value;return Object(p["translate"])("General_EvolutionSummaryGeneric",Object(p["translate"])("General_NVisits","".concat(e.totalVisits)),this.date,"".concat(e.lastVisits),e.lastVisitsDate,Object(p["calculateAndFormatEvolution"])(e.totalVisits,e.lastVisits))},loadingMessage:function(){return jt.state.value.loadingMessage},isLoading:function(){return jt.state.value.isLoading},errorLoadingSites:function(){return jt.state.value.errorLoadingSites},sites:function(){return jt.state.value.sites},numberOfPages:function(){return jt.numberOfPages.value},currentPage:function(){return jt.state.value.currentPage},paginationLowerBound:function(){return jt.paginationLowerBound.value},paginationUpperBound:function(){return jt.paginationUpperBound.value},numberOfFilteredSites:function(){return jt.numberOfFilteredSites.value},professionalHelpUrl:function(){return Object(p["externalRawLink"])("https://matomo.org/support-plans/")},addSiteUrl:function(){return"index.php?module=SitesManager&action=index&showaddsite=1&period=".concat(this.period,"&")+"date=".concat(this.date,"&idSite=").concat(this.idSite)}}});mn.render=bn;var pn=mn; /*! * Matomo - free/libre analytics platform * diff --git a/plugins/MultiSites/vue/src/AllWebsitesDashboard/AllWebsitesDashboard.store.ts b/plugins/MultiSites/vue/src/AllWebsitesDashboard/AllWebsitesDashboard.store.ts index 2ea7dcd935b4..94e8af371baf 100644 --- a/plugins/MultiSites/vue/src/AllWebsitesDashboard/AllWebsitesDashboard.store.ts +++ b/plugins/MultiSites/vue/src/AllWebsitesDashboard/AllWebsitesDashboard.store.ts @@ -6,7 +6,12 @@ */ import { computed, reactive, readonly } from 'vue'; -import { AjaxHelper, Matomo, Periods } from 'CoreHome'; +import { + AjaxHelper, + Matomo, + Periods, + NumberFormatter, +} from 'CoreHome'; import { DashboardMetrics, @@ -39,16 +44,14 @@ interface DashboardStoreState { isLoadingSites: boolean; numSites: number; paginationCurrentPage: number; - sparklineDate: string; sortColumn: string; sortOrder: DashboardSortOrder; } -interface GetDashboardMockDataResponse { +interface GetAllWithGroupsDataResponse { sites: DashboardSiteData[]; totals: DashboardMetrics; numSites: number; - sparklineDate: string; } const DEFAULT_SORT_ORDER = 'desc'; @@ -79,7 +82,6 @@ class DashboardStore { isLoadingSites: false, numSites: 0, paginationCurrentPage: 0, - sparklineDate: '', sortColumn: DEFAULT_SORT_COLUMN, sortOrder: DEFAULT_SORT_ORDER, }); @@ -204,11 +206,12 @@ class DashboardStore { this.privateState.isLoadingSites = true; const params: QueryParameters = { - method: 'MultiSites.mockDashboardData', + method: 'MultiSites.getAllWithGroups', filter_limit: this.pageSize, filter_offset: this.currentPagingOffset.value, filter_sort_column: this.privateState.sortColumn, filter_sort_order: this.privateState.sortOrder, + format_metrics: 0, showColumns: [ 'hits_evolution', 'hits_evolution_trend', @@ -230,7 +233,7 @@ class DashboardStore { params.pattern = this.searchTerm; } - return AjaxHelper.fetch( + return AjaxHelper.fetch( params, { abortController: this.fetchAbort }, ).then((response) => { @@ -279,28 +282,51 @@ class DashboardStore { }, this.autoRefreshInterval * 1000); } - private updateDashboardKPIs(response: GetDashboardMockDataResponse) { + private updateDashboardKPIs(response: GetAllWithGroupsDataResponse) { this.privateState.dashboardKPIs = { evolutionPeriod: Matomo.period as string, - hits: response.totals.hits, - hitsEvolution: response.totals.hits_evolution, - hitsTrend: response.totals.hits_evolution_trend, - pageviews: response.totals.nb_pageviews, - pageviewsEvolution: response.totals.pageviews_evolution, - pageviewsTrend: response.totals.pageviews_evolution_trend, - revenue: response.totals.revenue, - revenueEvolution: response.totals.revenue_evolution, - revenueTrend: response.totals.revenue_evolution_trend, - visits: response.totals.nb_visits, - visitsEvolution: response.totals.visits_evolution, - visitsTrend: response.totals.visits_evolution_trend, + hits: NumberFormatter.formatNumber(response.totals.hits), + hitsEvolution: NumberFormatter.calculateAndFormatEvolution( + response.totals.hits, + response.totals.previous_hits, + true, + ), + hitsTrend: Math.sign( + response.totals.hits - response.totals.previous_hits, + ) as EvolutionTrend, + pageviews: NumberFormatter.formatNumber(response.totals.nb_pageviews), + pageviewsEvolution: NumberFormatter.calculateAndFormatEvolution( + response.totals.nb_pageviews, + response.totals.previous_nb_pageviews, + true, + ), + pageviewsTrend: Math.sign( + response.totals.nb_pageviews - response.totals.previous_nb_pageviews, + ) as EvolutionTrend, + revenue: NumberFormatter.formatCurrency(response.totals.revenue, ''), + revenueEvolution: NumberFormatter.calculateAndFormatEvolution( + response.totals.revenue, + response.totals.previous_revenue, + true, + ), + revenueTrend: Math.sign( + response.totals.revenue - response.totals.previous_revenue, + ) as EvolutionTrend, + visits: NumberFormatter.formatNumber(response.totals.nb_visits), + visitsEvolution: NumberFormatter.calculateAndFormatEvolution( + response.totals.nb_visits, + response.totals.previous_nb_visits, + true, + ), + visitsTrend: Math.sign( + response.totals.nb_visits - response.totals.previous_nb_visits, + ) as EvolutionTrend, }; } - private updateDashboardSites(response: GetDashboardMockDataResponse) { + private updateDashboardSites(response: GetAllWithGroupsDataResponse) { this.privateState.dashboardSites = response.sites; this.privateState.numSites = response.numSites; - this.privateState.sparklineDate = response.sparklineDate; } } diff --git a/plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue b/plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue index 98faa3554927..54fbaa64afda 100644 --- a/plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue +++ b/plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTable.vue @@ -131,7 +131,7 @@ :evolution-metric="evolutionMetric" :key="`site-${site.idsite}`" :model-value="site" - :sparkline-date="sparklineDate" + :display-sparkline="displaySparklines" :sparkline-metric="sparklineMetric" /> @@ -257,9 +257,6 @@ export default defineComponent({ return ''; } }, - sparklineDate(): string|null { - return this.displaySparklines ? DashboardStore.state.value.sparklineDate : null; - }, }, methods: { changeEvolutionSelector(metric: string) { diff --git a/plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue b/plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue index 0a808b513d3f..c44d9fabbc4d 100644 --- a/plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue +++ b/plugins/MultiSites/vue/src/AllWebsitesDashboard/SitesTableSite.vue @@ -33,15 +33,20 @@ - {{ site.nb_visits }} - {{ site.nb_pageviews }} - {{ site.hits }} - {{ site.revenue }} + {{ formatNumber(site.nb_visits) }} + {{ formatNumber(site.nb_pageviews) }} + {{ formatNumber(site.hits) }} + + {{ formatCurrency(site.revenue, site.currencySymbol) }} + @@ -67,7 +72,12 @@