OwlCyberSecurity - MANAGER
Edit File: PostsTable.CWnBDerD.js
import{D as w,f as v,g as I,e as O,a as j}from"./links.BdfvOpfI.js";import{l as R}from"./license.D7gbNQw6.js";import{n as P}from"./numbers.zAmItkHM.js";import{W as A}from"./WpTable.BrShZDYO.js";import{_ as U}from"./ScoreButton.CYslBSvp.js";import{C as D}from"./Table._qU3COyQ.js";import{C as B}from"./Index.XNbBlAFo.js";import{q as L,S as N,T as E,c as V}from"./LicenseConditions.Cyu_smqP.js";import{x as d,o as l,c as h,C as u,t as a,d as g,m as r,a as p,G as H,D as f,l as b}from"./vue.esm-bundler.CWQFYt9y.js";import{_ as y}from"./_plugin-vue_export-helper.BN1snXvA.js";import{I as M}from"./IndexStatus.BXxQ8ydO.js";import{P as W}from"./PostTypes.Cef6XkQ_.js";const q={components:{apexchart:L},props:{points:{type:Object,required:!0},peak:{type:Number,default(){return 0}},recovering:{type:Boolean,default(){return!1}},height:{type:Number,default(){return 50}}},data(){return{strings:{recovering:this.$t.__("Slowly Recovering",this.$td),peak:this.$t.__("Peak",this.$td)}}},computed:{getSeries(){const e=this.points,o=[];return Object.keys(e).forEach(i=>{o.push({x:i,y:e[i]})}),[{data:o}]},chartOptions(){const e=this.peak;return{colors:[function({value:o}){return o===e?"#005AE0":"#99C2FF"}],chart:{type:"bar",sparkline:{enabled:!0},zoom:{enabled:!1},toolbar:{show:!1},parentHeightOffset:0,background:"#fff"},grid:{show:!1,padding:{top:2,right:2,bottom:0,left:2}},plotOptions:{bar:{columnWidth:"85%",barHeight:"100%"}},fill:{type:"solid"},tooltip:{enabled:!0,x:{show:!0,formatter:o=>w.fromFormat(o,"yyyy-MM").setZone(w.zone).toLocaleString({month:"long",year:"numeric"})},y:{formatter:o=>{const i=this.$t.sprintf(this.$t.__("%1$s points",this.$td),P.numberFormat(o,0));let n="";return o===e&&(n=`<span class="peak">${this.strings.peak}</span>`),i+n}},marker:{show:!1}}}}}},Z={class:"aioseo-graph-decay"},z={key:0,class:"aioseo-graph-decay-recovering"};function G(e,o,i,n,s,c){const m=d("apexchart");return l(),h("div",Z,[u(m,{width:"100%",height:i.height,ref:"apexchart",options:c.chartOptions,series:c.getSeries,class:"aioseo-graph-decay-chart"},null,8,["height","options","series"]),i.recovering?(l(),h("div",z,a(s.strings.recovering),1)):g("",!0)])}const J=y(q,[["render",G]]),K={};function Q(e,o){return l(),h("div")}const X=y(K,[["render",Q]]),Y={setup(){return{licenseStore:v(),searchStatisticsStore:I(),settingsStore:O(),optionsStore:j()}},components:{CoreScoreButton:U,CoreWpTable:D,Cta:B,GraphDecay:J,IndexStatus:M,ObjectActions:X,Statistic:N},mixins:[W,A,E],data(){return{numbers:P,tableId:"aioseo-search-statistics-post-table",changeItemsPerPageSlug:"searchStatisticsSeoStatistics",showUpsell:!1,sortableColumns:[],strings:{position:this.$t.__("Position",this.$td),ctaButtonText:this.$t.__("Unlock Post Tracking",this.$td),ctaHeader:this.$t.sprintf(this.$t.__("Post Tracking is a %1$s Feature",this.$td),"PRO")},license:R}},props:{posts:Object,isLoading:Boolean,showHeader:{type:Boolean,default(){return!0}},showTableFooter:Boolean,showItemsPerPage:Boolean,columns:{type:Array,default(){return["postTitle","seoScore","clicks","impressions","position"]}},appendColumns:{type:Object,default(){return{}}},defaultSorting:{type:Object,default(){return{}}},initialFilter:{type:String,default(){return""}},updateAction:{type:String,default(){return"updateSeoStatistics"}}},computed:{allColumns(){var i,n;const e=V(this.columns),o=((n=(i=this.posts)==null?void 0:i.filters)==null?void 0:n.find(s=>s.active))||{};return this.appendColumns[o.slug||"all"]&&e.push(this.appendColumns[o.slug||"all"]),e.map(s=>(s.endsWith("Sortable")&&(s=s.replace("Sortable",""),this.sortableColumns.push(s)),s))},tableColumns(){return[{slug:"row",label:"#",width:"40px"},{slug:"postTitle",label:this.$t.__("Title",this.$td),width:"100%"},{slug:"seoScore",label:this.$t.__("TruSEO Score",this.$td),width:"130px"},{slug:"indexStatus",label:this.$t.__("Indexed",this.$td),width:"80px",coreFeature:"index-status"},{slug:"clicks",label:this.$t.__("Clicks",this.$td),width:"80px"},{slug:"impressions",label:this.$t.__("Impressions",this.$td),width:"110px"},{slug:"position",label:this.$t.__("Position",this.$td),width:"90px"},{slug:"lastUpdated",label:this.$t.__("Last Updated On",this.$td),width:"160px"},{slug:"decay",label:this.$t.__("Loss",this.$td),width:"140px"},{slug:"decayPercent",label:this.$t.__("Drop (%)",this.$td),width:"120px"},{slug:"performance",label:this.$t.__("Performance Score",this.$td),width:"150px"},{slug:"diffDecay",label:this.$t.__("Diff",this.$td),width:"95px"},{slug:"diffPosition",label:this.$t.__("Diff",this.$td),width:"80px"}].filter(e=>e.coreFeature&&(!this.$isPro||this.licenseStore.isUnlicensed||!this.license.hasCoreFeature("search-statistics",e.coreFeature))?!1:e.slug==="seoScore"?this.optionsStore.options.advanced.truSeo:this.allColumns.includes(e.slug)).map(e=>(e.sortable=this.isSortable&&this.sortableColumns.includes(e.slug),e.sortable&&(e.sortDir=e.slug===this.orderBy?this.orderDir:"asc",e.sorted=e.slug===this.orderBy),e))},isSortable(){return this.filter==="all"&&this.$isPro&&!this.licenseStore.isUnlicensed}},watch:{isLoading(e){e||this.$nextTick(()=>{this.loadInspectionResult()})}},methods:{resetSelectedFilters(){this.selectedFilters.postType="",this.processAdditionaFilterOptionSelected({name:"postType",selectedValue:""})},fetchData(e){if(typeof this.searchStatisticsStore[this.updateAction]=="function")return this.searchStatisticsStore[this.updateAction](e)},loadInspectionResult(){var i;if(!((i=this.posts)!=null&&i.rows)||this.searchStatisticsStore.quotaExceeded.urlInspection)return;const e=Object.values(this.posts.rows),o=e.filter(n=>{var s;return!n.inspectionResult||((s=n.inspectionResult)==null?void 0:s.length)===0});o.length&&(o.forEach(n=>{const s=e.find(c=>c.page===n.page);s&&(s.inspectionResultLoading=!0)}),this.searchStatisticsStore.getInspectionResult(o.map(n=>n.page)).then(n=>{o.forEach(s=>{const c=e.find(m=>m.page===s.page);c&&(c.inspectionResult=n[s.page],c.inspectionResultLoading=!1)})}))}},mounted(){this.initialFilter&&this.processFilter({slug:this.initialFilter}),this.loadInspectionResult()}},ee={class:"aioseo-search-statistics-post-table"},te={class:"object-row"},se={class:"object-title"},ie=["onClick"],oe={key:1,class:"object-title"},ne={key:0,class:"row-actions"},re=["href"],ae=["href"];function le(e,o,i,n,s,c){const m=d("object-actions"),$=d("core-score-button"),x=d("index-status"),_=d("statistic"),F=d("graph-decay"),T=d("cta"),C=d("core-wp-table");return l(),h("div",ee,[u(C,{ref:"table",class:"posts-table",id:s.tableId,columns:c.tableColumns,rows:Object.values(i.posts.rows),totals:i.posts.totals,filters:i.posts.filters,"additional-filters":i.posts.additionalFilters,"selected-filters":e.selectedFilters,loading:i.isLoading,"initial-page-number":e.pageNumber,"initial-search-term":e.searchTerm,"initial-items-per-page":n.settingsStore.settings.tablePagination[s.changeItemsPerPageSlug],"show-header":i.showHeader,"show-bulk-actions":!1,"show-table-footer":i.showTableFooter,"show-items-per-page":i.showItemsPerPage,"show-pagination":"","blur-rows":s.showUpsell,onFilterTable:e.processFilter,onProcessAdditionalFilters:e.processAdditionalFilters,onAdditionalFilterOptionSelected:e.processAdditionaFilterOptionSelected,onPaginate:e.processPagination,onProcessChangeItemsPerPage:e.processChangeItemsPerPage,onSearch:e.processSearch,onSortColumn:e.processSort},{row:r(({index:t})=>[p("div",te,a(t+1),1)]),postTitle:r(({row:t})=>[p("div",se,[t.objectId&&t.objectType==="post"?(l(),h("a",{key:0,href:"#",onClick:H(S=>e.openPostDetail(t),["prevent"])},a(t.objectTitle),9,ie)):(l(),h("span",oe,a(t.objectTitle),1))]),u(m,{row:t},null,8,["row"]),t.objectId&&t.objectType==="post"?(l(),h("div",ne,[p("span",null,[p("a",{class:"view",href:t.context.permalink,target:"_blank"},[p("span",null,a(e.viewPost(t.context.postType.singular)),1)],8,re),f(" | ")]),p("span",null,[p("a",{class:"edit",href:t.context.editLink,target:"_blank"},[p("span",null,a(e.editPost(t.context.postType.singular)),1)],8,ae)])])):g("",!0)]),seoScore:r(({row:t})=>[t.seoScore?(l(),b($,{key:0,class:"table-score-button",score:t.seoScore},null,8,["score"])):g("",!0)]),indexStatus:r(({row:t})=>{var S,k;return[u(x,{result:(S=t.inspectionResult)==null?void 0:S.indexStatusResult,"result-link":(k=t.inspectionResult)==null?void 0:k.inspectionResultLink,loading:t.inspectionResultLoading},null,8,["result","result-link","loading"])]}),clicks:r(({row:t})=>[f(a(s.numbers.compactNumber(t.clicks)),1)]),impressions:r(({row:t})=>[f(a(s.numbers.compactNumber(t.impressions)),1)]),position:r(({row:t})=>[f(a(Math.round(t.position).toFixed(0)),1)]),lastUpdated:r(({row:t})=>[f(a(t.context.lastUpdated||"-"),1)]),decay:r(({row:t})=>[u(_,{type:"decay","show-difference":!1,total:t.decay,showZeroValues:!0,class:"no-margin"},null,8,["total"])]),decayPercent:r(({row:t})=>[u(_,{type:"decayPercent","show-difference":!1,total:t.decayPercent,showZeroValues:!0,class:"no-margin"},null,8,["total"])]),performance:r(({row:t})=>[u(F,{points:t.points,peak:t.peak,recovering:t.recovering,height:38},null,8,["points","peak","recovering"])]),diffPosition:r(({row:t})=>[t.difference.comparison?(l(),b(_,{key:0,type:"position","show-original":!1,difference:t.difference.position,"tooltip-offset":"-100px,0"},null,8,["difference"])):g("",!0)]),diffDecay:r(({row:t})=>[t.difference.comparison?(l(),b(_,{key:0,type:"diffDecay","show-original":!1,difference:t.difference.decay,"tooltip-offset":"-100px,0"},null,8,["difference"])):g("",!0)]),cta:r(()=>[s.showUpsell?(l(),b(T,{key:0,"cta-link":e.$links.getPricingUrl("search-statistics","search-statistics-upsell"),"button-text":s.strings.ctaButtonText,"learn-more-link":e.$links.getUpsellUrl("search-statistics","search-statistics-upsell",e.$isPro?"pricing":"liteUpgrade"),"hide-bonus":!n.licenseStore.isUnlicensed},{"header-text":r(()=>[f(a(s.strings.ctaHeader),1)]),_:1},8,["cta-link","button-text","learn-more-link","hide-bonus"])):g("",!0)]),_:1},8,["id","columns","rows","totals","filters","additional-filters","selected-filters","loading","initial-page-number","initial-search-term","initial-items-per-page","show-header","show-table-footer","show-items-per-page","blur-rows","onFilterTable","onProcessAdditionalFilters","onAdditionalFilterOptionSelected","onPaginate","onProcessChangeItemsPerPage","onSearch","onSortColumn"])])}const ke=y(Y,[["render",le]]);export{ke as P};