Files
2026-04-28 15:13:50 +02:00

2 lines
14 KiB
JavaScript

import{b as W,n as Q,aq as f,f as g,i as M,Q as I,R as p,a0 as h,v as k,ae as y,U as c,S as G,P as q,M as S,r as O,u as J,j as i,T as E}from"./vendor-vue-ui.de3ab35f.js";import{I as U,n as X,w as Z,au as $}from"./app-core.ae890a3f.js";import{u as tt}from"./PostTypes.bcb4ad24.js";import{u as Y}from"./WpTable.65c7870f.js";import{C as et}from"./Tooltip.ae7a1028.js";import{C as st}from"./Table.199a0fd0.js";import{a as nt}from"./EditablePhrase.136366c7.js";import{u as ot}from"./Refresh.94db5563.js";import{_ as it,a as lt,b as at,c as rt,L as ut,u as dt}from"./Index.3216ad8e.js";import{C as pt}from"./Tabs.b5aef6dd.js";import{S as B,a as N,b as K}from"./InternalOutbound.dca1dd65.js";import{S as H}from"./External.934835f7.js";import{S as V}from"./Suggestion.94b951e4.js";import{S as ct}from"./Refresh.5f8f183c.js";import{_ as r,a as R}from"./vendor-other.7b559694.js";import{S as gt}from"./Caret.a017b70a.js";import{_ as mt}from"./_plugin-vue_export-helper.eefbdd86.js";import"./vendor-lodash.8e35bd59.js";import"./ScrollTo.f4df02aa.js";import"./Index.52399193.js";import"./Close.098d4b76.js";import"./Button.a549093d.js";import"./Slide.e6618126.js";import"./Download.aee86410.js";import"./Index.ab3bcf62.js";import"./Editor.10fec9a8.js";import"./vendor-quill.fa67f709.js";import"./Input.8918dec2.js";import"./Pencil.405b16d2.js";import"./Trash.d35f8063.js";import"./Plus.97dee933.js";import"./postStatus.ff1bf93a.js";import"./Plus.d276bd63.js";import"./ProBadge.fd60f711.js";import"./Information.278772ab.js";const bt={class:"links-report-inner"},kt={__name:"LinksReportInner",props:{post:{type:Object,required:!0},postIndex:{type:Number,required:!0},postId:{type:Number,required:!0},initialActiveTab:String},setup(t){const u="aioseo-pro",m=U(),s=t,l=O("suggestions-inbound"),o=O("inbound-internal"),v=O(0),w={refresh:r("Refresh",u)},A=J(()=>[{slug:"inbound-internal",icon:B,name:R("%1$s %2$s",m.linksReport.counts[s.postIndex].inboundInternal,r("Inbound Internal",u))},{slug:"outbound-internal",icon:N,name:R("%1$s %2$s",m.linksReport.counts[s.postIndex].outboundInternal,r("Outbound Internal",u))},{slug:"affiliate",icon:K,name:R("%1$s %2$s",m.linksReport.counts[s.postIndex].affiliate,r("Affiliate",u))},{slug:"external",icon:H,name:R("%1$s %2$s",m.linksReport.counts[s.postIndex].external,r("External",u))},{slug:"link-suggestions",icon:V,name:R("%1$s %2$s",m.linksReport.counts[s.postIndex].suggestionsOutbound+m.linksReport.counts[s.postIndex].suggestionsInbound,r("Link Suggestions",u))}]),T=n=>{window.aioseoBus.$emit("updatingLinks",!0);const e={...n,additionalFilters:{postId:s.post.ID,postIndex:s.postIndex}};return m.fetchLinksReportInner(e).finally(()=>{window.aioseoBus.$emit("updatingLinks",!1)})},{processAdditionalFilters:L}=Y({fetchData:T}),_=(n,e)=>{o.value=n,e&&(l.value=e)},{doRefresh:C,isPrioritizedPost:x,refreshLoading:P}=ot({post:s.post,postIndex:s.postIndex,requestType:"linksReport",processAdditionalFilters:L}),{filteredSuggestionsOutbound:F}=dt();return W(()=>{s.initialActiveTab&&Q(()=>{_(s.initialActiveTab)})}),(n,e)=>{const d=f("base-button");return g(),M("div",bt,[(g(),I(k(pt),{class:"link-tabs",internal:"",key:v.value,tabs:A.value,active:o.value,onChanged:e[0]||(e[0]=a=>_(a))},{"var-tab-icon":p(({tab:a})=>[(g(),I(G(a.icon),{class:q([{warning:a.warning}])},null,8,["class"]))]),button:p(()=>[h(d,{class:"button-refresh",type:"gray",size:"medium",loading:k(P),disabled:k(x),onClick:k(C)},{default:p(()=>[h(k(ct)),y(" "+c(w.refresh),1)]),_:1},8,["loading","disabled","onClick"])]),_:1},8,["tabs","active"])),o.value==="outbound-internal"?(g(),I(k(it),{key:0,post:t.post,postIndex:t.postIndex,postId:t.postId,linksReport:"",onOpenSuggestions:e[1]||(e[1]=a=>_("link-suggestions","suggestions-outbound")),onLinksUpdated:e[2]||(e[2]=a=>v.value++)},null,8,["post","postIndex","postId"])):S("",!0),o.value==="inbound-internal"?(g(),I(k(lt),{key:1,post:t.post,postIndex:t.postIndex,postId:t.postId,linksReport:"",onOpenSuggestions:e[3]||(e[3]=a=>_("link-suggestions","suggestions-inbound")),onLinksUpdated:e[4]||(e[4]=a=>v.value++)},null,8,["post","postIndex","postId"])):S("",!0),o.value==="affiliate"?(g(),I(k(at),{key:2,post:t.post,postIndex:t.postIndex,postId:t.postId,onLinksUpdated:e[5]||(e[5]=a=>v.value++),linksReport:""},null,8,["post","postIndex","postId"])):S("",!0),o.value==="external"?(g(),I(k(rt),{key:3,post:t.post,postIndex:t.postIndex,postId:t.postId,onLinksUpdated:e[6]||(e[6]=a=>v.value++),linksReport:""},null,8,["post","postIndex","postId"])):S("",!0),o.value==="link-suggestions"?(g(),I(k(ut),{key:4,post:t.post,postIndex:t.postIndex,postId:t.postId,filteredSuggestionsOutbound:k(F)(t.post),initialTab:l.value,linksReport:"",onShowStandalone:e[7]||(e[7]=a=>n.showStandalone=!0),onSuggestionsTabChanged:e[8]||(e[8]=a=>l.value=a),onLinksUpdated:e[9]||(e[9]=a=>v.value++)},null,8,["post","postIndex","postId","filteredSuggestionsOutbound","initialTab"])):S("",!0)])}}},b="aioseo-pro",ft={setup(){const t=U(),u=Z(),m="aioseo-link-assistant-links-report-wp-table",s=O(null),l=O({}),o=({name:j,selectedValue:z})=>{j==="post-type"&&(l.value["post-type"]=z,l.value.term="all"),s.value=t.linksReport.additionalFilters.filter(D=>D.name==="post-type"||D.dependsOn&&l.value["post-type"]===D.dependsOn.value)},v=()=>{l.value.term="all",l.value["post-type"]="",o({name:"post-type",selectedValue:""})},{editPost:w,viewPost:A}=tt(),{pageNumber:T,processAdditionalFilters:L,processChangeItemsPerPage:_,processFilterTable:C,processPagination:x,processSearch:P,processSort:F,refreshTable:n,searchTerm:e,wpTableKey:d,wpTableLoading:a}=Y({changeItemsPerPageSlug:"linkAssistantLinksReport",fetchData:t.fetchLinksReport,resetSelectedFilters:v,selectedFilters:l,tableId:m});return{additionalFilters:s,dateSqlToLocal:$,editPost:w,linkAssistantStore:t,pageNumber:T,processAdditionalFilterOptionSelected:o,processAdditionalFilters:L,processChangeItemsPerPage:_,processFilterTable:C,processPagination:x,processSearch:P,processSort:F,refreshTable:n,searchTerm:e,selectedFilters:l,settingsStore:u,tableId:m,viewPost:A,wpTableKey:d,wpTableLoading:a}},components:{CoreTooltip:et,CoreWpTable:st,LinkAssistantConfirmationModal:nt,LinksReportInner:kt,SvgCaret:gt,SvgLinkAffiliate:K,SvgLinkExternal:H,SvgLinkInternalInbound:B,SvgLinkInternalOutbound:N,SvgLinkSuggestion:V},data(){return{numbers:X,initialActiveTab:"inbound-internal",innerTableKey:0,activeRow:-1,showModal:!1,selectedRows:null,bulkAction:null,strings:{deleteAllLinks:r("Delete All Links",b),inboundInternal:R(r("%1$sInbound Internal Links%2$sLinks from other posts to this post",b),"<strong>","</strong><br />"),outboundInternal:R(r("%1$sOutbound Internal Links%2$sLinks from this post to other posts",b),"<strong>","</strong><br />")},modalStrings:{areYouSureSingle:r("Are you sure you want to delete all links for this post?",b),actionCannotBeUndone:r("This action cannot be undone.",b),yesSingle:r("Yes, I want to delete all links",b),noChangedMind:r("No, I changed my mind",b)}}},computed:{columns(){return[{slug:"post_title",label:r("Post Title",b),width:"100%"},{slug:"publish_date",label:r("Publish Date",b),width:"170px"},{slug:"internal",label:r("Internal",b),width:"150px"},{slug:"affiliate",label:r("Affiliate",b),width:"90px"},{slug:"external",label:r("External",b),width:"90px"},{slug:"suggestions",label:r("Suggestions",b),width:"110px"},{slug:"toggle-button",label:"",width:"60px"}]}},methods:{getPostId(t){return parseInt(t)},isRowActive(t){return t===this.activeRow},maybeEditRow(t,u,m,s){if(!m){this.initialActiveTab=t,u(s),this.toggleRow(s);return}if(this.initialActiveTab===t){u(s),this.toggleRow(s);return}this.initialActiveTab=t,this.innerTableKey++},toggleRow(t){if(this.activeRow===t){this.activeRow=-1;return}this.activeRow=t},maybeDeleteAllLinks(t){t!==!1&&(this.selectedRows=t,this.showModal=!0)},deleteAllLinks(){this.showModal=!1;const t=this.linkAssistantStore.linksReport.rows[this.selectedRows].ID;if(t)return this.wpTableLoading=!0,this.linkAssistantStore.linksReportDeleteAll({postId:t}).finally(()=>{this.activeRow=-1,this.wpTableKey++,this.refreshTable()})},doProcessPagination(t){this.processPagination(t),this.activeRow=-1},doProcessSearch(t){this.processSearch(t),this.activeRow=-1},doProcessFilterTable(t){this.processFilterTable(t),this.activeRow=-1},doProcessAdditionalFilters(t){this.processAdditionalFilters(t),this.activeRow=-1}},beforeMount(){this.additionalFilters=this.linkAssistantStore.linksReport.additionalFilters.filter(t=>t.name==="post-type"||t.dependsOn&&this.selectedFilters["post-type"]===t.dependsOn.value),this.$route.query&&(Object.entries(this.$route.query).forEach(t=>{switch(t[0]){case"fullReport":this.processFilterTable({slug:"all"});break;case"postTitle":this.searchTerm=this.$route.query.postTitle,this.processSearch(this.searchTerm);break;case"linkingOpportunities":this.processFilterTable({slug:"linking-opportunities"});break;case"orphaned-posts":this.processFilterTable({slug:"orphaned-posts"});break}}),this.linkAssistantStore.setLinksReportCounts())}},ht={class:"aioseo-link-assistant-links-report"},vt={class:"post-title"},It=["onClick"],_t={key:0,class:"post-status-badge draft"},St={key:1,class:"post-status-badges"},Rt={class:"post-status-badge future"},wt={class:"post-status-badge future"},yt={class:"row-actions"},At=["href"],Tt=["href"],Lt=["onClick"],Ct={key:0,class:"date"},xt={class:"internal-links-count"},Pt=["onClick"],Ft={class:"aioseo-tooltip-wrapper"},Mt=["innerHTML"],Ot=["onClick"],Dt={class:"aioseo-tooltip-wrapper"},qt=["innerHTML"],Et=["onClick"],Ut=["onClick"],Yt=["onClick"],Bt=["onClick"];function Nt(t,u,m,s,l,o){const v=f("svg-link-internal-inbound"),w=f("core-tooltip"),A=f("svg-link-internal-outbound"),T=f("svg-link-suggestion"),L=f("svg-link-affiliate"),_=f("svg-link-external"),C=f("svg-caret"),x=f("LinksReportInner"),P=f("core-wp-table"),F=f("link-assistant-confirmation-modal");return g(),M("div",ht,[(g(),I(P,{ref:"table",class:"posts-table",id:s.tableId,"additional-filters":s.additionalFilters,columns:o.columns,filters:s.linkAssistantStore.linksReport.filters,"initial-items-per-page":s.settingsStore.settings.tablePagination.linkAssistantLinksReport,"initial-page-number":s.pageNumber,"initial-search-term":s.searchTerm,key:s.wpTableKey,loading:s.wpTableLoading,rows:s.linkAssistantStore.linksReport.rows,"selected-filters":s.selectedFilters,"show-bulk-actions":!1,totals:s.linkAssistantStore.linksReport.totals,"show-items-per-page":"",onAdditionalFilterOptionSelected:s.processAdditionalFilterOptionSelected,onFilterTable:o.doProcessFilterTable,onPaginate:o.doProcessPagination,onProcessAdditionalFilters:o.doProcessAdditionalFilters,onProcessChangeItemsPerPage:s.processChangeItemsPerPage,onSearch:o.doProcessSearch,onSortColumn:s.processSort},{post_title:p(({row:n,index:e,editRow:d})=>[i("div",vt,[i("a",{href:"#",class:q({active:o.isRowActive(e)}),onClick:E(a=>{d(e),o.toggleRow(e)},["prevent"])},[i("span",null,c(n.context.postTitle),1),["draft","private","pending"].includes(n.post_status)?(g(),M("span",_t,c(n.context?.postStatus?.label?.toUpperCase()),1)):S("",!0),n.post_status==="future"?(g(),M("span",St,[i("span",Rt,c(n.context?.postStatus?.label?.toUpperCase()),1),i("span",wt,c(s.dateSqlToLocal(n.post_date,"MMMM D, YYYY").toUpperCase()),1)])):S("",!0)],10,It)]),i("div",yt,[i("span",null,[i("a",{class:"view",href:n.context.permalink,target:"_blank"},[i("span",null,c(s.viewPost(n.context.postType.singular)),1)],8,At),u[1]||(u[1]=y(" | ",-1))]),i("span",null,[i("a",{class:"edit",href:n.context.editLink,target:"_blank"},[i("span",null,c(s.editPost(n.context.postType.singular)),1)],8,Tt),u[2]||(u[2]=y(" | ",-1))]),i("span",null,[i("a",{class:"delete-all-links",href:"#",onClick:E(a=>o.maybeDeleteAllLinks(e),["prevent"])},[i("span",null,c(l.strings.deleteAllLinks),1)],8,Lt)])])]),publish_date:p(({row:n})=>[n.post_status==="publish"?(g(),M("span",Ct,c(s.dateSqlToLocal(n.post_date,"MMMM D, YYYY")),1)):S("",!0)]),internal:p(({editRow:n,index:e,editRowActive:d})=>[i("div",xt,[i("div",{onClick:a=>o.maybeEditRow("inbound-internal",n,d,e)},[i("div",Ft,[h(w,{class:"action"},{tooltip:p(()=>[i("span",{innerHTML:l.strings.inboundInternal},null,8,Mt)]),default:p(()=>[h(v),i("span",null,c(l.numbers.numberFormat(s.linkAssistantStore.linksReport.counts[e].inboundInternal)),1)]),_:2},1024)])],8,Pt),i("div",{onClick:a=>o.maybeEditRow("outbound-internal",n,d,e)},[i("div",Dt,[h(w,{class:"action"},{tooltip:p(()=>[i("span",{innerHTML:l.strings.outboundInternal},null,8,qt)]),default:p(()=>[h(A),i("span",null,c(l.numbers.numberFormat(s.linkAssistantStore.linksReport.counts[e].outboundInternal)),1)]),_:2},1024)])],8,Ot)])]),suggestions:p(({editRow:n,index:e,editRowActive:d})=>[i("div",{onClick:a=>o.maybeEditRow("link-suggestions",n,d,e)},[h(T),y(" "+c(l.numbers.numberFormat(s.linkAssistantStore.linksReport.counts[e].suggestionsInbound+s.linkAssistantStore.linksReport.counts[e].suggestionsOutbound)),1)],8,Et)]),affiliate:p(({editRow:n,index:e,editRowActive:d})=>[i("div",{onClick:a=>o.maybeEditRow("affiliate",n,d,e)},[h(L),y(" "+c(l.numbers.numberFormat(s.linkAssistantStore.linksReport.counts[e].affiliate)),1)],8,Ut)]),external:p(({editRow:n,index:e,editRowActive:d})=>[i("div",{onClick:a=>o.maybeEditRow("external",n,d,e)},[h(_),y(" "+c(l.numbers.numberFormat(s.linkAssistantStore.linksReport.counts[e].external)),1)],8,Yt)]),"toggle-button":p(({index:n,editRow:e})=>[i("button",{class:q(["toggle-row-button",{active:o.isRowActive(n)}]),onClick:d=>{e(n),o.toggleRow(n)}},[h(C)],10,Bt)]),"edit-row":p(({row:n,index:e})=>[(g(),I(x,{key:l.innerTableKey,post:n,postIndex:e,postId:o.getPostId(n.ID),initialActiveTab:l.initialActiveTab},null,8,["post","postIndex","postId","initialActiveTab"]))]),_:1},8,["id","additional-filters","columns","filters","initial-items-per-page","initial-page-number","initial-search-term","loading","rows","selected-filters","totals","onAdditionalFilterOptionSelected","onFilterTable","onPaginate","onProcessAdditionalFilters","onProcessChangeItemsPerPage","onSearch","onSortColumn"])),h(F,{show:l.showModal,selectedRows:l.selectedRows,strings:l.modalStrings,onDoBulkAction:o.deleteAllLinks,onCloseModal:u[0]||(u[0]=n=>l.showModal=!1)},null,8,["show","selectedRows","strings","onDoBulkAction"])])}const Re=mt(ft,[["render",Nt]]);export{Re as default};