File "analytics-report-orders.js"
Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/woocommerce/assets/client/admin/chunks/analytics-report-orders.js
File size: 14.03 KB
MIME-type: text/html
Charset: utf-8
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[3576],{25447:(e,t,o)=>{o.d(t,{O3:()=>s,be:()=>m,u8:()=>n});var r=o(65736),c=o(92694),a=o(20513),l=o(17062);const s=(0,c.applyFilters)("woocommerce_admin_orders_report_charts",[{key:"orders_count",label:(0,r.__)("Orders","woocommerce"),type:"number"},{key:"net_revenue",label:(0,r.__)("Net sales","woocommerce"),order:"desc",orderby:"net_total",type:"currency"},{key:"avg_order_value",label:(0,r.__)("Average order value","woocommerce"),type:"currency"},{key:"avg_items_per_order",label:(0,r.__)("Average items per order","woocommerce"),order:"desc",orderby:"num_items_sold",type:"average"}]),n=(0,c.applyFilters)("woocommerce_admin_orders_report_filters",[{label:(0,r.__)("Show","woocommerce"),staticParams:["chartType","paged","per_page"],param:"filter",showFilters:()=>!0,filters:[{label:(0,r.__)("All orders","woocommerce"),value:"all"},{label:(0,r.__)("Advanced filters","woocommerce"),value:"advanced"}]}]),m=(0,c.applyFilters)("woocommerce_admin_orders_report_advanced_filters",{title:(0,r._x)("Orders match <select/> filters","A sentence describing filters for Orders. See screen shot for context: https://cloudup.com/cSsUY9VeCVJ","woocommerce"),filters:{status:{labels:{add:(0,r.__)("Order status","woocommerce"),remove:(0,r.__)("Remove order status filter","woocommerce"),rule:(0,r.__)("Select an order status filter match","woocommerce"),title:(0,r.__)("<title>Order status</title> <rule/> <filter/>","woocommerce"),filter:(0,r.__)("Select an order status","woocommerce")},rules:[{value:"is",label:(0,r._x)("Is","order status","woocommerce")},{value:"is_not",label:(0,r._x)("Is Not","order status","woocommerce")}],input:{component:"SelectControl",options:Object.keys(l.rq).map((e=>({value:e,label:l.rq[e]})))}},product:{labels:{add:(0,r.__)("Product","woocommerce"),placeholder:(0,r.__)("Search products","woocommerce"),remove:(0,r.__)("Remove product filter","woocommerce"),rule:(0,r.__)("Select a product filter match","woocommerce"),title:(0,r.__)("<title>Product</title> <rule/> <filter/>","woocommerce"),filter:(0,r.__)("Select products","woocommerce")},rules:[{value:"includes",label:(0,r._x)("Includes","products","woocommerce")},{value:"excludes",label:(0,r._x)("Excludes","products","woocommerce")}],input:{component:"Search",type:"products",getLabels:a.oC}},variation:{labels:{add:(0,r.__)("Product variation","woocommerce"),placeholder:(0,r.__)("Search product variations","woocommerce"),remove:(0,r.__)("Remove product variation filter","woocommerce"),rule:(0,r.__)("Select a product variation filter match","woocommerce"),title:(0,r.__)("<title>Product variation</title> <rule/> <filter/>","woocommerce"),filter:(0,r.__)("Select variation","woocommerce")},rules:[{value:"includes",label:(0,r._x)("Includes","variations","woocommerce")},{value:"excludes",label:(0,r._x)("Excludes","variations","woocommerce")}],input:{component:"Search",type:"variations",getLabels:a.uC}},coupon:{labels:{add:(0,r.__)("Coupon code","woocommerce"),placeholder:(0,r.__)("Search coupons","woocommerce"),remove:(0,r.__)("Remove coupon filter","woocommerce"),rule:(0,r.__)("Select a coupon filter match","woocommerce"),title:(0,r.__)("<title>Coupon code</title> <rule/> <filter/>","woocommerce"),filter:(0,r.__)("Select coupon codes","woocommerce")},rules:[{value:"includes",label:(0,r._x)("Includes","coupon code","woocommerce")},{value:"excludes",label:(0,r._x)("Excludes","coupon code","woocommerce")}],input:{component:"Search",type:"coupons",getLabels:a.hQ}},customer_type:{labels:{add:(0,r.__)("Customer type","woocommerce"),remove:(0,r.__)("Remove customer filter","woocommerce"),rule:(0,r.__)("Select a customer filter match","woocommerce"),title:(0,r.__)("<title>Customer is</title> <filter/>","woocommerce"),filter:(0,r.__)("Select a customer type","woocommerce")},input:{component:"SelectControl",options:[{value:"new",label:(0,r.__)("New","woocommerce")},{value:"returning",label:(0,r.__)("Returning","woocommerce")}],defaultOption:"new"}},refunds:{labels:{add:(0,r.__)("Refund","woocommerce"),remove:(0,r.__)("Remove refund filter","woocommerce"),rule:(0,r.__)("Select a refund filter match","woocommerce"),title:(0,r.__)("<title>Refund</title> <filter/>","woocommerce"),filter:(0,r.__)("Select a refund type","woocommerce")},input:{component:"SelectControl",options:[{value:"all",label:(0,r.__)("All","woocommerce")},{value:"partial",label:(0,r.__)("Partially refunded","woocommerce")},{value:"full",label:(0,r.__)("Fully refunded","woocommerce")},{value:"none",label:(0,r.__)("None","woocommerce")}],defaultOption:"all"}},tax_rate:{labels:{add:(0,r.__)("Tax rate","woocommerce"),placeholder:(0,r.__)("Search tax rates","woocommerce"),remove:(0,r.__)("Remove tax rate filter","woocommerce"),rule:(0,r.__)("Select a tax rate filter match","woocommerce"),title:(0,r.__)("<title>Tax Rate</title> <rule/> <filter/>","woocommerce"),filter:(0,r.__)("Select tax rates","woocommerce")},rules:[{value:"includes",label:(0,r._x)("Includes","tax rate","woocommerce")},{value:"excludes",label:(0,r._x)("Excludes","tax rate","woocommerce")}],input:{component:"Search",type:"taxes",getLabels:a.FI}},attribute:{allowMultiple:!0,labels:{add:(0,r.__)("Product attribute","woocommerce"),placeholder:(0,r.__)("Search product attributes","woocommerce"),remove:(0,r.__)("Remove product attribute filter","woocommerce"),rule:(0,r.__)("Select a product attribute filter match","woocommerce"),title:(0,r.__)("<title>Product attribute</title> <rule/> <filter/>","woocommerce"),filter:(0,r.__)("Select attributes","woocommerce")},rules:[{value:"is",label:(0,r._x)("Is","product attribute","woocommerce")},{value:"is_not",label:(0,r._x)("Is Not","product attribute","woocommerce")}],input:{component:"ProductAttribute"}}}})},12181:(e,t,o)=>{o.r(t),o.d(t,{default:()=>C});var r=o(69307),c=o(7862),a=o.n(c),l=o(65736),s=o(25447),n=o(83573),m=o(92819),i=o(86020),u=o(81595),d=o(10431),_=o(81921),p=o(17844),w=o(42968),b=o(17062);class h extends r.Component{constructor(){super(),this.getHeadersContent=this.getHeadersContent.bind(this),this.getRowsContent=this.getRowsContent.bind(this),this.getSummary=this.getSummary.bind(this)}getHeadersContent(){return[{label:(0,l.__)("Date","woocommerce"),key:"date",required:!0,defaultSort:!0,isLeftAligned:!0,isSortable:!0},{label:(0,l.__)("Order #","woocommerce"),screenReaderLabel:(0,l.__)("Order Number","woocommerce"),key:"order_number",required:!0},{label:(0,l.__)("Status","woocommerce"),key:"status",required:!1,isSortable:!1},{label:(0,l.__)("Customer","woocommerce"),key:"customer_id",required:!1,isSortable:!1},{label:(0,l.__)("Customer type","woocommerce"),key:"customer_type",required:!1,isSortable:!1},{label:(0,l.__)("Product(s)","woocommerce"),screenReaderLabel:(0,l.__)("Products","woocommerce"),key:"products",required:!1,isSortable:!1},{label:(0,l.__)("Items sold","woocommerce"),key:"num_items_sold",required:!1,isSortable:!0,isNumeric:!0},{label:(0,l.__)("Coupon(s)","woocommerce"),screenReaderLabel:(0,l.__)("Coupons","woocommerce"),key:"coupons",required:!1,isSortable:!1},{label:(0,l.__)("Net sales","woocommerce"),screenReaderLabel:(0,l.__)("Net sales","woocommerce"),key:"net_total",required:!0,isSortable:!0,isNumeric:!0},{label:(0,l.__)("Attribution","woocommerce"),screenReaderLabel:(0,l.__)("Attribution","woocommerce"),key:"attribution",required:!1,isSortable:!1}]}getCustomerName(e){const{first_name:t,last_name:o}=e||{};return t||o?[t,o].join(" "):""}getRowsContent(e){const{query:t}=this.props,o=(0,d.getPersistedQuery)(t),c=(0,b.O3)("dateFormat",_.defaultTableDateFormat),{render:a,getCurrencyConfig:s}=this.context;return(0,m.map)(e,(e=>{const{currency:t,date:n,net_total:m,num_items_sold:_,order_id:p,order_number:w,parent_id:h,status:f,customer_type:y}=e,v=e.extended_info||{},{coupons:g,customer:S,products:C}=v,x=C.sort(((e,t)=>t.quantity-e.quantity)).map((e=>({label:e.name,quantity:e.quantity,href:(0,d.getNewPath)(o,"/analytics/products",{filter:"single_product",products:e.id})}))),k=g.map((e=>({label:e.code,href:(0,d.getNewPath)(o,"/analytics/coupons",{filter:"single_coupon",coupons:e.id})})));return[{display:(0,r.createElement)(i.Date,{date:n,visibleFormat:c}),value:n},{display:(0,r.createElement)(i.Link,{href:"post.php?post="+(h||p)+"&action=edit"+(h?"#order_refunds":""),type:"wp-admin"},w),value:w},{display:(0,r.createElement)(i.OrderStatus,{className:"woocommerce-orders-table__status",order:{status:f},labelPositionToLeft:!0,orderStatusMap:(0,b.O3)("orderStatuses",{})}),value:f},{display:this.getCustomerName(S),value:this.getCustomerName(S)},{display:(E=y,E.charAt(0).toUpperCase()+E.slice(1)),value:y},{display:this.renderList(x.length?[x[0]]:[],x.map((e=>({label:(0,l.sprintf)((0,l.__)("%1$s× %2$s","woocommerce"),e.quantity,e.label),href:e.href})))),value:x.map((({quantity:e,label:t})=>(0,l.sprintf)((0,l.__)("%1$s× %2$s","woocommerce"),e,t))).join(", ")},{display:(0,u.formatValue)(s(),"number",_),value:_},{display:this.renderList(k.length?[k[0]]:[],k),value:k.map((e=>e.label)).join(", ")},{display:a(m,t),value:m},{display:v.attribution.origin,value:v.attribution.origin}];var E}))}getSummary(e){const{orders_count:t=0,total_customers:o=0,products:r=0,num_items_sold:c=0,coupons_count:a=0,net_revenue:s=0}=e,{formatAmount:n,getCurrencyConfig:m}=this.context,i=m();return[{label:(0,l._n)("Order","Orders",t,"woocommerce"),value:(0,u.formatValue)(i,"number",t)},{label:(0,l._n)(" Customer"," Customers",o,"woocommerce"),value:(0,u.formatValue)(i,"number",o)},{label:(0,l._n)("Product","Products",r,"woocommerce"),value:(0,u.formatValue)(i,"number",r)},{label:(0,l._n)("Item sold","Items sold",c,"woocommerce"),value:(0,u.formatValue)(i,"number",c)},{label:(0,l._n)("Coupon","Coupons",a,"woocommerce"),value:(0,u.formatValue)(i,"number",a)},{label:(0,l.__)("net sales","woocommerce"),value:n(s)}]}renderLinks(e=[]){return e.map(((e,t)=>(0,r.createElement)(i.Link,{href:e.href,key:t,type:"wc-admin"},e.label)))}renderList(e,t){return(0,r.createElement)(r.Fragment,null,this.renderLinks(e),t.length>1&&(0,r.createElement)(i.ViewMoreList,{items:this.renderLinks(t)}))}render(){const{query:e,filters:t,advancedFilters:o}=this.props;return(0,r.createElement)(w.Z,{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:e,tableQuery:{extended_info:!0},title:(0,l.__)("Orders","woocommerce"),columnPrefsKey:"orders_report_columns",filters:t,advancedFilters:o})}}h.contextType=p.CurrencyContext;const f=h;var y=o(47478),v=o(80272),g=o(31511),S=o(40116);class C extends r.Component{render(){const{path:e,query:t}=this.props;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(g.Z,{query:t,path:e,filters:s.u8,advancedFilters:s.be,report:"orders"}),(0,r.createElement)(v.Z,{charts:s.O3,endpoint:"orders",query:t,selectedChart:(0,n.Z)(t.chart,s.O3),filters:s.u8,advancedFilters:s.be}),(0,r.createElement)(y.Z,{charts:s.O3,endpoint:"orders",path:e,query:t,selectedChart:(0,n.Z)(t.chart,s.O3),filters:s.u8,advancedFilters:s.be}),(0,r.createElement)(f,{query:t,filters:s.u8,advancedFilters:s.be}),(0,r.createElement)(S.I,{optionName:"woocommerce_orders_report_date_tour_shown",headingText:(0,l.__)("Orders are now reported based on the payment dates ✅","woocommerce")}))}}C.propTypes={path:a().string.isRequired,query:a().object.isRequired}},86806:(e,t,o)=>{o.d(t,{I:()=>c});var r=o(65736);function c(e){return[e.country,e.state,e.name||(0,r.__)("TAX","woocommerce"),e.priority].map((e=>e.toString().toUpperCase().trim())).filter(Boolean).join("-")}},40116:(e,t,o)=>{o.d(t,{I:()=>i});var r=o(86020),c=o(65736),a=o(67221),l=o(69307),s=o(9818),n=o(74617);const m="woocommerce_date_type",i=({optionName:e,headingText:t})=>{const[o,i]=(0,l.useState)(!1),{updateOptions:u}=(0,s.useDispatch)(a.OPTIONS_STORE_NAME),{shouldShowTour:d,isResolving:_}=(0,s.useSelect)((t=>{const{getOption:o,hasFinishedResolution:r}=t(a.OPTIONS_STORE_NAME);return{shouldShowTour:"yes"!==o(e)&&!1===o(m),isResolving:!(r("getOption",[e])&&r("getOption",[m]))}}));if(o||!d||_)return null;const p={steps:[{referenceElements:{desktop:".woocommerce-filters-filter > .components-dropdown"},focusElement:{desktop:".woocommerce-filters-filter > .components-dropdown"},meta:{name:"product-feedback-",heading:t,descriptions:{desktop:(0,l.createInterpolateElement)((0,c.__)("We now collect orders in this table based on when the payment went through, rather than when they were placed. You can change this in <link>settings</link>.","woocommerce"),{link:(0,l.createElement)("a",{href:(0,n.getAdminLink)("admin.php?page=wc-admin&path=/analytics/settings"),"aria-label":(0,c.__)("Analytics date settings","woocommerce")})})},primaryButton:{text:(0,c.__)("Got it","woocommerce")}},options:{classNames:{desktop:"woocommerce-revenue-report-date-tour"}}}],closeHandler:()=>{u({[e]:"yes"}),i(!0)}};return(0,l.createElement)(r.TourKit,{config:p})}},20513:(e,t,o)=>{o.d(t,{FI:()=>h,V1:()=>f,YC:()=>_,hQ:()=>p,jk:()=>w,oC:()=>b,qc:()=>d,uC:()=>y});var r=o(65736),c=o(96483),a=o(86989),l=o.n(a),s=o(92819),n=o(10431),m=o(67221),i=o(86806),u=o(17062);function d(e,t=s.identity){return function(o="",r){const a="function"==typeof e?e(r):e,s=(0,n.getIdsFromQuery)(o);if(s.length<1)return Promise.resolve([]);const m={include:s.join(","),per_page:s.length};return l()({path:(0,c.addQueryArgs)(a,m)}).then((e=>e.map(t)))}}d(m.NAMESPACE+"/products/attributes",(e=>({key:e.id,label:e.name})));const _=d(m.NAMESPACE+"/products/categories",(e=>({key:e.id,label:e.name}))),p=d(m.NAMESPACE+"/coupons",(e=>({key:e.id,label:e.code}))),w=d(m.NAMESPACE+"/customers",(e=>({key:e.id,label:e.name}))),b=d(m.NAMESPACE+"/products",(e=>({key:e.id,label:e.name}))),h=d(m.NAMESPACE+"/taxes",(e=>({key:e.id,label:(0,i.I)(e)})));function f({attributes:e,name:t}){const o=(0,u.O3)("variationTitleAttributesSeparator"," - ");if(t&&t.indexOf(o)>-1)return t;const c=(e||[]).map((({name:e,option:t})=>(t||(e=e.charAt(0).toUpperCase()+e.slice(1),t=(0,r.sprintf)((0,r.__)("Any %s","woocommerce"),e)),t))).join(", ");return c?t+o+c:t}const y=d((({products:e})=>e?m.NAMESPACE+`/products/${e}/variations`:m.NAMESPACE+"/variations"),(e=>({key:e.id,label:f(e)})))}}]);