Files
newwalls.pl/modules/ps_metrics/views/js/dashboardActivityVisit.js
2024-12-17 13:43:22 +01:00

1 line
17 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["dashboardActivityVisit"],{"09c6":function(t,e,n){"use strict";var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"tw-border-2 tw-border-dashed tw-border-gray-500 tw-bg-gray-100 tw-p-8"},[t._m(0),n("div",{staticClass:"tw-text-base tw-text-center tw-pb-6"},[t._v(" "+t._s(t.$t("needGAPanel.textContent"))+" ")]),n("div",{staticClass:"tw-text-center"},[n("b-button",{attrs:{variant:"primary"},on:{click:function(e){return t.goToSettings()}}},[t._v(t._s(t.$t("needGAPanel.configure")))])],1)])},i=[function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"tw-pb-4"},[a("img",{staticClass:"tw-w-24 tw-m-auto",attrs:{src:n("9943"),alt:"need_google_analytics"}})])}],s={name:"NeedGAPanel",methods:{goToSettings:function(){window.location.href=this.$store.getters.getConfigurationLink}}},r=s,o=n("2877"),u=Object(o["a"])(r,a,i,!1,null,null,null);e["a"]=u.exports},"0d66":function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[this.$store.getters.gaIsOnboarded?n("b-container",{staticClass:"tw-px-0",on:{scroll:t.onScroll}},[n("b-button-group",{staticClass:"tw-mb-8",attrs:{size:"sm"}},t._l(t.granularityButtons,(function(e){return n("b-button",{key:e.id,attrs:{id:e.id,variant:e.id==t.pressedButtonId?"primary":"outline-secondary",disabled:e.disabled},on:{click:function(n){return n.preventDefault(),t.activateButton(e)}}},[t._v(t._s(e.label[0].toUpperCase()+e.label.slice(1)))])})),1),n("b-container",{staticClass:"tw-px-0"},[n("LineChartWithLoader",{attrs:{"choice-tab":t.title,"data-sets":t.dataSets,loading:this.$store.state.dashboard.state.loadingVisitsByPeriodicity,granularity:t.granularity,"short-cut-date":this.$store.getters.buttonDate}})],1),n("b-container",{staticClass:"tw-px-0 tw-flex tw-flex-wrap"},[n("PieChartWithLoader",{key:t.title,attrs:{data:this.$store.state.dashboard.state.dataVisitsByCategory,loading:this.$store.state.dashboard.state.loadingVisitsByCategory,labels:this.$store.state.dashboard.state.labelsVisitsByCategory,title:t.$t("tabsBody.visits.trafficPerChannel"),"legend-callback":function(){},"use-inline-label":"","choice-tab":t.title}}),n("b-col",{staticClass:"tw-flex-wrap tw-w-1/4"},[n("div",{staticClass:"kpi-title tw-flex tw-py-4"},[t._v(" "+t._s(t.$t("tabsBody.visits.visitAnalysis"))+" "),n("ToolTip",{attrs:{target:"popover-revenue-analysis",triggers:"click hover",placement:"top","style-button":"margin-left: 10px;"}})],1),n("div",{staticClass:"tw-my-8"},[this.$store.state.dashboard.state.loadingVisitsByCategory?t._e():n("BasicKpi",{key:t.bounceRate,attrs:{label:t.$t("tabsBody.visits.bounceRate"),value:t.bounceRate,type:"percent"}}),this.$store.state.dashboard.state.loadingVisitsByCategory?t._e():n("BasicKpi",{key:t.averageSessionDuration,attrs:{label:t.$t("tabsBody.visits.averageSessionDuration"),value:t.averageSessionDuration,type:"text"}})],1)])],1)],1):n("NeedGAPanel")],1)},i=[],s=n("5530"),r=(n("7db0"),n("159b"),n("d81d"),n("99af"),n("cebc")),o=n("896f"),u=n("0812"),l=n("09c6"),d=n("c1df"),c=n("1279"),h=n("12d5"),f=n("4c62"),p={name:"Visits",components:{PieChartWithLoader:o["a"],NeedGAPanel:l["a"],LineChartWithLoader:u["a"],BasicKpi:c["a"],ToolTip:h["a"]},props:{title:{type:String,default:"sessions"}},data:function(){return{buttons:[{id:1,pressed:!0,label:this.$t("tabsBody.dates.hour"),slug:"hours",variantButton:"primary",disabled:!1},{id:2,pressed:!0,label:this.$t("tabsBody.dates.day"),slug:"days",variantButton:"primary",disabled:!1},{id:3,pressed:!1,label:this.$t("tabsBody.dates.week"),slug:"weeks",variantButton:"outline-secondary",disabled:!1},{id:4,pressed:!1,label:this.$t("tabsBody.dates.month"),slug:"months",variantButton:"outline-secondary",disabled:!1}],granularity:"days",pressedButtonId:1,unwatchButtonDate:"",dateRange:null,settingsStorage:new f["a"]("dashboard_settings")}},created:function(){var t=this;if(this.settingsStorage.getItem("chart_granularity")){var e=this.settingsStorage.getItem("chart_granularity"),n=this.buttons.find((function(t){return t.slug===e}));this.activateButton(n)}else this.activateButton(this.granularityButtons[0]);this.setTabSelected("sessions"),this.unwatchButtonDate=this.$store.watch((function(t,e){return{buttonDate:e.buttonDate,dateRange:e.dateRange,compareMode:e.getCompareMode}}),(function(e){t.dateRange=Object(s["a"])({},e.dateRange),t.detectButtonDisable(e.buttonDate,e.dateRange),t.getVisits({date:e.dateRange,granularity:t.granularity})}),{immediate:!0})},beforeDestroy:function(){this.unwatchButtonDate()},watch:{dateRange:function(){var t=this,e=this.granularityButtons.find((function(e){return e.id===t.pressedButtonId}));!e&&this.granularityButtons.length&&this.activateButton(this.granularityButtons[0])}},methods:Object(s["a"])(Object(s["a"])({},Object(r["c"])({getVisits:"getVisits",setTabSelected:"setTabSelected"})),{},{activateButton:function(t){this.granularity=t.slug,this.settingsStorage.set("chart_granularity",t.slug),this.pressedButtonId=t.id,this.deactivateButtons(),t.pressed=!0,t.variantButton="primary",this.getVisits({date:this.$store.getters.dateRange,granularity:this.granularity}),this.$segment.track("Change Granularity",{title:t.label,module:"ps_metrics"})},deactivateButtons:function(){this.buttons.forEach((function(t){t.pressed=!1,t.variantButton="outline-secondary"}))},onScroll:function(t){var e=t.target,n=e.scrollTop,a=e.clientHeight,i=e.scrollHeight;n+a>=i&&this.$segment.track("scroll visits",{title:this.title,module:"ps_metrics"})},detectButtonDisable:function(t,e){switch(t){case"today":case"yesterday":this.buttons[0].disabled=!1,this.buttons[1].disabled=!0,this.buttons[2].disabled=!0,this.buttons[3].disabled=!0,this.deactivateButtons(),this.buttons[0].pressed=!0,this.buttons[0].variantButton="primary";break;case"7days":this.buttons[0].disabled=!0,this.buttons[1].disabled=!1,this.buttons[2].disabled=!0,this.buttons[3].disabled=!0,this.deactivateButtons(),this.buttons[1].pressed=!0,this.buttons[1].variantButton="primary";break;case"30days":this.buttons[0].disabled=!0,this.buttons[1].disabled=!1,this.buttons[2].disabled=!1,this.buttons[3].disabled=!0,this.deactivateButtons(),this.buttons[2].pressed=!0,this.buttons[2].variantButton="primary";break;case"custom":var n=Math.abs(d(e.start).diff(d(e.end),"days"))+1;n<2?(this.buttons[1].disabled=!0,this.buttons[2].disabled=!0,this.buttons[3].disabled=!0,this.deactivateButtons(),this.buttons[0].pressed=!0,this.buttons[0].variantButton="primary"):n<=7?(this.buttons[0].disabled=!0,this.buttons[1].disabled=!1,this.buttons[2].disabled=!0,this.buttons[3].disabled=!0,this.deactivateButtons(),this.buttons[1].pressed=!0,this.buttons[1].variantButton="primary"):n>7&&n<30?(this.buttons[0].disabled=!1,this.buttons[2].disabled=!1,this.buttons[3].disabled=!0,this.deactivateButtons(),this.buttons[1].pressed=!0,this.buttons[1].variantButton="primary"):(this.buttons.map((function(t){t.disabled=!1})),this.deactivateButtons(),this.buttons[1].pressed=!0,this.buttons[1].variantButton="primary");break;default:this.buttons.map((function(t){t.disabled=!1})),this.deactivateButtons(),this.buttons[1].pressed=!0,this.buttons[1].variantButton="primary";break}},formatSessionDuration:function(t){var e=t.seconds()<9?"0".concat(t.seconds()):t.seconds();return"".concat(t.minutes(),'"').concat(e)}}),computed:{granularityButtons:function(){var t,e=this,n=[{min:0,max:1,buttonIds:[0]},{min:2,max:7,buttonIds:[1]},{min:8,max:25,buttonIds:[1,2]},{min:26,max:59,buttonIds:[1,2]},{min:60,max:89,buttonIds:[1,2,3]},{min:90,max:1/0,buttonIds:[2,3]}];if(!this.dateRange)return[n[0]];for(var a=d(this.dateRange.start),i=d(this.dateRange.end),s=i.diff(a,"days"),r=n.length-1;!t&&r>=0;r--)s>=n[r].min&&s<=n[r].max&&(t=n[r].buttonIds.map((function(t){return e.buttons[t]})));return t||[]},dataSets:function(){return this.$store.getters.getVisitsDataSets},averageSessionDuration:function(){var t=this.$store.state.dashboard.state.totalAverageSessionDuration;return this.formatSessionDuration(d["duration"](t,"seconds"))},bounceRate:function(){return Math.round(this.$store.state.dashboard.state.totalBounceRate)}}},b=p,v=(n("be7c"),n("2877")),g=Object(v["a"])(b,a,i,!1,null,"e5267d9a",null);e["default"]=g.exports},1279:function(t,e,n){"use strict";var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("b-container",{staticClass:"tw-mb-8 tw-p-0"},[n("b-col",{staticClass:"tw-p-0",attrs:{cols:""}},[n("div",{staticClass:"title tw-flex"},[t._v(" "+t._s(t.label)+" "),t.tooltip?n("ToolTip",{attrs:{target:t.tooltip_target,triggers:"click hover",placement:"top",content:t.tooltip,"style-button":"margin-left: 10px;"}}):t._e()],1)]),n("div",{staticClass:"value"},["percent"==t.type||t.percent?n("AnimatedNumber",{attrs:{percent:!0,value:t.value}}):"currency"==t.type||t.currency?n("AnimatedNumber",{attrs:{currency:!0,value:t.value}}):"text"==t.type?n("span",[t._v(t._s(t.value))]):t._e()],1)],1)},i=[],s=(n("a9e3"),function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.currency?n("span",[t._v(t._s(t.$n(t.animatedNumber,"currency")))]):n("span",[t._v(t._s(t.animatedNumber)+" "),t.percent?[t._v("%")]:t._e()],2)}),r=[],o=(n("b680"),n("3911")),u=n.n(o),l={props:{value:{type:Number,default:0},duration:{type:Number,default:500},currency:{type:Boolean,default:!1},percent:{type:Boolean,default:!1}},data:function(){return{animatedNumber:0}},methods:{initAnimation:function(t,e){var n=this;function a(){u.a.update()&&requestAnimationFrame(a)}new u.a.Tween({tweeningNumber:e}).easing(u.a.Easing.Quadratic.Out).to({tweeningNumber:t},this.duration).onUpdate((function(){n.animatedNumber=this.tweeningNumber.toFixed(0)})).start(),a()}},mounted:function(){this.initAnimation(this.value,0)},watch:{number:function(t,e){this.initAnimation(t,e)}}},d=l,c=n("2877"),h=Object(c["a"])(d,s,r,!1,null,null,null),f=h.exports,p=n("12d5"),b={components:{ToolTip:p["a"],AnimatedNumber:f},props:{label:{type:String,required:!0},tooltip:{type:String,required:!1,default:null},value:{type:[String,Number],required:!0},currency:{type:Boolean,required:!1,default:!1},percent:{type:Boolean,required:!1,default:!1},type:{type:String,default:"number"}},computed:{tooltip_target:function(){return"popover-kpi-".concat(this._uid)}}},v=b,g=(n("2164"),Object(c["a"])(v,a,i,!1,null,"5e5ff4d1",null));e["a"]=g.exports},2057:function(t,e,n){var a=n("24fb");e=a(!1),e.push([t.i,".title[data-v-5e5ff4d1]{font-size:10px;line-height:14px}.title[data-v-5e5ff4d1],.value[data-v-5e5ff4d1]{color:#363a41!important;font-family:Open Sans;letter-spacing:0}.value[data-v-5e5ff4d1]{font-size:24px;font-weight:700;line-height:33px}@media (max-width:1400px){.title[data-v-5e5ff4d1]{font-size:10px!important;line-height:14px}.title[data-v-5e5ff4d1],.value[data-v-5e5ff4d1]{color:#363a41!important;font-family:Open Sans;letter-spacing:0}.value[data-v-5e5ff4d1]{font-size:1em;font-weight:700;line-height:33px}}@media (max-width:1024px){.title[data-v-5e5ff4d1]{font-size:7px!important;line-height:14px}.title[data-v-5e5ff4d1],.value[data-v-5e5ff4d1]{color:#363a41!important;font-family:Open Sans;letter-spacing:0}.value[data-v-5e5ff4d1]{font-size:1em;font-weight:700;line-height:33px}}",""]),t.exports=e},2164:function(t,e,n){"use strict";n("2d16")},"2c75":function(t,e,n){var a=n("24fb");e=a(!1),e.push([t.i,".kpi-title[data-v-e5267d9a]{color:#363a41;font-family:Open Sans;font-size:16px;font-weight:700;letter-spacing:-.17px;line-height:22px;margin:12px 0}",""]),t.exports=e},"2d16":function(t,e,n){var a=n("2057");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[t.i,a,""]]),a.locals&&(t.exports=a.locals);var i=n("499e").default;i("7be1a5a5",a,!0,{sourceMap:!1,shadowMode:!1})},3911:function(t,e,n){(function(n){var a,i,s=s||function(){var t=[];return{getAll:function(){return t},removeAll:function(){t=[]},add:function(e){t.push(e)},remove:function(e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)},update:function(e,n){if(0===t.length)return!1;var a=0;e=void 0!==e?e:s.now();while(a<t.length)t[a].update(e)||n?a++:t.splice(a,1);return!0}}}();"undefined"===typeof window&&"undefined"!==typeof n?s.now=function(){var t=n.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!==typeof window&&void 0!==window.performance&&void 0!==window.performance.now?s.now=window.performance.now.bind(window.performance):void 0!==Date.now?s.now=Date.now:s.now=function(){return(new Date).getTime()},s.Tween=function(t){var e,n=t,a={},i={},r={},o=1e3,u=0,l=!1,d=!1,c=!1,h=0,f=null,p=s.Easing.Linear.None,b=s.Interpolation.Linear,v=[],g=null,m=!1,y=null,w=null,B=null;this.to=function(t,e){return i=t,void 0!==e&&(o=e),this},this.start=function(t){for(var e in s.add(this),d=!0,m=!1,f=void 0!==t?t:s.now(),f+=h,i){if(i[e]instanceof Array){if(0===i[e].length)continue;i[e]=[n[e]].concat(i[e])}void 0!==n[e]&&(a[e]=n[e],a[e]instanceof Array===!1&&(a[e]*=1),r[e]=a[e]||0)}return this},this.stop=function(){return d?(s.remove(this),d=!1,null!==B&&B.call(n,n),this.stopChainedTweens(),this):this},this.end=function(){return this.update(f+o),this},this.stopChainedTweens=function(){for(var t=0,e=v.length;t<e;t++)v[t].stop()},this.delay=function(t){return h=t,this},this.repeat=function(t){return u=t,this},this.repeatDelay=function(t){return e=t,this},this.yoyo=function(t){return l=t,this},this.easing=function(t){return p=t,this},this.interpolation=function(t){return b=t,this},this.chain=function(){return v=arguments,this},this.onStart=function(t){return g=t,this},this.onUpdate=function(t){return y=t,this},this.onComplete=function(t){return w=t,this},this.onStop=function(t){return B=t,this},this.update=function(t){var s,d,B;if(t<f)return!0;for(s in!1===m&&(null!==g&&g.call(n,n),m=!0),d=(t-f)/o,d=d>1?1:d,B=p(d),i)if(void 0!==a[s]){var x=a[s]||0,_=i[s];_ instanceof Array?n[s]=b(_,B):("string"===typeof _&&(_="+"===_.charAt(0)||"-"===_.charAt(0)?x+parseFloat(_):parseFloat(_)),"number"===typeof _&&(n[s]=x+(_-x)*B))}if(null!==y&&y.call(n,B),1===d){if(u>0){for(s in isFinite(u)&&u--,r){if("string"===typeof i[s]&&(r[s]=r[s]+parseFloat(i[s])),l){var I=r[s];r[s]=i[s],i[s]=I}a[s]=r[s]}return l&&(c=!c),f=void 0!==e?t+e:t+h,!0}null!==w&&w.call(n,n);for(var M=0,C=v.length;M<C;M++)v[M].start(f+o);return!1}return!0}},s.Easing={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1)}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-s.Easing.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*s.Easing.Bounce.In(2*t):.5*s.Easing.Bounce.Out(2*t-1)+.5}}},s.Interpolation={Linear:function(t,e){var n=t.length-1,a=n*e,i=Math.floor(a),r=s.Interpolation.Utils.Linear;return e<0?r(t[0],t[1],a):e>1?r(t[n],t[n-1],n-a):r(t[i],t[i+1>n?n:i+1],a-i)},Bezier:function(t,e){for(var n=0,a=t.length-1,i=Math.pow,r=s.Interpolation.Utils.Bernstein,o=0;o<=a;o++)n+=i(1-e,a-o)*i(e,o)*t[o]*r(a,o);return n},CatmullRom:function(t,e){var n=t.length-1,a=n*e,i=Math.floor(a),r=s.Interpolation.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(a=n*(1+e))),r(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],a-i)):e<0?t[0]-(r(t[0],t[0],t[1],t[1],-a)-t[0]):e>1?t[n]-(r(t[n],t[n],t[n-1],t[n-1],a-n)-t[n]):r(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],a-i)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=s.Interpolation.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:function(){var t=[1];return function(e){var n=1;if(t[e])return t[e];for(var a=e;a>1;a--)n*=a;return t[e]=n,n}}(),CatmullRom:function(t,e,n,a,i){var s=.5*(n-t),r=.5*(a-e),o=i*i,u=i*o;return(2*e-2*n+s+r)*u+(-3*e+3*n-2*s-r)*o+s*i+e}}},function(n){a=[],i=function(){return s}.apply(e,a),void 0===i||(t.exports=i)}()}).call(this,n("4362"))},a28f:function(t,e,n){var a=n("2c75");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[t.i,a,""]]),a.locals&&(t.exports=a.locals);var i=n("499e").default;i("7c55577e",a,!0,{sourceMap:!1,shadowMode:!1})},be7c:function(t,e,n){"use strict";n("a28f")}}]);