90 lines
31 KiB
JavaScript
90 lines
31 KiB
JavaScript
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=299)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},102:function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"c",(function(){return y})),n.d(t,"b",(function(){return w}));var r=n(0),o=n(2),a=n.n(o),s=n(1),i=n(4),c=n(86),l=n.n(c),u=n(8),p=n(9),d=n(79),h=()=>Object(r.createElement)("p",{className:"yoast-wincher-seo-performance-modal__loading-message"},Object(s.__)("Tracking the ranking position...","wordpress-seo")," ",Object(r.createElement)(u.SvgIcon,{icon:"loading-spinner"}));const b=Object(p.makeOutboundLink)();function m(e){return Math.round(100*e)}function f(e){let{chartData:t}=e;if(Object(i.isEmpty)(t)||Object(i.isEmpty)(t.position))return"?";const n=function(e){return Array.from({length:e.position.history.length},(e,t)=>t+1).map(e=>Object(s.sprintf)(Object(s._n)("%d day","%d days",e,"wordpress-seo"),e))}(t),o=t.position.history.map((e,t)=>({x:t,y:101-e.value}));return Object(r.createElement)(d.a,{width:66,height:24,data:o,strokeWidth:1.8,strokeColor:"#498afc",fillColor:"#ade3fc",className:"yoast-related-keyphrases-modal__chart",mapChartDataToTableData:m,dataTableCaption:Object(s.__)("Keyphrase position in the last 90 days on a scale from 0 to 100.","wordpress-seo"),dataTableHeaderLabels:n})}function y(e){return!e||!e.position||e.position.value>100?"> 100":e.position.value}function w(e){const{keyphrase:t,rowData:n,onTrackKeyphrase:o,onUntrackKeyphrase:a,isFocusKeyphrase:c,isDisabled:p,isLoading:d}=e,m=!Object(i.isEmpty)(n),w=Object(r.useCallback)(()=>{p||(m?a(t,n.id):o(t))},[t,o,a,m,n,p]);return Object(r.createElement)("tr",null,Object(r.createElement)("td",{className:"yoast-table--nopadding"},function(e){let{keyphrase:t,isEnabled:n,toggleAction:o,isLoading:a}=e;return a?Object(r.createElement)(u.SvgIcon,{icon:"loading-spinner"}):Object(r.createElement)(u.Toggle,{id:"toggle-keyphrase-tracking-"+t,className:"wincher-toggle",isEnabled:n,onSetToggleState:o,showToggleStateLabel:!1})}({keyphrase:t,isEnabled:m,toggleAction:w,isLoading:d})),Object(r.createElement)("td",null,t,c&&Object(r.createElement)("span",null,"*")),function(e){const{rowData:t,websiteId:n}=e,o=!Object(i.isEmpty)(t),a=t&&t.updated_at&&l()(t.updated_at)>=l()().subtract(7,"days"),c=t?Object(s.sprintf)("https://app.wincher.com/websites/%s/keywords?serp=%s&utm_medium=plugin&utm_source=yoast&referer=yoast&partner=yoast",n,t.id):null;return o?a?Object(r.createElement)(r.Fragment,null,Object(r.createElement)("td",null,y(t)),Object(r.createElement)("td",{className:"yoast-table--nopadding"},Object(r.createElement)(f,{chartData:t})),Object(r.createElement)("td",{className:"yoast-table--nobreak"},Object(r.createElement)(b,{href:c},Object(s.__)("View","wordpress-seo")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("td",{className:"yoast-table--nopadding",colSpan:"3"},Object(r.createElement)(h,null))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("td",null,"?"),Object(r.createElement)("td",{className:"yoast-table--nopadding"},"?"),Object(r.createElement)("td",{className:"yoast-table--nobreak"}))}(e))}f.propTypes={chartData:a.a.object},f.defaultProps={chartData:{}},w.propTypes={row
|
|||
|
color: ${b.colors.$color_pink_dark};
|
|||
|
font-size: 14px;
|
|||
|
font-weight: 700;
|
|||
|
margin: 13px 0 10px;
|
|||
|
`,w=i()(h.SvgIcon)`
|
|||
|
margin-right: 5px;
|
|||
|
vertical-align: middle;
|
|||
|
`,g=i.a.button`
|
|||
|
position: absolute;
|
|||
|
top: 9px;
|
|||
|
right: 9px;
|
|||
|
border: none;
|
|||
|
background: none;
|
|||
|
cursor: pointer;
|
|||
|
`,j=i.a.p`
|
|||
|
font-size: 13px;
|
|||
|
font-weight: 500;
|
|||
|
margin: 10px 0 13px;
|
|||
|
`,O=i.a.div`
|
|||
|
position: relative;
|
|||
|
background: ${e=>e.isTitleShortened?"#F5F7F7":"transparent"};
|
|||
|
border: 1px solid #C7C7C7;
|
|||
|
border-left: 4px solid${b.colors.$color_pink_dark};
|
|||
|
padding: 0 16px;
|
|||
|
margin-bottom: 1.5em;
|
|||
|
`,v=e=>{let{limit:t,usage:n,isTitleShortened:r,isFreeAccount:o}=e;const s=Object(d.sprintf)(
|
|||
|
/* Translators: %1$s expands to the number of used keywords.
|
|||
|
* %2$s expands to the account keywords limit.
|
|||
|
*/
|
|||
|
Object(d.__)("Your are tracking %1$s out of %2$s keyphrases included in your free account.","wordpress-seo"),n,t),i=Object(d.sprintf)(
|
|||
|
/* Translators: %1$s expands to the number of used keywords.
|
|||
|
* %2$s expands to the account keywords limit.
|
|||
|
*/
|
|||
|
Object(d.__)("Your are tracking %1$s out of %2$s keyphrases included in your account.","wordpress-seo"),n,t),c=o?s:i,l=Object(d.sprintf)(
|
|||
|
/* Translators: %1$s expands to the number of used keywords.
|
|||
|
* %2$s expands to the account keywords limit.
|
|||
|
*/
|
|||
|
Object(d.__)("Keyphrases tracked: %1$s/%2$s","wordpress-seo"),n,t),u=r?l:c;return Object(a.createElement)(y,null,r&&Object(a.createElement)(w,{icon:"exclamation-triangle",color:b.colors.$color_pink_dark,size:"14px"}),u)};v.propTypes={limit:p.a.number.isRequired,usage:p.a.number.isRequired,isTitleShortened:p.a.bool,isFreeAccount:p.a.bool};const E=Object(m.makeOutboundLink)(),k=e=>{let{discount:t,months:n}=e;const r=Object(a.createElement)(E,{href:wpseoAdminGlobalL10n["links.wincher.upgrade"],style:{fontWeight:600}},Object(d.sprintf)(
|
|||
|
/* Translators: %s : Expands to "Wincher". */
|
|||
|
Object(d.__)("Click here to upgrade your %s plan","wordpress-seo"),"Wincher"));if(!t||!n)return Object(a.createElement)(j,null,r);const o=100*t,s=Object(d.sprintf)(
|
|||
|
/* Translators: %1$s expands to upgrade account link.
|
|||
|
* %2$s expands to the upgrade discount value.
|
|||
|
* %3$s expands to the upgrade discount duration e.g. 2 months.
|
|||
|
*/
|
|||
|
Object(d.__)("%1$s and get an exclusive %2$s discount for %3$s month(s).","wordpress-seo"),"{{wincherAccountUpgradeLink/}}",o+"%",n);return Object(a.createElement)(j,null,l()({mixedString:s,components:{wincherAccountUpgradeLink:r}}))};k.propTypes={discount:p.a.number,months:p.a.number};const _=e=>{let{onClose:t,isTitleShortened:n}=e;const r=(()=>{const[e,t]=Object(a.useState)(null);return Object(a.useEffect)(()=>{e||Object(f.b)().then(e=>t(e))},[e]),e})(),s=(()=>{const[e,t]=Object(a.useState)(null);return Object(a.useEffect)(()=>{e||Object(f.e)().then(e=>t(e))},[e]),e})();if(null===r)return null;const{limit:i,usage:c}=r;if(!(i&&c/i>=.8))return null;const l=Boolean(null==s?void 0:s.discount);return Object(a.createElement)(O,{isTitleShortened:n},t&&Object(a.createElement)(g,{"aria-label":Object(d.__)("Close the upgrade callout","wordpress-seo"),onClick:t},Object(a.createElement)(h.SvgIcon,{icon:"times-circle",color:b.colors.$color_pink_dark,size:"14px"})),Object(a.createElement)(v,o()({},r,{isTitleShortened:n,isFreeAccount:l})),Object(a.createElement)(k,{discount:null==s?void 0:s.discount,months:null==s?void 0:s.months}))};_.propTypes={onClose:p.a.func,isTitleShortened:p.a.bool},t.a=_},109:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));class r{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.url=e,this.origin=new URL(e).origin,this.eventHandlers=Object.assign({success:{type:"",callback:()=>{}},error:{type:"",callback:()=>{}}},t),this.options=Object.assign({height:570,width:340,title:""},n),this.popup=null,this.createPopup=this.createPopup.bind(this),this.messageHandler=this.messageHandler.bind(this),this.getPopup=this.getPopup.bind(this)}createPopup(){const{height:e,width:t,title:n}=this.options,r=["top="+(window.top.outerHeight/2+window.top.screenY-e/2),"left="+(window.top.outerWidth/2+window.top.screenX-t/2),"width="+t,"height="+e,"resizable=1","scrollbars=1","status=0"];this.popup&&!this.popup.closed||(this.popup=window.open(this.url,n,r.join(","))),this.popup&&this.popup.focus(),window.addEventListener("message",this.messageHandler,!1)}async messageHandler(e){const{data:t,source:n,origin:r}=e;r===this.origin&&this.popup===n&&(t.type===this.eventHandlers.success.type&&(this.popup.close(),window.removeEventListener("message",this.messageHandler,!1),await this.eventHandlers.success.callback(t)),t.type===this.eventHandlers.error.type&&(this.popup.close(),window.removeEventListener("message",this.messageHandler,!1),await this.eventHandlers.error.callback(t)))}getPopup(){return this.popup}isClosed(){return!this.popup||this.popup.closed}focus(){this.isClosed()||this.popup.focus()}}},11:function(e,t){e.exports=window.yoast.styledComponents},110:function(e,t,n){"use strict";var r=n(0),o=n(2),a=n.n(o),s=n(1),i=n(28),c=n.n(i),l=n(8);const u=e=>{const t=Object(s.sprintf)(
|
|||
|
/* translators: %s expands to a link to open the Wincher login popup. */
|
|||
|
Object(s.__)("It seems like something went wrong when retrieving your website's data. Please %s and try again.","wordpress-seo"),"{{reconnectToWincher/}}","Wincher");return Object(r.createElement)(l.Alert,{type:"error",className:e.className},c()({mixedString:t,components:{reconnectToWincher:Object(r.createElement)("a",{href:"#",onClick:t=>{t.preventDefault(),e.onReconnect()}},Object(s.sprintf)(
|
|||
|
/* translators: %s : Expands to "Wincher". */
|
|||
|
Object(s.__)("reconnect to %s","wordpress-seo"),"Wincher"))}}))};u.propTypes={onReconnect:a.a.func.isRequired,className:a.a.string},u.defaultProps={className:""},t.a=u},12:function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},127:function(e,t,n){"use strict";var r=n(3),o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,a=n(93),s=n(128),i=n(129),c="function"==typeof Symbol&&Symbol.iterator;function l(e,t){return e&&"object"==typeof e&&null!=e.key?(n=e.key,r={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,(function(e){return r[e]}))):t.toString(36);var n,r}var u=/\/+/g;function p(e){return(""+e).replace(u,"$&/")}var d,h,b=m,m=function(e){if(this.instancePool.length){var t=this.instancePool.pop();return this.call(t,e),t}return new this(e)};function f(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function y(e,t,n){var o,s,i=e.result,c=e.keyPrefix,l=e.func,u=e.context,d=l.call(u,t,e.count++);Array.isArray(d)?w(d,i,n,a.thatReturnsArgument):null!=d&&(r.isValidElement(d)&&(o=d,s=c+(!d.key||t&&t.key===d.key?"":p(d.key)+"/")+n,d=r.cloneElement(o,{key:s},void 0!==o.props?o.props.children:void 0)),i.push(d))}function w(e,t,n,r,a){var i="";null!=n&&(i=p(n)+"/");var u=f.getPooled(t,i,r,a);!function(e,t,n){null==e||function e(t,n,r,a){var i,u=typeof t;if("undefined"!==u&&"boolean"!==u||(t=null),null===t||"string"===u||"number"===u||"object"===u&&t.$$typeof===o)return r(a,t,""===n?"."+l(t,0):n),1;var p=0,d=""===n?".":n+":";if(Array.isArray(t))for(var h=0;h<t.length;h++)p+=e(i=t[h],d+l(i,h),r,a);else{var b=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(t);if(b)for(var m,f=b.call(t),y=0;!(m=f.next()).done;)p+=e(i=m.value,d+l(i,y++),r,a);else if("object"===u){var w=""+t;s(!1,"Objects are not valid as a React child (found: %s).%s","[object Object]"===w?"object with keys {"+Object.keys(t).join(", ")+"}":w,"")}}return p}(e,"",t,n)}(e,y,u),f.release(u)}f.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},d=function(e,t,n,r){if(this.instancePool.length){var o=this.instancePool.pop();return this.call(o,e,t,n,r),o}return new this(e,t,n,r)},(h=f).instancePool=[],h.getPooled=d||b,h.poolSize||(h.poolSize=10),h.release=function(e){s(e instanceof this,"Trying to release an instance into a pool of a different type."),e.destructor(),this.instancePool.length<this.poolSize&&this.instancePool.push(e)},e.exports=function(e){if("object"!=typeof e||!e||Array.isArray(e))return i(!1,"React.addons.createFragment only accepts a single object. Got: %s",e),e;if(r.isValidElement(e))return i(!1,"React.addons.createFragment does not accept a ReactElement without a wrapper object."),e;s(1!==e.nodeType,"React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.");var t=[];for(var n in e)w(e[n],t,n,a.thatReturnsArgument);return t}},128:function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,a,s,i){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,a,s,i],u=0;(c=new Error(t.replace(/%s/g,(function(){return l[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}},129:function(e,t,n){"use strict";var r=n(93);e.exports=r},130:function(e,t,n){"use strict";function r(e){return e.match(/^\{\{\//)?{type:"componentClose",value:e.replace(/\W/g,"")}:e.match(/\/\}\}$/)?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.match(/^\{\{/)?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}e.exports=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(r)}},19:function(e,t){e.exports=window.yoast.styleGu
|
|||
|
/* translators: %s: Expands to "Wincher". */
|
|||
|
Object(u.__)('Your %s account does not contain any keyphrases for this website yet. You can track keyphrases by using the "Track SEO Performance" button in the post editor.',"wordpress-seo"),"Wincher"));f.propTypes={className:i.a.string},f.defaultProps={className:""};var y=f,w=n(102),g=n(110),j=n(108);const O=Object(b.makeOutboundLink)(),v=Object(b.makeOutboundLink)(),E=Object(b.makeOutboundLink)(),k=Object(b.makeOutboundLink)(),_=l.a.div`
|
|||
|
& .wincher-performance-report-alert {
|
|||
|
margin-bottom: 1em;
|
|||
|
}
|
|||
|
`,T=l.a.table`
|
|||
|
pointer-events: none;
|
|||
|
user-select: none;
|
|||
|
`,x=l.a.div`
|
|||
|
position: relative;
|
|||
|
width: 100%;
|
|||
|
overflow-y: auto;
|
|||
|
`,C=l.a.div`
|
|||
|
margin: 0;
|
|||
|
-webkit-filter: blur(4px);
|
|||
|
-moz-filter: blur(4px);
|
|||
|
-o-filter: blur(4px);
|
|||
|
-ms-filter: blur(4px);
|
|||
|
filter: blur(4px);
|
|||
|
`,S=l.a.p`
|
|||
|
top: 47%;
|
|||
|
left: 50%;
|
|||
|
position: absolute;
|
|||
|
`,D=e=>{const{websiteId:t,id:n}=e;return Object(u.sprintf)("https://app.wincher.com/websites/%s/keywords?serp=%s&utm_medium=plugin&utm_source=yoast&referer=yoast&partner=yoast",t,n)},R=e=>{const{isLoggedIn:t,onConnectAction:n}=e;return t?null:Object(r.createElement)(S,null,Object(r.createElement)(m.NewButton,{onClick:n,variant:"primary",style:{left:"-50%",backgroundColor:"#2371B0"}},Object(u.sprintf)(
|
|||
|
/* translators: %s expands to Wincher */
|
|||
|
Object(u.__)("Connect with %s","wordpress-seo"),"Wincher")))};R.propTypes={isLoggedIn:i.a.bool.isRequired,onConnectAction:i.a.func.isRequired};const N=e=>{let{isBlurred:t,children:n}=e;return t?Object(r.createElement)("td",null,Object(r.createElement)(C,null,n)):Object(r.createElement)("td",null,n)};N.propTypes={isBlurred:i.a.bool,children:i.a.oneOfType([i.a.string,i.a.number,i.a.object])};const P=e=>{let{keyphrase:t,websiteId:n,isBlurred:o}=e;const{id:a,keyword:s}=t;return Object(r.createElement)("tr",null,Object(r.createElement)(N,{isBlurred:o},s),Object(r.createElement)(N,{isBlurred:o},Object(w.c)(t)),Object(r.createElement)(N,{isBlurred:o,className:"yoast-table--nopadding"},Object(r.createElement)(w.a,{chartData:t})),Object(r.createElement)(N,{isBlurred:o,className:"yoast-table--nobreak"},Object(r.createElement)(O,{href:D({websiteId:n,id:a})},Object(u.__)("View","wordpress-seo"))))};P.propTypes={keyphrase:i.a.object.isRequired,websiteId:i.a.string.isRequired,isBlurred:i.a.bool};const L=()=>Object(r.createElement)(m.Alert,{type:"error",className:"wincher-performance-report-alert"},Object(u.sprintf)(Object(u.__)("Network Error: Unable to connect to the server. Please check your internet connection and try again later.","wordpress-seo"))),I=e=>{const{data:t}=e;return!Object(p.isEmpty)(t)&&Object(p.isEmpty)(t.results)?Object(r.createElement)(m.Alert,{type:"success",className:"wincher-performance-report-alert"},Object(u.sprintf)(
|
|||
|
/* translators: %1$s and %2$s: Expands to "Wincher". */
|
|||
|
Object(u.__)('You have successfully connected with %1$s. Your %2$s account does not contain any keyphrases for this website yet. You can track keyphrases by using the "Track SEO Performance" button in the post editor.',"wordpress-seo"),"Wincher","Wincher")):Object(r.createElement)(m.Alert,{type:"success",className:"wincher-performance-report-alert"},Object(u.sprintf)(
|
|||
|
/* translators: %s: Expands to "Wincher". */
|
|||
|
Object(u.__)("You have successfully connected with %s.","wordpress-seo"),"Wincher"))};I.propTypes={data:i.a.object.isRequired};const A=e=>{const{data:t,onConnectAction:n,isConnectSuccess:o,isNetworkError:a,isFailedRequest:s}=e;return a?Object(r.createElement)(L,{data:t}):o?Object(r.createElement)(I,{data:t}):s?Object(r.createElement)(g.a,{onReconnect:n,className:"wincher-performance-report-alert"}):null};A.propTypes={data:i.a.object.isRequired,onConnectAction:i.a.func.isRequired,isConnectSuccess:i.a.bool.isRequired,isNetworkError:i.a.bool.isRequired,isFailedRequest:i.a.bool.isRequired};const q=e=>{const{data:t,isNetworkError:n,isConnectSuccess:o}=e,s=(e=>e&&[401,403,404].includes(e.status))(t);return n||o||s?Object(r.createElement)(A,a()({},e,{isFailedRequest:s})):!t||Object(p.isEmpty)(t.results)?Object(r.createElement)(y,{className:"wincher-performance-report-alert"}):null};q.propTypes={data:i.a.object.isRequired,onConnectAction:i.a.func.isRequired,isConnectSuccess:i.a.bool.isRequired,isNetworkError:i.a.bool.isRequired};const W=e=>{let{isLoggedIn:t}=e;const n=Object(u.sprintf)(
|
|||
|
/* translators: %s expands to a link to Wincher login */
|
|||
|
Object(u.__)("This overview only shows you keyphrases added to Yoast SEO. There may be other keyphrases added to your %s.","wordpress-seo"),"{{wincherAccountLink/}}"),o=Object(u.sprintf)(
|
|||
|
/* translators: %s expands to a link to Wincher login */
|
|||
|
Object(u.__)("This overview will show you your top performing keyphrases in Google. Connect with %s to get started.","wordpress-seo"),"{{wincherLink/}}"),a=t?n:o;return Object(r.createElement)("p",null,h()({mixedString:a,components:{wincherAccountLink:Object(r.createElement)(E,{href:wpseoAdminGlobalL10n["links.wincher.login"]},Object(u.sprintf)(
|
|||
|
/* translators: %s : Expands to "Wincher". */
|
|||
|
Object(u.__)("%s account","wordpress-seo"),"Wincher")),wincherLink:Object(r.createElement)(k,{href:wpseoAdminGlobalL10n["links.wincher.about"]},Object(u.sprintf)(
|
|||
|
/* translators: %s : Expands to "Wincher". */
|
|||
|
Object(u.__)("%s","wordpress-seo"),"Wincher"))}}))};W.propTypes={isLoggedIn:i.a.bool.isRequired};const $={results:[{id:0,keyword:"wincher",position:{value:84,history:[{value:90},{value:89},{value:94},{value:98},{value:84}]}},{id:1,keyword:"rank tracker",position:{value:20,history:[{value:50},{value:30},{value:66},{value:15},{value:20}]}},{id:2,keyword:"performance",position:{value:2,history:[{value:44},{value:66},{value:18},{value:31},{value:2}]}}]},F=e=>{let{isBlurred:t,children:n}=e;return t?Object(r.createElement)(T,{className:"yoast yoast-table"},n):Object(r.createElement)("table",{className:"yoast yoast-table"},n)};F.propTypes={isBlurred:i.a.bool,children:i.a.any};const H=e=>{const{className:t,websiteId:n,isLoggedIn:o,onConnectAction:s,isConnectSuccess:i}=e,c=o?e.data:$,l=!o,d=(e=>e&&!Object(p.isEmpty)(e)&&!Object(p.isEmpty)(e.results))(c);return Object(r.createElement)(_,{className:t},o&&Object(r.createElement)(j.a,{isTitleShortened:!0}),Object(r.createElement)(q,a()({},e,{data:c,isConnectSuccess:i&&o})),d&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(W,{isLoggedIn:o}),Object(r.createElement)(x,null,Object(r.createElement)(F,{isBlurred:l},Object(r.createElement)("thead",null,Object(r.createElement)("tr",null,Object(r.createElement)("th",{scope:"col",abbr:Object(u.__)("Keyphrase","wordpress-seo")},Object(u.__)("Keyphrase","wordpress-seo")),Object(r.createElement)("th",{scope:"col",abbr:Object(u.__)("Position","wordpress-seo")},Object(u.__)("Position","wordpress-seo")),Object(r.createElement)("th",{scope:"col",abbr:Object(u.__)("Position over time","wordpress-seo")},Object(u.__)("Position over time","wordpress-seo")),Object(r.createElement)("td",{className:"yoast-table--nobreak"}))),Object(r.createElement)("tbody",null,Object(p.map)(c.results,(e,t)=>Object(r.createElement)(P,{key:"keyphrase-"+t,keyphrase:e,websiteId:n,isBlurred:l})))),Object(r.createElement)(R,{isLoggedIn:o,onConnectAction:s})),Object(r.createElement)("p",{style:{marginBottom:0,position:"relative"}},Object(r.createElement)(v,{href:wpseoAdminGlobalL10n["links.wincher.login"]},Object(u.sprintf)(
|
|||
|
/* translators: %s expands to Wincher */
|
|||
|
Object(u.__)("Get more insights over at %s","wordpress-seo"),"Wincher")))))};H.propTypes={className:i.a.string,data:i.a.object.isRequired,websiteId:i.a.string.isRequired,isLoggedIn:i.a.bool.isRequired,isConnectSuccess:i.a.bool.isRequired,isNetworkError:i.a.bool.isRequired,onConnectAction:i.a.func.isRequired},H.defaultProps={className:"wincher-seo-performance"};var B=H,M=n(34),K=n(109);class V extends r.Component{constructor(){super(),this.state={wincherData:{},wincherWebsiteId:wpseoWincherDashboardWidgetL10n.wincher_website_id,wincherIsLoggedIn:"1"===wpseoWincherDashboardWidgetL10n.wincher_is_logged_in,isDataFetched:!1,isConnectSuccess:!1,isNetworkError:!1},this.onConnect=this.onConnect.bind(this),this.getWincherData=this.getWincherData.bind(this),this.performAuthenticationRequest=this.performAuthenticationRequest.bind(this),this.onConnectSuccess=this.onConnectSuccess.bind(this),this.onNetworkDisconnectionError=this.onNetworkDisconnectionError.bind(this)}componentDidMount(){const e=jQuery("#wpseo-wincher-dashboard-overview-hide");e.is(":checked")&&this.fetchData(),e.on("click",()=>{this.fetchData()})}fetchData(){this.state.isDataFetched||(this.state.wincherIsLoggedIn&&this.getWincherData(),this.setState({isDataFetched:!0}))}async getWincherData(){const e=await Object(M.d)();if(200===e.status){const t=Object(p.filter)(e.results,e=>!Object(p.isEmpty)(e.position)),n=Object(p.sortBy)(t,e=>e.position.value).splice(0,5);this.setState({wincherData:{results:n,status:e.status}})}else this.setState({wincherData:{results:[],status:e.status}})}async performAuthenticationRequest(e){if(200!==(await Object(M.a)(e)).status)return;this.setState({wincherIsLoggedIn:!0,wincherWebsiteId:e.websiteId.toString()}),await this.getWincherData();const t=this.loginPopup.getPopup();t&&t.close()}async onConnectSuccess(e){this.setState({isConnectSuccess:!0,isNetworkError:!1}),await this.performAuthenticationRequest(e)}async onNetworkDisconnectionError(){this.setState({isConnectSuccess:!1,isNetworkError:!0})}async onConnect(){if(this.loginPopup&&!this.loginPopup.isClosed())return void this.loginPopup.focus();const{url:e}=await Object(M.c)();e&&void 0!==e?(this.loginPopup=new K.a(e,{success:{type:"wincher:oauth:success",callback:e=>this.onConnectSuccess(e)},error:{type:"wincher:oauth:error",callback:()=>{}}},{title:"Wincher_login",width:500,height:700}),this.loginPopup.createPopup()):this.onNetworkDisconnectionError()}render(){return Object(r.createElement)(B,{key:"wincher-performance-report",data:this.state.wincherData,websiteId:this.state.wincherWebsiteId,isLoggedIn:this.state.wincherIsLoggedIn,isConnectSuccess:this.state.isConnectSuccess,isNetworkError:this.state.isNetworkError,onConnectAction:this.onConnect})}}const G=document.getElementById("yoast-seo-wincher-dashboard-widget");G&&Object(r.render)(Object(r.createElement)(V,null),G)},3:function(e,t){e.exports=window.React},34:function(e,t,n){"use strict";n.d(t,"c",(function(){return a})),n.d(t,"b",(function(){return s})),n.d(t,"e",(function(){return i})),n.d(t,"a",(function(){return c})),n.d(t,"d",(function(){return l})),n.d(t,"f",(function(){return u})),n.d(t,"g",(function(){return p}));var r=n(4),o=n(29);async function a(){return await Object(o.a)({path:"yoast/v1/wincher/authorization-url",method:"GET"})}async function s(){return await Object(o.a)({path:"yoast/v1/wincher/account/limit",method:"GET"})}async function i(){return await Object(o.a)({path:"yoast/v1/wincher/account/upgrade-campaign",method:"GET"})}async function c(e){const{code:t,websiteId:n}=e;return await Object(o.a)({path:"yoast/v1/wincher/authenticate",method:"POST",data:{code:t,websiteId:n}})}async function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;return await Object(o.a)({path:"yoast/v1/wincher/keyphrases",method:"POST",data:{keyphrases:e,permalink:t},signal:n})}async function u(e){return Object(r.isArray)(e)||(e=[e]),await Object(o.a)({path:"yoast/v1/wincher/keyphrases/track",method:"POST",data:{keyph
|