File "analytics-report-customers.js"
Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/woocommerce/assets/client/admin/chunks/analytics-report-customers.js
File size: 11.88 KB
MIME-type: text/html
Charset: utf-8
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[3700],{56257:(e,o,r)=>{r.r(o),r.d(o,{default:()=>C});var t=r(69307),l=r(7862),a=r.n(l),c=r(65736),m=r(22629),s=r(92694),i=r(9818),n=r(67221),u=r(20513);const _=(0,s.applyFilters)("woocommerce_admin_customers_report_filters",[{label:(0,c.__)("Show","woocommerce"),staticParams:["paged","per_page"],param:"filter",showFilters:()=>!0,filters:[{label:(0,c.__)("All Customers","woocommerce"),value:"all"},{label:(0,c.__)("Single Customer","woocommerce"),value:"select_customer",chartMode:"item-comparison",subFilters:[{component:"Search",value:"single_customer",chartMode:"item-comparison",path:["select_customer"],settings:{type:"customers",param:"customers",getLabels:u.jk,labels:{placeholder:(0,c.__)("Type to search for a customer","woocommerce"),button:(0,c.__)("Single Customer","woocommerce")}}}]},{label:(0,c.__)("Advanced filters","woocommerce"),value:"advanced"}]}]),d=(0,s.applyFilters)("woocommerce_admin_customers_report_advanced_filters",{title:(0,c._x)("Customers match <select/> filters","A sentence describing filters for Customers. See screen shot for context: https://cloudup.com/cCsm3GeXJbE","woocommerce"),filters:{name:{labels:{add:(0,c.__)("Name","woocommerce"),placeholder:(0,c.__)("Search","woocommerce"),remove:(0,c.__)("Remove customer name filter","woocommerce"),rule:(0,c.__)("Select a customer name filter match","woocommerce"),title:(0,c.__)("<title>Name</title> <rule/> <filter/>","woocommerce"),filter:(0,c.__)("Select customer name","woocommerce")},rules:[{value:"includes",label:(0,c._x)("Includes","customer names","woocommerce")},{value:"excludes",label:(0,c._x)("Excludes","customer names","woocommerce")}],input:{component:"Search",type:"customers",getLabels:(0,u.qc)(n.NAMESPACE+"/customers",(e=>({id:e.id,label:e.name})))}},country:{labels:{add:(0,c.__)("Country / Region","woocommerce"),placeholder:(0,c.__)("Search","woocommerce"),remove:(0,c.__)("Remove country / region filter","woocommerce"),rule:(0,c.__)("Select a country / region filter match","woocommerce"),title:(0,c.__)("<title>Country / Region</title> <rule/> <filter/>","woocommerce"),filter:(0,c.__)("Select country / region","woocommerce")},rules:[{value:"includes",label:(0,c._x)("Includes","countries","woocommerce")},{value:"excludes",label:(0,c._x)("Excludes","countries","woocommerce")}],input:{component:"Search",type:"countries",getLabels:async e=>{const o=(await(0,i.resolveSelect)(n.COUNTRIES_STORE_NAME).getCountries()).map((e=>({key:e.code,label:(0,m.decodeEntities)(e.name)}))),r=e.split(",");return await o.filter((e=>r.includes(e.key)))}}},username:{labels:{add:(0,c.__)("Username","woocommerce"),placeholder:(0,c.__)("Search customer username","woocommerce"),remove:(0,c.__)("Remove customer username filter","woocommerce"),rule:(0,c.__)("Select a customer username filter match","woocommerce"),title:(0,c.__)("<title>Username</title> <rule/> <filter/>","woocommerce"),filter:(0,c.__)("Select customer username","woocommerce")},rules:[{value:"includes",label:(0,c._x)("Includes","customer usernames","woocommerce")},{value:"excludes",label:(0,c._x)("Excludes","customer usernames","woocommerce")}],input:{component:"Search",type:"usernames",getLabels:u.jk}},email:{labels:{add:(0,c.__)("Email","woocommerce"),placeholder:(0,c.__)("Search customer email","woocommerce"),remove:(0,c.__)("Remove customer email filter","woocommerce"),rule:(0,c.__)("Select a customer email filter match","woocommerce"),title:(0,c.__)("<title>Email</title> <rule/> <filter/>","woocommerce"),filter:(0,c.__)("Select customer email","woocommerce")},rules:[{value:"includes",label:(0,c._x)("Includes","customer emails","woocommerce")},{value:"excludes",label:(0,c._x)("Excludes","customer emails","woocommerce")}],input:{component:"Search",type:"emails",getLabels:(0,u.qc)(n.NAMESPACE+"/customers",(e=>({id:e.id,label:e.email})))}},orders_count:{labels:{add:(0,c.__)("No. of Orders","woocommerce"),remove:(0,c.__)("Remove order filter","woocommerce"),rule:(0,c.__)("Select an order count filter match","woocommerce"),title:(0,c.__)("<title>No. of Orders</title> <rule/> <filter/>","woocommerce")},rules:[{value:"max",label:(0,c._x)("Less Than","number of orders","woocommerce")},{value:"min",label:(0,c._x)("More Than","number of orders","woocommerce")},{value:"between",label:(0,c._x)("Between","number of orders","woocommerce")}],input:{component:"Number"}},total_spend:{labels:{add:(0,c.__)("Total Spend","woocommerce"),remove:(0,c.__)("Remove total spend filter","woocommerce"),rule:(0,c.__)("Select a total spend filter match","woocommerce"),title:(0,c.__)("<title>Total Spend</title> <rule/> <filter/>","woocommerce")},rules:[{value:"max",label:(0,c._x)("Less Than","total spend by customer","woocommerce")},{value:"min",label:(0,c._x)("More Than","total spend by customer","woocommerce")},{value:"between",label:(0,c._x)("Between","total spend by customer","woocommerce")}],input:{component:"Currency"}},avg_order_value:{labels:{add:(0,c.__)("AOV","woocommerce"),remove:(0,c.__)("Remove average order value filter","woocommerce"),rule:(0,c.__)("Select an average order value filter match","woocommerce"),title:(0,c.__)("<title>AOV</title> <rule/> <filter/>","woocommerce")},rules:[{value:"max",label:(0,c._x)("Less Than","average order value of customer","woocommerce")},{value:"min",label:(0,c._x)("More Than","average order value of customer","woocommerce")},{value:"between",label:(0,c._x)("Between","average order value of customer","woocommerce")}],input:{component:"Currency"}},registered:{labels:{add:(0,c.__)("Registered","woocommerce"),remove:(0,c.__)("Remove registered filter","woocommerce"),rule:(0,c.__)("Select a registered filter match","woocommerce"),title:(0,c.__)("<title>Registered</title> <rule/> <filter/>","woocommerce"),filter:(0,c.__)("Select registered date","woocommerce")},rules:[{value:"before",label:(0,c._x)("Before","date","woocommerce")},{value:"after",label:(0,c._x)("After","date","woocommerce")},{value:"between",label:(0,c._x)("Between","date","woocommerce")}],input:{component:"Date"}},last_active:{labels:{add:(0,c.__)("Last active","woocommerce"),remove:(0,c.__)("Remove last active filter","woocommerce"),rule:(0,c.__)("Select a last active filter match","woocommerce"),title:(0,c.__)("<title>Last active</title> <rule/> <filter/>","woocommerce"),filter:(0,c.__)("Select registered date","woocommerce")},rules:[{value:"before",label:(0,c._x)("Before","date","woocommerce")},{value:"after",label:(0,c._x)("After","date","woocommerce")},{value:"between",label:(0,c._x)("Between","date","woocommerce")}],input:{component:"Date"}}}});var p=r(55609),v=r(86020),w=r(81595),b=r(74617),f=r(81921),y=r(17844),g=r(42968),h=r(17062);const S=function({isRequesting:e,query:o,filters:r,advancedFilters:l}){const a=(0,t.useContext)(y.CurrencyContext),{countries:m,loadingCountries:s}=(0,i.useSelect)((e=>{const{getCountries:o,hasFinishedResolution:r}=e(n.COUNTRIES_STORE_NAME);return{countries:o(),loadingCountries:!r("getCountries")}}));return(0,t.createElement)(g.Z,{endpoint:"customers",getHeadersContent:()=>[{label:(0,c.__)("Name","woocommerce"),key:"name",required:!0,isLeftAligned:!0,isSortable:!0},{label:(0,c.__)("Username","woocommerce"),key:"username",hiddenByDefault:!0},{label:(0,c.__)("Last active","woocommerce"),key:"date_last_active",defaultSort:!0,isSortable:!0},{label:(0,c.__)("Date registered","woocommerce"),key:"date_registered",isSortable:!0},{label:(0,c.__)("Email","woocommerce"),key:"email"},{label:(0,c.__)("Orders","woocommerce"),key:"orders_count",isSortable:!0,isNumeric:!0},{label:(0,c.__)("Total spend","woocommerce"),key:"total_spend",isSortable:!0,isNumeric:!0},{label:(0,c.__)("AOV","woocommerce"),screenReaderLabel:(0,c.__)("Average order value","woocommerce"),key:"avg_order_value",isNumeric:!0},{label:(0,c.__)("Country / Region","woocommerce"),key:"country",isSortable:!0},{label:(0,c.__)("City","woocommerce"),key:"city",hiddenByDefault:!0,isSortable:!0},{label:(0,c.__)("Region","woocommerce"),key:"state",hiddenByDefault:!0,isSortable:!0},{label:(0,c.__)("Postal code","woocommerce"),key:"postcode",hiddenByDefault:!0,isSortable:!0}],getRowsContent:e=>{const o=(0,h.O3)("dateFormat",f.defaultTableDateFormat),{formatAmount:r,formatDecimal:l,getCurrencyConfig:s}=a;return e?.map((e=>{const{avg_order_value:a,date_last_active:i,date_registered:n,email:u,name:_,user_id:d,orders_count:f,username:y,total_spend:g,postcode:h,city:S,state:E,country:C}=e,A=void 0!==m[x=C]?m[x]:null;var x;const k=""!==_?.trim()?_:(0,t.createElement)(v.Pill,null,(0,c.__)("Guest","woocommerce")),R=d?(0,t.createElement)(v.Link,{href:(0,b.getAdminLink)("user-edit.php?user_id="+d),type:"wp-admin"},_):k,N=i?(0,t.createElement)(v.Date,{date:i,visibleFormat:o}):"—",T=n?(0,t.createElement)(v.Date,{date:n,visibleFormat:o}):"—",F=(0,t.createElement)(t.Fragment,null,(0,t.createElement)(p.Tooltip,{text:A},(0,t.createElement)("span",{"aria-hidden":"true"},C)),(0,t.createElement)("span",{className:"screen-reader-text"},A));return[{display:R,value:_},{display:y,value:y},{display:N,value:i},{display:T,value:n},{display:(0,t.createElement)("a",{href:"mailto:"+u},u),value:u},{display:(0,w.formatValue)(s(),"number",f),value:f},{display:r(g),value:l(g)},{display:r(a),value:l(a)},{display:F,value:C},{display:S,value:S},{display:E,value:E},{display:h,value:h}]}))},getSummary:e=>{const{customers_count:o=0,avg_orders_count:r=0,avg_total_spend:t=0,avg_avg_order_value:l=0}=e,{formatAmount:m,getCurrencyConfig:s}=a,i=s();return[{label:(0,c._n)("customer","customers",o,"woocommerce"),value:(0,w.formatValue)(i,"number",o)},{label:(0,c._n)("Average order","Average orders",r,"woocommerce"),value:(0,w.formatValue)(i,"number",r)},{label:(0,c.__)("Average lifetime spend","woocommerce"),value:m(t)},{label:(0,c.__)("Average order value","woocommerce"),value:m(l)}]},summaryFields:["customers_count","avg_orders_count","avg_total_spend","avg_avg_order_value"],isRequesting:e||s,itemIdField:"id",query:o,labels:{placeholder:(0,c.__)("Search by customer name","woocommerce")},searchBy:"customers",title:(0,c.__)("Customers","woocommerce"),columnPrefsKey:"customers_report_columns",filters:r,advancedFilters:l})};var E=r(31511);class C extends t.Component{render(){const{isRequesting:e,query:o,path:r}=this.props,l={orderby:"date_last_active",order:"desc",...o};return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(E.Z,{query:o,path:r,filters:_,showDatePicker:!1,advancedFilters:d,report:"customers"}),(0,t.createElement)(S,{isRequesting:e,query:l,filters:_,advancedFilters:d}))}}C.propTypes={query:a().object.isRequired}},86806:(e,o,r)=>{r.d(o,{I:()=>l});var t=r(65736);function l(e){return[e.country,e.state,e.name||(0,t.__)("TAX","woocommerce"),e.priority].map((e=>e.toString().toUpperCase().trim())).filter(Boolean).join("-")}},20513:(e,o,r)=>{r.d(o,{FI:()=>b,V1:()=>f,YC:()=>d,hQ:()=>p,jk:()=>v,oC:()=>w,qc:()=>_,uC:()=>y});var t=r(65736),l=r(96483),a=r(86989),c=r.n(a),m=r(92819),s=r(10431),i=r(67221),n=r(86806),u=r(17062);function _(e,o=m.identity){return function(r="",t){const a="function"==typeof e?e(t):e,m=(0,s.getIdsFromQuery)(r);if(m.length<1)return Promise.resolve([]);const i={include:m.join(","),per_page:m.length};return c()({path:(0,l.addQueryArgs)(a,i)}).then((e=>e.map(o)))}}_(i.NAMESPACE+"/products/attributes",(e=>({key:e.id,label:e.name})));const d=_(i.NAMESPACE+"/products/categories",(e=>({key:e.id,label:e.name}))),p=_(i.NAMESPACE+"/coupons",(e=>({key:e.id,label:e.code}))),v=_(i.NAMESPACE+"/customers",(e=>({key:e.id,label:e.name}))),w=_(i.NAMESPACE+"/products",(e=>({key:e.id,label:e.name}))),b=_(i.NAMESPACE+"/taxes",(e=>({key:e.id,label:(0,n.I)(e)})));function f({attributes:e,name:o}){const r=(0,u.O3)("variationTitleAttributesSeparator"," - ");if(o&&o.indexOf(r)>-1)return o;const l=(e||[]).map((({name:e,option:o})=>(o||(e=e.charAt(0).toUpperCase()+e.slice(1),o=(0,t.sprintf)((0,t.__)("Any %s","woocommerce"),e)),o))).join(", ");return l?o+r+l:o}const y=_((({products:e})=>e?i.NAMESPACE+`/products/${e}/variations`:i.NAMESPACE+"/variations"),(e=>({key:e.id,label:f(e)})))}}]);