(window.__wcAdmin_webpackJsonp=window.__wcAdmin_webpackJsonp||[]).push([[14],{586:function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return x}));r(64);var n=r(22),a=r.n(n),o=r(23),c=r.n(o),u=r(24),i=r.n(u),s=r(25),l=r.n(s),m=r(14),d=r.n(m),f=r(0),b=r(1),p=r.n(b),y=r(634),v=r(603),_=r(18),h=r.n(_),O=(r(187),r(139),r(51),r(129),r(2)),j=r(5),g=r(145),w=r(281),R=r(85),k=r(50),q=r(101),C=r(606),S=r(598);r(677);function E(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var a=d()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return l()(this,r)}}var L=function(e){i()(r,e);var t=E(r);function r(){var e;return a()(this,r),(e=t.call(this)).getHeadersContent=e.getHeadersContent.bind(h()(e)),e.getRowsContent=e.getRowsContent.bind(h()(e)),e.getSummary=e.getSummary.bind(h()(e)),e}return c()(r,[{key:"getHeadersContent",value:function(){return[{label:Object(O.__)("Date",'woocommerce'),key:"date",required:!0,defaultSort:!0,isLeftAligned:!0,isSortable:!0},{label:Object(O.__)("Order #",'woocommerce'),screenReaderLabel:Object(O.__)("Order Number",'woocommerce'),key:"order_number",required:!0},{label:Object(O.__)("Status",'woocommerce'),key:"status",required:!1,isSortable:!1},{label:Object(O.__)("Customer",'woocommerce'),key:"customer_id",required:!1,isSortable:!1},{label:Object(O.__)("Customer Type",'woocommerce'),key:"customer_type",required:!1,isSortable:!1},{label:Object(O.__)("Product(s)",'woocommerce'),screenReaderLabel:Object(O.__)("Products",'woocommerce'),key:"products",required:!1,isSortable:!1},{label:Object(O.__)("Items Sold",'woocommerce'),key:"num_items_sold",required:!1,isSortable:!0,isNumeric:!0},{label:Object(O.__)("Coupon(s)",'woocommerce'),screenReaderLabel:Object(O.__)("Coupons",'woocommerce'),key:"coupons",required:!1,isSortable:!1},{label:Object(O.__)("Net Sales",'woocommerce'),screenReaderLabel:Object(O.__)("Net Sales",'woocommerce'),key:"net_total",required:!0,isSortable:!0,isNumeric:!0}]}},{key:"getCustomerName",value:function(e){var t=e||{},r=t.first_name,n=t.last_name;return r||n?[r,n].join(" "):""}},{key:"getRowsContent",value:function(e){var t=this,r=this.props.query,n=Object(k.getPersistedQuery)(r),a=Object(R.g)("dateFormat",q.defaultTableDateFormat),o=this.context,c=o.render,u=o.getCurrencyConfig;return Object(j.map)(e,(function(e){var r,o=e.currency,i=e.date_created,s=e.net_total,l=e.num_items_sold,m=e.order_id,d=e.order_number,b=e.parent_id,p=e.status,y=e.customer_type,v=e.extended_info||{},_=v.coupons,h=v.customer,j=v.products.sort((function(e,t){return t.quantity-e.quantity})).map((function(e){return{label:e.name,quantity:e.quantity,href:Object(k.getNewPath)(n,"/analytics/products",{filter:"single_product",products:e.id})}})),q=_.map((function(e){return{label:e.code,href:Object(k.getNewPath)(n,"/analytics/coupons",{filter:"single_coupon",coupons:e.id})}}));return[{display:Object(f.createElement)(g.Date,{date:i,visibleFormat:a}),value:i},{display:Object(f.createElement)(g.Link,{href:"post.php?post="+(b||m)+"&action=edit"+(b?"#order_refunds":""),type:"wp-admin"},d),value:d},{display:Object(f.createElement)(g.OrderStatus,{className:"woocommerce-orders-table__status",order:{status:p},orderStatusMap:Object(R.g)("orderStatuses",{})}),value:p},{display:t.getCustomerName(h),value:t.getCustomerName(h)},{display:(r=y,r.charAt(0).toUpperCase()+r.slice(1)),value:y},{display:t.renderList(j.length?[j[0]]:[],j.map((function(e){return{label:Object(O.sprintf)(Object(O.__)("%s× %s",'woocommerce'),e.quantity,e.label),href:e.href}}))),value:j.map((function(e){var t=e.quantity,r=e.label;return Object(O.sprintf)(Object(O.__)("%s× %s",'woocommerce'),t,r)})).join(", ")},{display:Object(w.formatValue)(u(),"number",l),value:l},{display:t.renderList(q.length?[q[0]]:[],q),value:q.map((function(e){return e.label})).join(", ")},{display:c(s,o),value:s}]}))}},{key:"getSummary",value:function(e){var t=e.orders_count,r=void 0===t?0:t,n=e.total_customers,a=void 0===n?0:n,o=e.products,c=void 0===o?0:o,u=e.num_items_sold,i=void 0===u?0:u,s=e.coupons_count,l=void 0===s?0:s,m=e.net_revenue,d=void 0===m?0:m,f=this.context,b=f.formatAmount,p=(0,f.getCurrencyConfig)();return[{label:Object(O._n)("order","orders",r,'woocommerce'),value:Object(w.formatValue)(p,"number",r)},{label:Object(O._n)(" customer"," customers",a,'woocommerce'),value:Object(w.formatValue)(p,"number",a)},{label:Object(O._n)("product","products",c,'woocommerce'),value:Object(w.formatValue)(p,"number",c)},{label:Object(O._n)("item sold","items sold",i,'woocommerce'),value:Object(w.formatValue)(p,"number",i)},{label:Object(O._n)("coupon","coupons",l,'woocommerce'),value:Object(w.formatValue)(p,"number",l)},{label:Object(O.__)("net sales",'woocommerce'),value:b(d)}]}},{key:"renderLinks",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map((function(e,t){return Object(f.createElement)(g.Link,{href:e.href,key:t,type:"wc-admin"},e.label)}))}},{key:"renderList",value:function(e,t){return Object(f.createElement)(f.Fragment,null,this.renderLinks(e),t.length>1&&Object(f.createElement)(g.ViewMoreList,{items:this.renderLinks(t)}))}},{key:"render",value:function(){var e=this.props,t=e.query,r=e.filters,n=e.advancedFilters;return Object(f.createElement)(C.a,{endpoint:"orders",getHeadersContent:this.getHeadersContent,getRowsContent:this.getRowsContent,getSummary:this.getSummary,summaryFields:["orders_count","total_customers","products","num_items_sold","coupons_count","net_revenue"],query:t,tableQuery:{extended_info:!0},title:Object(O.__)("Orders",'woocommerce'),columnPrefsKey:"orders_report_columns",filters:r,advancedFilters:n})}}]),r}(f.Component);L.contextType=S.a;var P=L,N=r(602),V=r(604),F=r(605);function D(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var a=d()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return l()(this,r)}}var x=function(e){i()(r,e);var t=D(r);function r(){return a()(this,r),t.apply(this,arguments)}return c()(r,[{key:"render",value:function(){var e=this.props,t=e.path,r=e.query;return Object(f.createElement)(f.Fragment,null,Object(f.createElement)(F.a,{query:r,path:t,filters:y.c,advancedFilters:y.a,report:"orders"}),Object(f.createElement)(V.a,{charts:y.b,endpoint:"orders",query:r,selectedChart:Object(v.a)(r.chart,y.b),filters:y.c,advancedFilters:y.a}),Object(f.createElement)(N.a,{charts:y.b,endpoint:"orders",path:t,query:r,selectedChart:Object(v.a)(r.chart,y.b),filters:y.c,advancedFilters:y.a}),Object(f.createElement)(P,{query:r,filters:y.c,advancedFilters:y.a}))}}]),r}(f.Component);x.propTypes={path:p.a.string.isRequired,query:p.a.object.isRequired}},603:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(5);function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=Object(n.find)(t,{key:e});return r||t[0]}},604:function(e,t,r){"use strict";r(64);var n=r(22),a=r.n(n),o=r(23),c=r.n(o),u=r(24),i=r.n(u),s=r(25),l=r.n(s),m=r(14),d=r.n(m),f=r(0),b=(r(51),r(170),r(88),r(2)),p=r(65),y=r(26),v=r(1),_=r.n(v),h=r(50),O=r(145),j=r(281),g=r(59),w=r(101),R=r(92),k=r(599),q=r(598);function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var a=d()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return l()(this,r)}}var S=function(e){i()(r,e);var t=C(r);function r(){return a()(this,r),t.apply(this,arguments)}return c()(r,[{key:"formatVal",value:function(e,t){var r=this.context,n=r.formatAmount,a=r.getCurrencyConfig;return"currency"===t?n(e):Object(j.formatValue)(a(),t,e)}},{key:"getValues",value:function(e,t){var r=this.props,n=r.emptySearchResults,a=r.summaryData.totals,o=a.primary?a.primary[e]:0,c=a.secondary?a.secondary[e]:0,u=n?0:o,i=n?0:c;return{delta:Object(j.calculateDelta)(u,i),prevValue:this.formatVal(i,t),value:this.formatVal(u,t)}}},{key:"render",value:function(){var e=this,t=this.props,r=t.charts,n=t.query,a=t.selectedChart,o=t.summaryData,c=t.endpoint,u=t.report,i=t.defaultDateRange,s=o.isError,l=o.isRequesting;if(s)return Object(f.createElement)(k.a,{isError:!0});if(l)return Object(f.createElement)(O.SummaryListPlaceholder,{numberOfItems:r.length});var m=Object(w.getDateParamsFromQuery)(n,i).compare;return Object(f.createElement)(O.SummaryList,null,(function(t){var n=t.onToggle;return r.map((function(t){var r=t.key,o=t.order,i=t.orderby,s=t.label,l=t.type,d={chart:r};i&&(d.orderby=i),o&&(d.order=o);var p=Object(h.getNewPath)(d),y=a.key===r,v=e.getValues(r,l),_=v.delta,j=v.prevValue,g=v.value;return Object(f.createElement)(O.SummaryNumber,{key:r,delta:_,href:p,label:s,prevLabel:"previous_period"===m?Object(b.__)("Previous Period:",'woocommerce'):Object(b.__)("Previous Year:",'woocommerce'),prevValue:j,selected:y,value:g,onLinkClickCallback:function(){n&&n(),Object(R.recordEvent)("analytics_chart_tab_click",{report:u||c,key:r})}})}))}))}}]),r}(f.Component);S.propTypes={charts:_.a.array.isRequired,endpoint:_.a.string.isRequired,limitProperties:_.a.array,query:_.a.object.isRequired,selectedChart:_.a.shape({key:_.a.string.isRequired,label:_.a.string.isRequired,order:_.a.oneOf(["asc","desc"]),orderby:_.a.string,type:_.a.oneOf(["average","number","currency"]).isRequired}).isRequired,summaryData:_.a.object,report:_.a.string},S.defaultProps={summaryData:{totals:{primary:{},secondary:{}},isError:!1}},S.contextType=q.a,t.a=Object(p.compose)(Object(y.withSelect)((function(e,t){var r=t.charts,n=t.endpoint,a=t.limitProperties,o=t.query,c=t.filters,u=t.advancedFilters,i=a||[n],s=i.some((function(e){return o[e]&&o[e].length}));if(o.search&&!s)return{emptySearchResults:!0};var l=r&&r.map((function(e){return e.key})),m=e(g.SETTINGS_STORE_NAME).getSetting("wc_admin","wcAdminSettings").woocommerce_default_date_range;return{summaryData:Object(g.getSummaryNumbers)({endpoint:n,query:o,select:e,limitBy:i,filters:c,advancedFilters:u,defaultDateRange:m,fields:l}),defaultDateRange:m}})))(S)},677:function(e,t,r){}}]);