← Back
Editing: analysisReport.js
(()=>{var e={32485(e,s){var t;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],s=0;s<arguments.length;s++){var t=arguments[s];if(t){var n=typeof t;if("string"===n||"number"===n)e.push(t);else if(Array.isArray(t)){if(t.length){var i=o.apply(null,t);i&&e.push(i)}}else if("object"===n){if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]")){e.push(t.toString());continue}for(var a in t)r.call(t,a)&&t[a]&&e.push(a)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(t=function(){return o}.apply(s,[]))||(e.exports=t)}()},51609(e){"use strict";e.exports=window.React},64610(e,s,t){const r=t(51609),o=r.forwardRef(function(e,s){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"}))});e.exports=o},87712(e,s,t){const r=t(51609),o=r.forwardRef(function(e,s){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.exports=o}},s={};function t(r){var o=s[r];if(void 0!==o)return o.exports;var n=s[r]={exports:{}};return e[r](n,n.exports,t),n.exports}t.n=e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},t.d=(e,s)=>{for(var r in s)t.o(s,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:s[r]})},t.o=(e,s)=>Object.prototype.hasOwnProperty.call(e,s),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";t.r(r),t.d(r,{AnalysisList:()=>A,AnalysisResult:()=>I,ContentAnalysis:()=>F,MarkButton:()=>S,SiteSEOReport:()=>G,renderRatingToColor:()=>P});const e=window.wp.i18n,s=window.yoast.styleGuide,o=window.lodash.noop;var n=t.n(o),i=t(51609),a=t.n(i);const l=window.yoast.styledComponents;var u=t.n(l);const d=window.yoast.componentsNew,p=window.yoast.helpers,c=window.yoast.uiLibrary;var h=t(32485),m=t.n(h),g=t(64610),x=t.n(g),k=t(87712),b=t.n(k);const y=window.lodash,C=window.ReactJSXRuntime,{stripTagsFromHtmlString:f}=p.strings,B=["a","b","strong","em","i"],v=u().div` display: grid; grid-template-rows: 1fr; max-width: 32px; // This gap value is half the gap value between assessment result list items, which is 12px. gap: 6px; `,w=u().li` // This is the height of the IconButtonToggle. min-height: 24px; margin-bottom: 12px; padding: 0; display: flex; align-items: flex-start; position: relative; gap: 12px; `,j=u()(d.SvgIcon)` margin: 3px 0 0 0; `,R=u().p` margin: 0; flex: 1 1 auto; color: ${e=>e.suppressedText?"rgba(30,30,30,0.5)":"inherit"}; `,N=()=>{const{show:e,hide:s}=(0,c.useTooltipContext)(),[t,r]=(0,i.useState)(!1),[o,n]=(0,i.useState)(!1),[a,l]=(0,i.useState)(!1),u=(0,i.useRef)(null);return(0,i.useEffect)(()=>{!t&&!o||a?s():e()},[t,o,a,e,s]),(0,i.useEffect)(()=>()=>clearTimeout(u.current),[]),{hoverProps:{onPointerEnter:(0,i.useCallback)(()=>{clearTimeout(u.current),r(!0),l(!1)},[]),onPointerLeave:(0,i.useCallback)(()=>{u.current=setTimeout(()=>r(!1),100)},[])},triggerProps:{onFocus:(0,i.useCallback)(e=>{(e=>{try{return e.matches(":focus-visible")}catch{return!0}})(e.target)&&(n(!0),l(!1))},[]),onBlur:(0,i.useCallback)(()=>n(!1),[]),onKeyDown:(0,i.useCallback)(e=>{"Escape"===e.key&&l(!0)},[])}}},_=({ariaLabel:e,id:s,className:t="",status:r="enabled",onClick:o,isPressed:n})=>{const{hoverProps:i,triggerProps:a}=N();return(0,C.jsxs)("span",{className:"yst-inline-flex",...i,children:[(0,C.jsx)(c.Button,{variant:n?"primary":"secondary",size:"small",className:m()(t,"yst-px-2 yst-rounded-md yst-shadow-none yst-border-0 focus:yst-z-10"),onClick:o,id:s,disabled:"disabled"===r,"aria-pressed":n,"aria-label":e,...a,children:(0,C.jsx)(x(),{className:"yst-w-4 yst-h-4"})}),(0,C.jsx)(c.TooltipWithContext,{position:"left",children:e})]})},S=({className:e="",status:s="enabled",children:t=null,...r})=>(0,C.jsxs)(c.Root,{children:[(0,C.jsx)(c.TooltipContainer,{as:"div",className:"yst-relative yst-inline-flex",children:(0,C.jsx)(_,{className:e,status:s,...r})}),t]}),L=({ariaLabel:e,id:s,className:t="",onClick:r})=>{const{hoverProps:o,triggerProps:n}=N();return(0,C.jsxs)("span",{className:"yst-inline-flex",...o,children:[(0,C.jsx)(c.Button,{variant:"secondary",size:"small",className:m()(t,"yst-px-2 yst-rounded-md yst-shadow-none yst-border-0"),onClick:r,id:s,"aria-label":e,...n,children:(0,C.jsx)(b(),{className:"yst-w-4 yst-h-4"})}),(0,C.jsx)(c.TooltipWithContext,{position:"left",children:e})]})},E=e=>(0,C.jsx)(S,{...e}),I=({ariaLabelMarks:e,ariaLabelEdit:s="",bulletColor:t,buttonIdMarks:r,buttonIdEdit:o="",editButtonClassName:n="",hasAIFixes:a=!1,hasBetaBadgeLabel:l=!1,hasEditButton:u=!1,hasMarksButton:p,id:h="",isPremium:m=!1,marker:g=y.noop,markButtonFactory:x=null,marksButtonStatus:k="enabled",marksButtonClassName:b="",onButtonClickMarks:N,onButtonClickEdit:_=y.noop,onResultChange:S=y.noop,pressed:I,renderHighlightingUpsell:M=y.noop,renderAIOptimizeButton:P=y.noop,shouldUpsellHighlighting:A=!1,suppressedText:T=!1,text:H})=>{const[O,z]=(0,i.useState)(!1),$=(0,i.useCallback)(()=>z(!1),[]),F=(0,i.useCallback)(()=>z(!0),[]);x=x||E;let U=null;return function(e,s){return!e||"hidden"===s}(p,k)||(U=x({onClick:A?F:N,status:k,className:b,id:r,isPressed:I,ariaLabel:e})),(0,i.useEffect)(()=>{S(h,g,p)},[h,g,p]),(0,C.jsxs)(w,{children:[(0,C.jsx)(j,{icon:"circle",color:t,size:"13px"}),(0,C.jsxs)(R,{suppressedText:T,children:[l&&(0,C.jsx)(d.BetaBadge,{}),(0,C.jsx)("span",{dangerouslySetInnerHTML:{__html:f(H,B)}})]}),(0,C.jsxs)(v,{children:[U,M(O,$),u&&m&&(0,C.jsx)(c.Root,{children:(0,C.jsx)(c.TooltipContainer,{as:"div",className:"yst-relative yst-inline-flex",children:(0,C.jsx)(L,{ariaLabel:s,id:o,className:n,onClick:_})})}),P(a,h)]})]})},M=u().ul` margin: 8px 0; padding: 0; list-style: none; `;function P(e){switch(e){case"good":return s.colors.$color_good;case"OK":return s.colors.$color_ok;case"bad":return s.colors.$color_bad;default:return s.colors.$color_score_icon}}function A({results:s,marksButtonActivatedResult:t="",marksButtonStatus:r="enabled",marksButtonClassName:o="",editButtonClassName:i="",markButtonFactory:a=null,onMarksButtonClick:l=n(),onEditButtonClick:u=n(),isPremium:d=!1,onResultChange:p=n(),shouldUpsellHighlighting:c=!1,renderHighlightingUpsell:h=n(),renderAIOptimizeButton:m=n()}){return(0,C.jsx)(M,{role:"list",children:s.map(s=>{const n=P(s.rating),g=s.markerId===t,x=s.editFieldName,k=s.id+"Mark",b=x+"Edit";let y="";y="disabled"===r?(0,e.__)("Highlighting is currently disabled","wordpress-seo"):g?(0,e.__)("Remove highlight from the text","wordpress-seo"):(0,e.__)("Highlight this result in the text","wordpress-seo");const f=s.editFieldAriaLabel;return(0,C.jsx)(I,{id:s.id,text:s.text,marker:s.marker,bulletColor:n,hasMarksButton:s.hasMarks,hasEditButton:s.hasJumps,hasAIFixes:s.hasAIFixes,ariaLabelMarks:y,ariaLabelEdit:f,pressed:g,suppressedText:"upsell"===s.rating,buttonIdMarks:k,buttonIdEdit:b,onButtonClickMarks:()=>l(s.id,s.marker),onButtonClickEdit:e=>u(x,e),marksButtonClassName:o,editButtonClassName:i,marksButtonStatus:r,hasBetaBadgeLabel:s.hasBetaBadge,isPremium:d,onResultChange:p,markButtonFactory:a,shouldUpsellHighlighting:c,renderAIOptimizeButton:m,renderHighlightingUpsell:h},s.id)})})}const T=window.yoast.propTypes;var H=t.n(T);const O=u().div` width: 100%; background-color: white; border-bottom: 1px solid transparent; // Avoid parent and child margin collapsing. `,z=u()(d.Collapsible)` margin-bottom: 8px; ${d.StyledIconsButton} { padding: 8px 0; color: ${s.colors.$color_blue}; margin: -2px 8px 0 -2px; // Compensate icon size set to 18px. } `;class $ extends a().Component{renderCollapsible(e,t,r,o=null){return(0,C.jsx)(z,{id:o?`${o}-collapsible`:null,initialIsOpen:!0,title:`${e} (${r.length})`,prefixIcon:{icon:"angle-up",color:s.colors.$color_grey_dark,size:"18px"},prefixIconCollapsed:{icon:"angle-down",color:s.colors.$color_grey_dark,size:"18px"},suffixIcon:null,suffixIconCollapsed:null,headingProps:{level:t,fontSize:"13px",fontWeight:"500",color:"#1e1e1e"},children:(0,C.jsx)(A,{results:r,marksButtonActivatedResult:this.props.activeMarker,marksButtonStatus:this.props.marksButtonStatus,marksButtonClassName:this.props.marksButtonClassName,editButtonClassName:this.props.editButtonClassName,markButtonFactory:this.props.markButtonFactory,onMarksButtonClick:this.props.onMarkButtonClick,onEditButtonClick:this.props.onEditButtonClick,renderAIOptimizeButton:this.props.renderAIOptimizeButton,isPremium:this.props.isPremium,onResultChange:this.props.onResultChange,shouldUpsellHighlighting:this.props.shouldUpsellHighlighting,renderHighlightingUpsell:this.props.renderHighlightingUpsell})})}render(){const{problemsResults:s,improvementsResults:t,goodResults:r,considerationsResults:o,errorsResults:n,upsellResults:i,headingLevel:a,resultCategoryLabels:l,id:u}=this.props,d=n.length,p=s.length,c=t.length,h=o.length,m=r.length,g=i.length,x={errors:(0,e.__)("Errors","wordpress-seo"),problems:(0,e.__)("Problems","wordpress-seo"),improvements:(0,e.__)("Improvements","wordpress-seo"),considerations:(0,e.__)("Considerations","wordpress-seo"),goodResults:(0,e.__)("Good results","wordpress-seo")},k=Object.assign(x,l);return(0,C.jsxs)(O,{children:[d>0&&this.renderCollapsible(k.errors,a,n),p+g>0&&this.renderCollapsible(k.problems,a,[...i,...s],u?`${u}-problems`:null),c>0&&this.renderCollapsible(k.improvements,a,t),h>0&&this.renderCollapsible(k.considerations,a,o),m>0&&this.renderCollapsible(k.goodResults,a,r)]})}}$.propTypes={onMarkButtonClick:H().func,onEditButtonClick:H().func,problemsResults:H().array,improvementsResults:H().array,goodResults:H().array,considerationsResults:H().array,errorsResults:H().array,upsellResults:H().array,headingLevel:H().number,marksButtonStatus:H().string,marksButtonClassName:H().string,markButtonFactory:H().func,editButtonClassName:H().string,activeMarker:H().string,isPremium:H().bool,resultCategoryLabels:H().shape({errors:H().string,problems:H().string,improvements:H().string,considerations:H().string,goodResults:H().string}),onResultChange:H().func,shouldUpsellHighlighting:H().bool,renderHighlightingUpsell:H().func,renderAIOptimizeButton:H().func,id:H().string},$.defaultProps={onMarkButtonClick:()=>{},onEditButtonClick:()=>{},problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[],errorsResults:[],upsellResults:[],headingLevel:4,marksButtonStatus:"enabled",marksButtonClassName:"",markButtonFactory:null,editButtonClassName:"",activeMarker:"",isPremium:!1,resultCategoryLabels:{},onResultChange:()=>{},shouldUpsellHighlighting:!1,renderHighlightingUpsell:()=>{},renderAIOptimizeButton:()=>{},id:""};const F=$,U=u().div` `,W=u().p` font-size: 14px; `,G=({className:e="seo-assessment",seoAssessmentText:s="SEO Assessment",seoAssessmentItems:t=null,barHeight:r="24px"})=>(0,C.jsxs)(U,{className:e,children:[(0,C.jsx)(W,{className:`${e}__text`,children:s}),(0,C.jsx)(d.StackedProgressBar,{className:"progress",items:t,barHeight:r}),(0,C.jsx)(d.ScoreAssessments,{className:"assessments",items:t})]})})(),(window.yoast=window.yoast||{}).analysisReport=r})();
Save File
Cancel