Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
revealability
/
wp-content
/
plugins
/
wordpress-seo
/
js
/
dist
:
dashboard-widget.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
(()=>{"use strict";const e=window.wp.element,t=window.yoast.componentsNew,s=window.yoast.styleGuide,o=window.yoast.analysisReport,i=window.yoast.helpers,a=window.ReactJSXRuntime;class r extends e.Component{constructor(){super(),this.state={statistics:null,feed:null,isDataFetched:!1}}componentDidMount(){const e=jQuery("#wpseo-dashboard-overview-hide");e.is(":checked")&&this.fetchData(),e.on("click",(()=>{this.fetchData()}))}fetchData(){this.state.isDataFetched||(this.getStatistics(),this.getFeed(),this.setState({isDataFetched:!0}))}static getColorFromScore(e){return s.colors[`$color_${e}`]||s.colors.$color_grey}getStatistics(){wpseoApi.get("statistics",(e=>{const t={};e&&e.seo_scores&&(t.seoScores=e.seo_scores.map((e=>({value:parseInt(e.count,10),color:r.getColorFromScore(e.seo_rank),html:`<a href="${e.link}">${e.label}</a>`}))),t.header=jQuery(`<div>${e.header}</div>`).text(),this.setState({statistics:t}))}))}getFeed(){(0,i.getPostFeed)("https://yoast.com/feed/widget/?wp_version="+wpseoDashboardWidgetL10n.wp_version+"&php_version="+wpseoDashboardWidgetL10n.php_version,2).then((e=>{e.items=e.items.map((e=>(e.description=jQuery(`<div>${e.description}</div>`).text(),e.description=e.description.replace(`The post ${e.title} appeared first on Yoast.`,"").trim(),e))),this.setState({feed:e})})).catch((e=>console.log(e)))}getSeoAssessment(){return null===this.state.statistics?null:(0,a.jsx)(o.SiteSEOReport,{seoAssessmentText:this.state.statistics.header,seoAssessmentItems:this.state.statistics.seoScores},"yoast-seo-posts-assessment")}getYoastFeed(){return null===this.state.feed?null:(0,a.jsx)(t.ArticleList,{className:"wordpress-feed",title:wpseoDashboardWidgetL10n.feed_header,feed:this.state.feed,footerLinkText:wpseoDashboardWidgetL10n.feed_footer},"yoast-seo-blog-feed")}render(){const e=[this.getSeoAssessment(),this.getYoastFeed()].filter((e=>null!==e));return 0===e.length?null:(0,a.jsx)("div",{children:e})}}const n=document.getElementById("yoast-seo-dashboard-widget");n&&(0,e.createRoot)(n).render((0,a.jsx)(r,{}))})();