%PDF- %PDF-
Direktori : /home/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/admin/chunks/ |
Current File : /home/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/admin/chunks/6224.js |
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[6224],{47478:(e,t,r)=>{r.d(t,{Z:()=>D});var a=r(69307),s=r(65736),n=r(94333),i=r(69771),o=r(9818),l=r(92819),c=r(7862),u=r.n(c),m=r(86020),d=r(67221),p=r(81921),y=r(17844),g=r(10431);function h(e,t,r={}){if(!e||0===e.length)return null;const a=e.slice(0),s=a.pop();if(s.showFilters(t,r)){const e=(0,g.flattenFilters)(s.filters),r=t[s.param]||s.defaultValue||"all";return(0,l.find)(e,{value:r})}return h(a,t,r)}function f(e){return t=>(0,i.format)(e,t)}function b(e){if(e?.data?.intervals?.length>1){const t=e.data.intervals[0].date_start,r=e.data.intervals[e.data.intervals.length-1].date_end;if((0,p.containsLeapYear)(t,r))return!0}return!1}class R 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,i.format)("Y-m-d\\TH:i:s",e.date_start),...r}}))}getTimeChartData(){const{query:e,primaryData:t,secondaryData:r,selectedChart:a,defaultDateRange:s}=this.props,n=(0,p.getIntervalForQuery)(e,s),{primary:o,secondary:l}=(0,p.getCurrentDates)(e,s);return function(e,t,r,a,s,n,o){const l=b(e),c=b(t),u=[...e.data.intervals],m=[...t.data.intervals],d=[];for(let e=0;e<u.length;e++){const t=u[e],y=(0,i.format)("Y-m-d\\TH:i:s",t.date_start),g=`${r.label} (${r.range})`,h=t.date_start,f=t.subtotals[n]||0,b=m[e],R=`${a.label} (${a.range})`;let D=(0,p.getPreviousDate)(t.date_start,r.after,a.after,s,o).format("YYYY-MM-DD HH:mm:ss"),v=b&&b.subtotals[n]||0;if("day"===o&&l&&!c&&m?.[e]){const r=new Date(t.date_start),a=new Date(m[e].date_start);(0,p.isLeapYear)(r.getFullYear())&&1===r.getMonth()&&29===r.getDate()&&2===a.getMonth()&&1===a.getDate()&&(D="-",v=0,m.splice(e,0,m[e]))}d.push({date:y,primary:{label:g,labelDate:h,value:f},secondary:{label:R,labelDate:D,value:v}})}return d}(t,r,o,l,e.compare,a.key,n)}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,n){const{emptySearchResults:i,filterParam:o,interactiveLegend:l,itemsLabel:c,legendPosition:u,path:y,query:g,selectedChart:h,showHeaderControls:b,primaryData:R,defaultDateRange:D}=this.props,v=(0,p.getIntervalForQuery)(g,D),q=(0,p.getAllowedIntervalsForQuery)(g,D),_=(0,p.getDateFormatsForInterval)(v,R.data.intervals.length,{type:"php"}),C=i?(0,s.__)("No data for the current search","woocommerce"):(0,s.__)("No data for the selected date range","woocommerce"),{formatAmount:T,getCurrencyConfig:E}=this.context;return(0,a.createElement)(m.Chart,{allowedIntervals:q,data:r,dateParser:"%Y-%m-%dT%H:%M:%S",emptyMessage:C,filterParam:o,interactiveLegend:l,interval:v,isRequesting:t,itemsLabel:c,legendPosition:u,legendTotals:n,mode:e,path:y,query:g,screenReaderFormat:f(_.screenReaderFormat),showHeaderControls:b,title:h.label,tooltipLabelFormat:f(_.tooltipLabelFormat),tooltipTitle:"time-comparison"===e&&h.label||null,tooltipValueFormat:(0,d.getTooltipValueFormat)(h.type,T),chartType:(0,p.getChartTypeForQuery)(g),valueType:h.type,xFormat:f(_.xFormat),x2Format:f(_.x2Format),currency:E()})}renderItemComparison(){const{isRequesting:e,primaryData:t}=this.props;if(t.isError)return(0,a.createElement)(m.AnalyticsError,null);const r=e||t.isRequesting,s=this.getItemChartData();return this.renderChart("item-comparison",r,s)}renderTimeComparison(){const{isRequesting:e,primaryData:t,secondaryData:r}=this.props;if(!t||t.isError||r.isError)return(0,a.createElement)(m.AnalyticsError,null);const s=e||t.isRequesting||r.isRequesting,n=this.getTimeChartData(),i=this.getTimeChartTotals();return this.renderChart("time-comparison",s,n,i)}render(){const{mode:e}=this.props;return"item-comparison"===e?this.renderItemComparison():this.renderTimeComparison()}}R.contextType=y.CurrencyContext,R.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},R.defaultProps={isRequesting:!1,primaryData:{data:{intervals:[]},isError:!1,isRequesting:!1},secondaryData:{data:{intervals:[]},isError:!1,isRequesting:!1}};const D=(0,n.compose)((0,o.withSelect)(((e,t)=>{const{charts:r,endpoint:a,filters:s,isRequesting:n,limitProperties:i,query:o,advancedFilters:c}=t,u=i||[a],m=h(s,o),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,o)||"time-comparison",{woocommerce_default_date_range:g}=e(d.SETTINGS_STORE_NAME).getSetting("wc_admin","wcAdminSettings"),f=e(d.REPORTS_STORE_NAME),b={mode:y,filterParam:p,defaultDateRange:g};if(n)return b;const R=u.some((e=>o[e]&&o[e].length));if(o.search&&!R)return{...b,emptySearchResults:!0};const D=r&&r.map((e=>e.key)),v=(0,d.getReportChartData)({endpoint:a,dataType:"primary",query:o,selector:f,limitBy:u,filters:s,advancedFilters:c,defaultDateRange:g,fields:D});if("item-comparison"===y)return{...b,primaryData:v};const q=(0,d.getReportChartData)({endpoint:a,dataType:"secondary",query:o,selector:f,limitBy:u,filters:s,advancedFilters:c,defaultDateRange:g,fields:D});return{...b,primaryData:v,secondaryData:q}})))(R)},80272:(e,t,r)=>{r.d(t,{Z:()=>f});var a=r(69307),s=r(65736),n=r(94333),i=r(9818),o=r(7862),l=r.n(o),c=r(10431),u=r(86020),m=r(81595),d=r(67221),p=r(81921),y=r(14599),g=r(17844);class h 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:s}=a,n=s.primary?s.primary[e]:0,i=s.secondary?s.secondary[e]:0,o=r?0:n,l=r?0:i;return{delta:(0,m.calculateDelta)(o,l),prevValue:this.formatVal(l,t),value:this.formatVal(o,t)}}render(){const{charts:e,query:t,selectedChart:r,summaryData:n,endpoint:i,report:o,defaultDateRange:l}=this.props,{isError:m,isRequesting:d}=n;if(m)return(0,a.createElement)(u.AnalyticsError,null);if(d)return(0,a.createElement)(u.SummaryListPlaceholder,{numberOfItems:e.length});const{compare:g}=(0,p.getDateParamsFromQuery)(t,l);return(0,a.createElement)(u.SummaryList,null,(({onToggle:t})=>e.map((e=>{const{key:n,order:l,orderby:m,label:d,type:p,isReverseTrend:h,labelTooltipText:f}=e,b={chart:n};m&&(b.orderby=m),l&&(b.order=l);const R=(0,c.getNewPath)(b),D=r.key===n,{delta:v,prevValue:q,value:_}=this.getValues(n,p);return(0,a.createElement)(u.SummaryNumber,{key:n,delta:v,href:R,label:d,reverseTrend:h,prevLabel:"previous_period"===g?(0,s.__)("Previous period:","woocommerce"):(0,s.__)("Previous year:","woocommerce"),prevValue:q,selected:D,value:_,labelTooltipText:f,onLinkClickCallback:()=>{t&&t(),(0,y.recordEvent)("analytics_chart_tab_click",{report:o||i,key:n})}})}))))}}h.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},h.defaultProps={summaryData:{totals:{primary:{},secondary:{}},isError:!1}},h.contextType=g.CurrencyContext;const f=(0,n.compose)((0,i.withSelect)(((e,t)=>{const{charts:r,endpoint:a,limitProperties:s,query:n,filters:i,advancedFilters:o}=t,l=s||[a],c=l.some((e=>n[e]&&n[e].length));if(n.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:n,select:e,limitBy:l,filters:i,advancedFilters:o,defaultDateRange:m,fields:u}),defaultDateRange:m}})))(h)},83573:(e,t,r)=>{r.d(t,{Z:()=>s});var a=r(92819);function s(e,t=[]){return(0,a.find)(t,{key:e})||t[0]}}}]);