1 line
4.7 KiB
JavaScript
1 line
4.7 KiB
JavaScript
|
(window.__wcAdmin_webpackJsonp=window.__wcAdmin_webpackJsonp||[]).push([[50],{525:function(e,t,r){"use strict";r.d(t,"b",(function(){return d})),r.d(t,"a",(function(){return u}));var a=r(9),n=r.n(a),o=r(4),c=r(19),s=r(11),i=r(12),l=r(120),m=r(13);const d=({indicator:e,primaryData:t,secondaryData:r,currency:a,formatAmount:n,persistedQuery:c})=>{const s=Object(o.find)(t.data,t=>t.stat===e.stat),d=Object(o.find)(r.data,t=>t.stat===e.stat);if(!s||!d)return{};const u=s._links&&s._links.report[0]&&s._links.report[0].href||"",p=function(e,t,r){return e?"/jetpack"===e?Object(m.e)("admin.php?page=jetpack#/dashboard"):Object(i.getNewPath)(t,e,{chart:r.chart}):""}(u,c,s),b="/jetpack"===u?"wp-admin":"wc-admin",f="currency"===s.format,y=Object(l.calculateDelta)(s.value,d.value);return{primaryValue:f?n(s.value):Object(l.formatValue)(a,s.format,s.value),secondaryValue:f?n(d.value):Object(l.formatValue)(a,d.format,d.value),delta:y,reportUrl:p,reportUrlType:b}},u=(e,t,r,a)=>{const{getReportItems:o,getReportItemsError:i,isResolving:l}=e(s.REPORTS_STORE_NAME),{woocommerce_default_date_range:m}=e(s.SETTINGS_STORE_NAME).getSetting("wc_admin","wcAdminSettings"),d=Object(c.getCurrentDates)(r,m),u=d.primary.before,p=d.secondary.before,b=t.map(e=>e.stat).join(","),f=Object(s.getFilterQuery)({filters:a,query:r}),y={...f,after:Object(c.appendTimestamp)(d.primary.after,"start"),before:Object(c.appendTimestamp)(u,u.isSame(n()(),"day")?"now":"end"),stats:b},g={...f,after:Object(c.appendTimestamp)(d.secondary.after,"start"),before:Object(c.appendTimestamp)(p,p.isSame(n()(),"day")?"now":"end"),stats:b};return{primaryData:o("performance-indicators",y),primaryError:i("performance-indicators",y)||null,primaryRequesting:l("getReportItems",["performance-indicators",y]),secondaryData:o("performance-indicators",g),secondaryError:i("performance-indicators",g)||null,secondaryRequesting:l("getReportItems",["performance-indicators",g]),defaultDateRange:m}}},603:function(e,t,r){},610:function(e,t,r){"use strict";r.r(t);var a=r(0),n=r(2),o=r(14),c=r(12),s=r(13),i=r(7),l=r(11),m=r(21),d=r(19),u=r(16),p=(r(603),r(501)),b=r(525);const{performanceIndicators:f}=Object(s.f)("dataEndpoints",{performanceIndicators:[]});class y extends a.Component{renderMenu(){const{hiddenBlocks:e,isFirst:t,isLast:r,onMove:o,onRemove:c,onTitleBlur:s,onTitleChange:i,onToggleHiddenBlock:l,titleInput:d,controls:p}=this.props;return Object(a.createElement)(m.EllipsisMenu,{label:Object(n.__)("Choose which analytics to display and the section name",'woocommerce'),renderContent:({onToggle:b})=>Object(a.createElement)(a.Fragment,null,Object(a.createElement)(m.MenuTitle,null,Object(n.__)("Display stats:",'woocommerce')),f.map((t,r)=>{const n=!e.includes(t.stat);return Object(a.createElement)(m.MenuItem,{checked:n,isCheckbox:!0,isClickable:!0,key:r,onInvoke:()=>{l(t.stat)(),Object(u.recordEvent)("dash_indicators_toggle",{status:n?"off":"on",key:t.stat})}},t.label)}),Object(a.createElement)(p,{onToggle:b,onMove:o,onRemove:c,isFirst:t,isLast:r,onTitleBlur:s,onTitleChange:i,titleInput:d}))})}renderList(){const{query:e,primaryRequesting:t,secondaryRequesting:r,primaryError:o,secondaryError:s,primaryData:i,secondaryData:l,userIndicators:p,defaultDateRange:f}=this.props;if(t||r)return Object(a.createElement)(m.SummaryListPlaceholder,{numberOfItems:p.length});if(o||s)return null;const y=Object(c.getPersistedQuery)(e),{compare:g}=Object(d.getDateParamsFromQuery)(e,f),O="previous_period"===g?Object(n.__)("Previous period:",'woocommerce'):Object(n.__)("Previous year:",'woocommerce'),{formatAmount:j,getCurrencyConfig:_}=this.context,h=_();return Object(a.createElement)(m.SummaryList,null,()=>p.map((e,t)=>{const{primaryValue:r,secondaryValue:n,delta:o,reportUrl:c,reportUrlType:s}=Object(b.b)({indicator:e,primaryData:i,secondaryData:l,currency:h,formatAmount:j,persistedQuery:y});return Object(a.createElement)(m.SummaryNumber,{key:t,href:c,hrefType:s,label:e.label,value:r,prevLabel:O,prevValue:n,delta:o,onLinkClickCallback:()=>{Object(u.recordEvent)("dash_indicators_click",{key:e.stat})}})}))}render(){const{userI
|