芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/woocommerce/assets/client/admin/chunks/analytics-report-taxes.js
"use strict";(self.webpackChunk_wcAdmin_webpackJsonp=self.webpackChunk_wcAdmin_webpackJsonp||[]).push([[9792],{43707:function(e,t,r){r.d(t,{Z:function(){return x}});var a=r(69307),o=r(65736),s=r(94333),n=r(69771),i=r(9818),l=r(92819),c=r(7862),u=r.n(c),m=r(86020),d=r(67221),p=r(81921),y=r(54071),g=r(5945),h=r(10431);function _(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||0===e.length)return null;const a=e.slice(0),o=a.pop();if(o.showFilters(t,r)){const e=(0,h.flattenFilters)(o.filters),r=t[o.param]||o.defaultValue||"all";return(0,l.find)(e,{value:r})}return _(a,t,r)}function f(e){return t=>(0,n.format)(e,t)}class b extends a.Component{shouldComponentUpdate(e){return e.isRequesting!==this.props.isRequesting||e.primaryData.isRequesting!==this.props.primaryData.isRequesting||e.secondaryData.isRequesting!==this.props.secondaryData.isRequesting||!(0,l.isEqual)(e.query,this.props.query)}getItemChartData(){const{primaryData:e,selectedChart:t}=this.props;return e.data.intervals.map((function(e){const r={};return e.subtotals.segments.forEach((function(e){if(e.segment_label){const a=r[e.segment_label]?e.segment_label+" (#"+e.segment_id+")":e.segment_label;r[e.segment_id]={label:a,value:e.subtotals[t.key]||0}}})),{date:(0,n.format)("Y-m-d\\TH:i:s",e.date_start),...r}}))}getTimeChartData(){const{query:e,primaryData:t,secondaryData:r,selectedChart:a,defaultDateRange:o}=this.props,s=(0,p.getIntervalForQuery)(e,o),{primary:i,secondary:l}=(0,p.getCurrentDates)(e,o);return t.data.intervals.map((function(t,o){const c=(0,p.getPreviousDate)(t.date_start,i.after,l.after,e.compare,s),u=r.data.intervals[o];return{date:(0,n.format)("Y-m-d\\TH:i:s",t.date_start),primary:{label:`${i.label} (${i.range})`,labelDate:t.date_start,value:t.subtotals[a.key]||0},secondary:{label:`${l.label} (${l.range})`,labelDate:c.format("YYYY-MM-DD HH:mm:ss"),value:u&&u.subtotals[a.key]||0}}}))}getTimeChartTotals(){const{primaryData:e,secondaryData:t,selectedChart:r}=this.props;return{primary:(0,l.get)(e,["data","totals",r.key],null),secondary:(0,l.get)(t,["data","totals",r.key],null)}}renderChart(e,t,r,s){const{emptySearchResults:n,filterParam:i,interactiveLegend:l,itemsLabel:c,legendPosition:u,path:y,query:g,selectedChart:h,showHeaderControls:_,primaryData:b,defaultDateRange:x}=this.props,v=(0,p.getIntervalForQuery)(g,x),C=(0,p.getAllowedIntervalsForQuery)(g,x),q=(0,p.getDateFormatsForInterval)(v,b.data.intervals.length,{type:"php"}),R=n?(0,o.__)("No data for the current search","woocommerce"):(0,o.__)("No data for the selected date range","woocommerce"),{formatAmount:w,getCurrencyConfig:S}=this.context;return(0,a.createElement)(m.Chart,{allowedIntervals:C,data:r,dateParser:"%Y-%m-%dT%H:%M:%S",emptyMessage:R,filterParam:i,interactiveLegend:l,interval:v,isRequesting:t,itemsLabel:c,legendPosition:u,legendTotals:s,mode:e,path:y,query:g,screenReaderFormat:f(q.screenReaderFormat),showHeaderControls:_,title:h.label,tooltipLabelFormat:f(q.tooltipLabelFormat),tooltipTitle:"time-comparison"===e&&h.label||null,tooltipValueFormat:(0,d.getTooltipValueFormat)(h.type,w),chartType:(0,p.getChartTypeForQuery)(g),valueType:h.type,xFormat:f(q.xFormat),x2Format:f(q.x2Format),currency:S()})}renderItemComparison(){const{isRequesting:e,primaryData:t}=this.props;if(t.isError)return(0,a.createElement)(g.Z,null);const r=e||t.isRequesting,o=this.getItemChartData();return this.renderChart("item-comparison",r,o)}renderTimeComparison(){const{isRequesting:e,primaryData:t,secondaryData:r}=this.props;if(!t||t.isError||r.isError)return(0,a.createElement)(g.Z,null);const o=e||t.isRequesting||r.isRequesting,s=this.getTimeChartData(),n=this.getTimeChartTotals();return this.renderChart("time-comparison",o,s,n)}render(){const{mode:e}=this.props;return"item-comparison"===e?this.renderItemComparison():this.renderTimeComparison()}}b.contextType=y.$,b.propTypes={filters:u().array,isRequesting:u().bool,itemsLabel:u().string,limitProperties:u().array,mode:u().string,path:u().string.isRequired,primaryData:u().object,query:u().object.isRequired,secondaryData:u().object,selectedChart:u().shape({key:u().string.isRequired,label:u().string.isRequired,order:u().oneOf(["asc","desc"]),orderby:u().string,type:u().oneOf(["average","number","currency"]).isRequired}).isRequired},b.defaultProps={isRequesting:!1,primaryData:{data:{intervals:[]},isError:!1,isRequesting:!1},secondaryData:{data:{intervals:[]},isError:!1,isRequesting:!1}};var x=(0,s.compose)((0,i.withSelect)(((e,t)=>{const{charts:r,endpoint:a,filters:o,isRequesting:s,limitProperties:n,query:i,advancedFilters:c}=t,u=n||[a],m=_(o,i),p=(0,l.get)(m,["settings","param"]),y=t.mode||function(e,t){if(e&&t){const r=(0,l.get)(e,["settings","param"]);if(!r||Object.keys(t).includes(r))return(0,l.get)(e,["chartMode"])}return null}(m,i)||"time-comparison",{woocommerce_default_date_range:g}=e(d.SETTINGS_STORE_NAME).getSetting("wc_admin","wcAdminSettings"),h=e(d.REPORTS_STORE_NAME),f={mode:y,filterParam:p,defaultDateRange:g};if(s)return f;const b=u.some((e=>i[e]&&i[e].length));if(i.search&&!b)return{...f,emptySearchResults:!0};const x=r&&r.map((e=>e.key)),v=(0,d.getReportChartData)({endpoint:a,dataType:"primary",query:i,selector:h,limitBy:u,filters:o,advancedFilters:c,defaultDateRange:g,fields:x});if("item-comparison"===y)return{...f,primaryData:v};const C=(0,d.getReportChartData)({endpoint:a,dataType:"secondary",query:i,selector:h,limitBy:u,filters:o,advancedFilters:c,defaultDateRange:g,fields:x});return{...f,primaryData:v,secondaryData:C}})))(b)},50933:function(e,t,r){var a=r(69307),o=r(65736),s=r(94333),n=r(9818),i=r(7862),l=r.n(i),c=r(10431),u=r(86020),m=r(81595),d=r(67221),p=r(81921),y=r(14599),g=r(5945),h=r(54071);class _ extends a.Component{formatVal(e,t){const{formatAmount:r,getCurrencyConfig:a}=this.context;return"currency"===t?r(e):(0,m.formatValue)(a(),t,e)}getValues(e,t){const{emptySearchResults:r,summaryData:a}=this.props,{totals:o}=a,s=o.primary?o.primary[e]:0,n=o.secondary?o.secondary[e]:0,i=r?0:s,l=r?0:n;return{delta:(0,m.calculateDelta)(i,l),prevValue:this.formatVal(l,t),value:this.formatVal(i,t)}}render(){const{charts:e,query:t,selectedChart:r,summaryData:s,endpoint:n,report:i,defaultDateRange:l}=this.props,{isError:m,isRequesting:d}=s;if(m)return(0,a.createElement)(g.Z,null);if(d)return(0,a.createElement)(u.SummaryListPlaceholder,{numberOfItems:e.length});const{compare:h}=(0,p.getDateParamsFromQuery)(t,l);return(0,a.createElement)(u.SummaryList,null,(t=>{let{onToggle:s}=t;return e.map((e=>{const{key:t,order:l,orderby:m,label:d,type:p,isReverseTrend:g,labelTooltipText:_}=e,f={chart:t};m&&(f.orderby=m),l&&(f.order=l);const b=(0,c.getNewPath)(f),x=r.key===t,{delta:v,prevValue:C,value:q}=this.getValues(t,p);return(0,a.createElement)(u.SummaryNumber,{key:t,delta:v,href:b,label:d,reverseTrend:g,prevLabel:"previous_period"===h?(0,o.__)("Previous period:","woocommerce"):(0,o.__)("Previous year:","woocommerce"),prevValue:C,selected:x,value:q,labelTooltipText:_,onLinkClickCallback:()=>{s&&s(),(0,y.recordEvent)("analytics_chart_tab_click",{report:i||n,key:t})}})}))}))}}_.propTypes={charts:l().array.isRequired,endpoint:l().string.isRequired,limitProperties:l().array,query:l().object.isRequired,selectedChart:l().shape({key:l().string.isRequired,label:l().string.isRequired,order:l().oneOf(["asc","desc"]),orderby:l().string,type:l().oneOf(["average","number","currency"]).isRequired}).isRequired,summaryData:l().object,report:l().string},_.defaultProps={summaryData:{totals:{primary:{},secondary:{}},isError:!1}},_.contextType=h.$,t.Z=(0,s.compose)((0,n.withSelect)(((e,t)=>{const{charts:r,endpoint:a,limitProperties:o,query:s,filters:n,advancedFilters:i}=t,l=o||[a],c=l.some((e=>s[e]&&s[e].length));if(s.search&&!c)return{emptySearchResults:!0};const u=r&&r.map((e=>e.key)),{woocommerce_default_date_range:m}=e(d.SETTINGS_STORE_NAME).getSetting("wc_admin","wcAdminSettings");return{summaryData:(0,d.getSummaryNumbers)({endpoint:a,query:s,select:e,limitBy:l,filters:n,advancedFilters:i,defaultDateRange:m,fields:u}),defaultDateRange:m}})))(_)},63871:function(e,t,r){r.d(t,{O3:function(){return m},be:function(){return d},u8:function(){return y}});var a=r(65736),o=r(92694),s=r(67221),n=r(9818),i=r(68734),l=r(69629),c=r(30226);const{addCesSurveyForAnalytics:u}=(0,n.dispatch)(c.Ls),m=(0,o.applyFilters)("woocommerce_admin_taxes_report_charts",[{key:"total_tax",label:(0,a.__)("Total tax","woocommerce"),order:"desc",orderby:"total_tax",type:"currency"},{key:"order_tax",label:(0,a.__)("Order tax","woocommerce"),order:"desc",orderby:"order_tax",type:"currency"},{key:"shipping_tax",label:(0,a.__)("Shipping tax","woocommerce"),order:"desc",orderby:"shipping_tax",type:"currency"},{key:"orders_count",label:(0,a.__)("Orders","woocommerce"),order:"desc",orderby:"orders_count",type:"number"}]),d=(0,o.applyFilters)("woocommerce_admin_taxes_report_advanced_filters",{filters:{},title:(0,a._x)("Taxes match {{select /}} filters","A sentence describing filters for Taxes. See screen shot for context: https://cloudup.com/cSsUY9VeCVJ","woocommerce")}),p=[{label:(0,a.__)("All taxes","woocommerce"),value:"all"},{label:(0,a.__)("Comparison","woocommerce"),value:"compare-taxes",chartMode:"item-comparison",settings:{type:"taxes",param:"taxes",getLabels:(0,i.qc)(s.NAMESPACE+"/taxes",(e=>({id:e.id,key:e.id,label:(0,l.I)(e)}))),labels:{helpText:(0,a.__)("Check at least two tax codes below to compare","woocommerce"),placeholder:(0,a.__)("Search for tax codes to compare","woocommerce"),title:(0,a.__)("Compare Tax Codes","woocommerce"),update:(0,a.__)("Compare","woocommerce")},onClick:u}}];Object.keys(d.filters).length&&p.push({label:(0,a.__)("Advanced filters","woocommerce"),value:"advanced"});const y=(0,o.applyFilters)("woocommerce_admin_taxes_report_filters",[{label:(0,a.__)("Show","woocommerce"),staticParams:["chartType","paged","per_page"],param:"filter",showFilters:()=>!0,filters:p}])},26146:function(e,t,r){r.r(t),r.d(t,{default:function(){return C}});var a=r(69307),o=r(7862),s=r.n(o),n=r(65736),i=r(63871),l=r(62409),c=r(43707),u=r(50933),m=r(92819),d=r(86020),p=r(10431),y=r(81595),g=r(69629),h=r(39705),_=r(54071);class f extends a.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,n.__)("Tax code","woocommerce"),key:"tax_code",required:!0,isLeftAligned:!0,isSortable:!0},{label:(0,n.__)("Rate","woocommerce"),key:"rate",isSortable:!0,isNumeric:!0},{label:(0,n.__)("Total tax","woocommerce"),key:"total_tax",isSortable:!0},{label:(0,n.__)("Order tax","woocommerce"),key:"order_tax",isSortable:!0},{label:(0,n.__)("Shipping tax","woocommerce"),key:"shipping_tax",isSortable:!0},{label:(0,n.__)("Orders","woocommerce"),key:"orders_count",required:!0,defaultSort:!0,isSortable:!0,isNumeric:!0}]}getRowsContent(e){const{render:t,formatDecimal:r,getCurrencyConfig:o}=this.context;return(0,m.map)(e,(e=>{const{query:s}=this.props,{order_tax:n,orders_count:i,tax_rate:l,tax_rate_id:c,total_tax:u,shipping_tax:m}=e,h=(0,g.I)(e),_=(0,p.getPersistedQuery)(s),f=(0,p.getNewPath)(_,"/analytics/orders",{filter:"advanced",tax_rate_includes:c});return[{display:(0,a.createElement)(d.Link,{href:f,type:"wc-admin"},h),value:h},{display:l.toFixed(2)+"%",value:l},{display:t(u),value:r(u)},{display:t(n),value:r(n)},{display:t(m),value:r(m)},{display:(0,y.formatValue)(o(),"number",i),value:i}]}))}getSummary(e){const{tax_codes:t=0,total_tax:r=0,order_tax:a=0,shipping_tax:o=0,orders_count:s=0}=e,{formatAmount:i,getCurrencyConfig:l}=this.context,c=l();return[{label:(0,n._n)("tax code","tax codes",t,"woocommerce"),value:(0,y.formatValue)(c,"number",t)},{label:(0,n.__)("total tax","woocommerce"),value:i(r)},{label:(0,n.__)("order tax","woocommerce"),value:i(a)},{label:(0,n.__)("shipping tax","woocommerce"),value:i(o)},{label:(0,n._n)("order","orders",s,"woocommerce"),value:(0,y.formatValue)(c,"number",s)}]}render(){const{advancedFilters:e,filters:t,isRequesting:r,query:o}=this.props;return(0,a.createElement)(h.Z,{compareBy:"taxes",endpoint:"taxes",getHeadersContent:this.getHeadersContent,getRowsContent:this.getRowsContent,getSummary:this.getSummary,summaryFields:["tax_codes","total_tax","order_tax","shipping_tax","orders_count"],isRequesting:r,itemIdField:"tax_rate_id",query:o,searchBy:"taxes",tableQuery:{orderby:o.orderby||"tax_rate_id"},title:(0,n.__)("Taxes","woocommerce"),columnPrefsKey:"taxes_report_columns",filters:t,advancedFilters:e})}}f.contextType=_.$;var b=f,x=r(27410);class v extends a.Component{getChartMeta(){const{query:e}=this.props,t="compare-taxes"===e.filter?"item-comparison":"time-comparison";return{itemsLabel:(0,n.__)("%d taxes","woocommerce"),mode:t}}render(){const{isRequesting:e,query:t,path:r}=this.props,{mode:o,itemsLabel:s}=this.getChartMeta(),n={...t};return"item-comparison"===o&&(n.segmentby="tax_rate_id"),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(x.Z,{query:t,path:r,filters:i.u8,advancedFilters:i.be,report:"taxes"}),(0,a.createElement)(u.Z,{charts:i.O3,endpoint:"taxes",isRequesting:e,query:n,selectedChart:(0,l.Z)(t.chart,i.O3),filters:i.u8,advancedFilters:i.be}),(0,a.createElement)(c.Z,{charts:i.O3,filters:i.u8,advancedFilters:i.be,mode:o,endpoint:"taxes",query:n,path:r,isRequesting:e,itemsLabel:s,selectedChart:(0,l.Z)(t.chart,i.O3)}),(0,a.createElement)(b,{isRequesting:e,query:t,filters:i.u8,advancedFilters:i.be}))}}v.propTypes={query:s().object.isRequired};var C=v},69629:function(e,t,r){r.d(t,{I:function(){return o}});var a=r(65736);function o(e){return[e.country,e.state,e.name||(0,a.__)("TAX","woocommerce"),e.priority].map((e=>e.toString().toUpperCase().trim())).filter(Boolean).join("-")}},68734:function(e,t,r){r.d(t,{FI:function(){return h},V1:function(){return _},YC:function(){return d},hQ:function(){return p},jk:function(){return y},oC:function(){return g},qc:function(){return m},uC:function(){return f}});var a=r(96483),o=r(86989),s=r.n(o),n=r(92819),i=r(10431),l=r(67221),c=r(69629),u=r(79205);function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.identity;return function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;const n="function"==typeof e?e(o):e,l=(0,i.getIdsFromQuery)(r);if(l.length<1)return Promise.resolve([]);const c={include:l.join(","),per_page:l.length};return s()({path:(0,a.addQueryArgs)(n,c)}).then((e=>e.map(t)))}}m(l.NAMESPACE+"/products/attributes",(e=>({key:e.id,label:e.name})));const d=m(l.NAMESPACE+"/products/categories",(e=>({key:e.id,label:e.name}))),p=m(l.NAMESPACE+"/coupons",(e=>({key:e.id,label:e.code}))),y=m(l.NAMESPACE+"/customers",(e=>({key:e.id,label:e.name}))),g=m(l.NAMESPACE+"/products",(e=>({key:e.id,label:e.name}))),h=m(l.NAMESPACE+"/taxes",(e=>({key:e.id,label:(0,c.I)(e)})));function _(e){let{attributes:t,name:r}=e;const a=(0,u.O3)("variationTitleAttributesSeparator"," - ");if(r&&r.indexOf(a)>-1)return r;const o=(t||[]).map((e=>{let{option:t}=e;return t})).join(", ");return o?r+a+o:r}const f=m((e=>{let{products:t}=e;return t?l.NAMESPACE+`/products/${t}/variations`:l.NAMESPACE+"/variations"}),(e=>({key:e.id,label:_(e)})))},62409:function(e,t,r){r.d(t,{Z:function(){return o}});var a=r(92819);function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=(0,a.find)(t,{key:e});return r||t[0]}}}]);