chunk-2fdef45c.js
8.79 KB
(window["aioseopjsonp"]=window["aioseopjsonp"]||[]).push([["chunk-2fdef45c"],{"039e":function(t,s,i){"use strict";var n=i("5530"),e=(i("d81d"),i("a9e3"),i("caad"),i("2532"),i("d3b7"),i("2f62"));s["a"]={computed:Object(n["a"])(Object(n["a"])({},Object(e["e"])(["linkAssistant"])),{},{isPrioritizedPost:function(){var t=this.linkAssistant.linksReport.prioritizedPosts;return Array.isArray(t)&&(t=t.map(Number)),t.includes(parseInt(this.post.ID))}}),methods:Object(n["a"])(Object(n["a"])({},Object(e["b"])("linkAssistant",["linksRefresh"])),{},{doRefresh:function(){var t=this;this.refreshLoading=!0,this.$bus.$emit("updatingLinks",!0),this.linksRefresh({postIndex:this.postIndex,postId:this.post.ID,linksReport:!0}).finally((function(){t.refreshLoading=!1,t.$bus.$emit("updatingLinks",!1)}))}})}},"1b6a":function(t,s,i){"use strict";i("159b"),i("498a"),i("4d63"),i("ac1f"),i("25f0"),i("841c");var n=i("ab86"),e=i("5f74");s["a"]={methods:{filteredSuggestionsOutbound:function(t){var s=this,i=t.links.suggestionsOutbound.rows,n=[];return i.forEach((function(t){s.editorIsSuggestionAlreadyAdded(t)||n.push(t)})),n},editorIsSuggestionAlreadyAdded:function(t){return Object(e["a"])()?this.blockEditorIsSuggestionAlreadyAdded(t):!!Object(e["b"])()&&this.classicEditorIsSuggestionAlreadyAdded(t)},blockEditorIsSuggestionAlreadyAdded:function(t){var s=window.wp.data.select("core/block-editor").getBlocks();return!!s&&this.doesBlockHaveLink(s,t)},doesBlockHaveLink:function(t,s){var i=this,e=!1;return t.forEach((function(t){!e&&t.attributes&&s.suggestions.forEach((function(o){var a=Object(n["a"])(o.context.permalink.trim()),r=new RegExp('(<a href="'.concat(a,'"[^<>]*>)(.*)(</a[^<>]*>)'),"i");if(t.attributes.content&&-1!==t.attributes.content.search(r))e=!0;else if(t.innerBlocks){var l=i.doesBlockHaveLink(t.innerBlocks,s);l&&(e=!0)}}))})),e},classicEditorIsSuggestionAlreadyAdded:function(t){var s="",i=null,e=null;if(document.querySelector("#wp-content-wrap.tmce-active")?(i=window.tinyMCE.get("content"),s=i.getContent({format:"raw"})):(e=document.querySelector("textarea#content"),s=e?e.value:""),!s)return!1;var o=!1;return t.suggestions.forEach((function(t){var i=Object(n["a"])(t.context.permalink.trim()),e=new RegExp('(<a href="'.concat(i,'"[^<>]*>)(.*)(</a[^<>]*>)'),"i");-1!==s.search(e)&&(o=!0)})),o}}}},"4f0a":function(t,s,i){"use strict";i("84bd")},"84bd":function(t,s,i){},a16c:function(t,s,i){"use strict";i.r(s);var n=function(){var t=this,s=t.$createElement,i=t._self._c||s;return i("div",{staticClass:"aioseo-link-assistant-post-report"},[t.loadingInitialData?i("div",{staticClass:"header-container"},[i("div",{staticClass:"first-row"},[i("a",{attrs:{href:"#"},domProps:{innerHTML:t._s(t.strings.backToLinksReport)},on:{click:function(s){return s.stopPropagation(),s.preventDefault(),t.closePostReport.apply(null,arguments)}}})]),i("div",{staticClass:"second-row"},[i("div",{staticClass:"first-column"},[i("span",{staticClass:"header"},[t._v(t._s(t.strings.loadingHeader))])])])]):t._e(),t.showLoadingBar?i("div",{staticClass:"load-progress"},[i("div",{staticClass:"load-progress-value",style:{animationDuration:t.loadTime+"s"}})]):t._e(),t.loadingInitialData?t._e():i("div",{staticClass:"header-container"},[i("div",{staticClass:"first-row"},[i("a",{attrs:{href:"#"},domProps:{innerHTML:t._s(t.strings.backToLinksReport)},on:{click:function(s){return s.stopPropagation(),s.preventDefault(),t.closePostReport.apply(null,arguments)}}})]),i("div",{staticClass:"second-row"},[i("div",{staticClass:"first-column"},[i("span",{staticClass:"header"},[t._v(t._s(t.header))]),i("a",{staticClass:"view-post-link",attrs:{href:t.post.context.permalink,target:"_blank"}},[t._v(t._s(t.strings.viewPost))])]),i("div",{staticClass:"second-column"},[i("base-button",{attrs:{type:"blue",tag:"button",loading:t.refreshLoading,disabled:t.isPrioritizedPost,icon:"svg-refresh"},on:{click:t.doRefresh}},[t._v(" "+t._s(t.strings.refresh)+" ")])],1)])]),i("core-main-tabs",{staticClass:"link-tabs",attrs:{internal:"",tabs:t.tabs,active:t.activeTab,showSaveButton:!1},on:{changed:function(s){return t.processChangeTab(s)}}}),"outbound-internal"===t.activeTab?i("link-assistant-outbound-internal",{attrs:{post:t.getPost,postIndex:t.postIndex,postId:t.postId,postReport:""},on:{openSuggestions:function(s){return t.processChangeTab("link-suggestions","suggestions-outbound")}}}):t._e(),"inbound-internal"===t.activeTab?i("link-assistant-inbound-internal",{attrs:{post:t.getPost,postIndex:t.postIndex,postId:t.postId,postReport:""},on:{openSuggestions:function(s){return t.processChangeTab("link-suggestions","suggestions-inbound")}}}):t._e(),"affiliate"===t.activeTab?i("link-assistant-affiliate",{attrs:{post:t.getPost,postIndex:t.postIndex,postId:t.postId,postReport:""}}):t._e(),"external"===t.activeTab?i("link-assistant-external",{attrs:{post:t.getPost,postIndex:t.postIndex,postId:t.postId,postReport:""}}):t._e(),"link-suggestions"===t.activeTab?i("link-assistant-suggestions",{attrs:{post:t.getPost,postIndex:t.postIndex,postId:t.postId,filteredSuggestionsOutbound:t.filteredSuggestionsOutbound(t.post),initialTab:t.activeSuggestionTab,postReport:""},on:{showStandalone:function(s){t.showStandalone=!0},suggestionsTabChanged:function(s){return t.activeSuggestionTab=s}}}):t._e()],1)},e=[],o=i("5530"),a=(i("d3b7"),i("2f62")),r=i("1b6a"),l=i("039e"),d={mixins:[r["a"],l["a"]],beforeMount:function(){this.$route.query&&(this.$route.query.postId?(this.postId=parseInt(this.$route.query.postId),this.activeTab=this.$route.query.initialTab,this.activeSuggestionTab=this.$route.query.initialSuggestionTab,this.post={ID:this.postId,context:{},links:Object(o["a"])({},this.linkAssistant.postReport)}):this.$router.push({name:"links-report"}))},mounted:function(){var t=this;this.resetPostReportState(),this.$bus.$emit("updatingLinks",!0),this.showLoadingBar=!0,this.loadingInitialData=!0,setTimeout(this.checkProgress,1e3*this.loadTime),this.postReportInitial(this.postId).then((function(s){s.body.links&&(t.post.links=s.body.links),s.body.context&&(t.post.context=s.body.context),t.setPostReportLinks({links:Object(o["a"])({},s.body.links)})})).catch((function(s){console.error(s),t.$router.push({name:"links-report"})})).finally((function(){t.$bus.$emit("updatingLinks",!1),t.showLoadingBar=!1,t.loadingInitialData=!1}))},data:function(){return{postId:null,postIndex:0,post:{},activeTab:"inbound-internal",activeSuggestionTab:"suggestions-inbound",refreshLoading:!1,loadTime:4,showLoadingBar:!1,loadingInitialData:!1,strings:{backToLinksReport:this.$t.sprintf(this.$t.__("%1$s Back to Links Report",this.$t.tdPro),"<span>←</span>"),loadingHeader:this.$t.__("Loading Link Suggestions. Please wait...",this.$t.tdPro),viewPost:this.$t.__("view post",this.$t.tdPro),refresh:this.$t.__("Refresh",this.$t.tdPro)}}},computed:Object(o["a"])(Object(o["a"])({},Object(a["e"])("linkAssistant",["postReport"])),{},{getPost:function(){var t=Object(o["a"])(Object(o["a"])({},this.post),{},{links:this.postReport});return t},header:function(){return this.$t.sprintf(this.$t.__('Internal Links & Suggestions for "%1$s"',this.$t.tdPro),this.post.context.postTitle)},tabs:function(){return[{slug:"inbound-internal",icon:"svg-link-internal-inbound",name:this.$t.sprintf("%1$s %2$s",this.post.links.inboundInternal.totals.total,this.$t.__("Inbound Internal",this.$tdPro))},{slug:"outbound-internal",icon:"svg-link-internal-outbound",name:this.$t.sprintf("%1$s %2$s",this.post.links.outboundInternal.totals.total,this.$t.__("Outbound Internal",this.$tdPro))},{slug:"affiliate",icon:"svg-link-affiliate",name:this.$t.sprintf("%1$s %2$s",this.post.links.affiliate.totals.total,this.$t.__("Affiliate",this.$tdPro))},{slug:"external",icon:"svg-link-external",name:this.$t.sprintf("%1$s %2$s",this.post.links.external.totals.total,this.$t.__("External",this.$tdPro))},{slug:"link-suggestions",icon:"svg-link-suggestion",name:this.$t.sprintf("%1$s %2$s",this.post.links.suggestionsOutbound.totals.total+this.post.links.suggestionsInbound.totals.total,this.$t.__("Link Suggestions",this.$tdPro))}]}}),methods:Object(o["a"])(Object(o["a"])(Object(o["a"])({},Object(a["b"])("linkAssistant",["postReportInitial","linksRefresh"])),Object(a["d"])("linkAssistant",["setPostReportLinks","resetPostReportState"])),{},{closePostReport:function(){this.$router.push({name:"links-report"})},processChangeTab:function(t,s){this.activeTab=t,s&&(this.activeSuggestionTab=s)},doRefresh:function(){var t=this;this.refreshLoading=!0,this.$bus.$emit("updatingLinks",!0),this.linksRefresh({postIndex:this.postIndex,postId:this.post.ID,linksReport:!0}).finally((function(){t.refreshLoading=!1,t.$bus.$emit("updatingLinks",!1)}))},checkProgress:function(){var t=this;this.showLoadingBar=!1,this.loadingInitialData&&this.$nextTick((function(){t.showLoadingBar=!0,2>t.loadTime&&(t.loadTime=4),t.loadTime=t.loadTime/2,setTimeout(t.checkProgress,1e3*t.loadTime)}))}})},u=d,c=(i("4f0a"),i("2877")),p=Object(c["a"])(u,n,e,!1,null,null,null);s["default"]=p.exports}}]);