"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[3256],{36736:(e,t,r)=>{r.d(t,{Y:()=>A});var o=r(27723),a=r(38443),c=r(56427),l=r(47143),s=r(40314),i=r(86087),m=r(1455),n=r.n(m);const u=5e3;var d=r(39793);function _(){const{status:e,isLoading:t,triggerImport:r,isTriggeringImport:m}=function(){const[e,t]=(0,i.useState)(null),[r,a]=(0,i.useState)(!0),[c,l]=(0,i.useState)(null),[s,m]=(0,i.useState)(!1),d=(0,i.useRef)(null),_=(0,i.useCallback)((async()=>{try{const e=await n()({path:"/wc-analytics/imports/status",method:"GET"});t(e),l(null)}catch(e){l(e instanceof Error?e.message:(0,o.__)("Failed to fetch status","woocommerce"))}finally{a(!1)}}),[]),p=(0,i.useCallback)((async()=>{m(!0);try{await n()({path:"/wc-analytics/imports/trigger",method:"POST"}),await _()}catch(e){throw l(e instanceof Error?e.message:(0,o.__)("Failed to trigger import","woocommerce")),e}finally{m(!1)}}),[_]);return(0,i.useEffect)((()=>{_()}),[_]),(0,i.useEffect)((()=>(e?.import_in_progress_or_due?d.current=window.setInterval(_,u):d.current&&(clearInterval(d.current),d.current=null),()=>{d.current&&(clearInterval(d.current),d.current=null)})),[e?.import_in_progress_or_due,_]),{status:e,isLoading:r,error:c,triggerImport:p,isTriggeringImport:s}}(),{createNotice:_}=(0,l.useDispatch)("core/notices"),{wcAdminSettings:p}=(0,s.useSettings)("wc_admin",["wcAdminSettings"]);if(!p?.woocommerce_analytics_scheduled_import||"no"===p.woocommerce_analytics_scheduled_import)return null;const w=e?.import_in_progress_or_due||m;return(0,d.jsxs)("div",{className:"woocommerce-analytics-import-status-bar-wrapper",children:[(0,d.jsx)("div",{className:"woocommerce-analytics-import-status-bar-wrapper__label",children:(0,o.__)("Data status:","woocommerce")}),(0,d.jsx)("div",{className:"woocommerce-analytics-import-status-bar",role:"status","aria-live":"polite","aria-atomic":"true","aria-busy":t||m,children:(0,d.jsxs)("div",{className:"woocommerce-analytics-import-status-bar__content",children:[(0,d.jsxs)("span",{className:"woocommerce-analytics-import-status-bar__item",children:[(0,d.jsx)("span",{className:"woocommerce-analytics-import-status-bar__label",children:(0,o.__)("Last updated","woocommerce")}),(0,d.jsx)("span",{className:"woocommerce-analytics-import-status-bar__value",children:t?(0,d.jsx)(c.Spinner,{}):(v=e?.last_processed_date||null,v?(0,a.dateI18n)("M j H:i",v,void 0):(0,o.__)("Never","woocommerce"))})]}),(0,d.jsxs)("span",{className:"woocommerce-analytics-import-status-bar__item",children:[(0,d.jsx)("span",{className:"woocommerce-analytics-import-status-bar__label",children:(0,o.__)("Next update","woocommerce")}),(0,d.jsx)("span",{className:"woocommerce-analytics-import-status-bar__value",children:t?(0,d.jsx)(c.Spinner,{}):(e=>e?(0,a.dateI18n)((0,o.__)("M j \\a\\t H:i","woocommerce"),e,void 0):(0,o.__)("Never","woocommerce"))(e?.next_scheduled||null)})]}),(0,d.jsx)(c.Button,{variant:"tertiary",onClick:async()=>{try{await r(),_("success",(0,o.__)("Analytics import has started. Your store data will be updated soon.","woocommerce"),{type:"snackbar",isDismissible:!0})}catch(e){_("error",e instanceof Error?e.message:(0,o.__)("Failed to trigger analytics update.","woocommerce"),{isDismissible:!0})}},disabled:t||w,"aria-disabled":t||w,"aria-busy":w,className:"woocommerce-analytics-import-status-bar__trigger","aria-label":w?(0,o.__)("Analytics data import in progress","woocommerce"):(0,o.__)("Manually trigger analytics data import","woocommerce"),children:w?(0,d.jsx)(c.Spinner,{}):(0,o.__)("Update now","woocommerce")})]})})]});var v}var p=r(29491),w=r(66087),v=r(27752),y=r(98846),b=r(77374),f=r(83306),g=r(94111),h=r(56109);class S extends i.Component{constructor(){super(),this.onDateSelect=this.onDateSelect.bind(this),this.onFilterSelect=this.onFilterSelect.bind(this),this.onAdvancedFilterAction=this.onAdvancedFilterAction.bind(this)}onDateSelect(e){const{report:t,addCesSurveyForAnalytics:r}=this.props;r(),(0,f.recordEvent)("datepicker_update",{report:t,...(0,w.omitBy)(e,w.isUndefined)})}onFilterSelect(e){const{report:t,addCesSurveyForAnalytics:r}=this.props,o=e.filter||e["filter-variations"];["single_product","single_category","single_coupon","single_variation"].includes(o)&&r();const a={report:t,filter:e.filter||"all"};"single_product"===e.filter&&(a.filter_variation=e["filter-variations"]||"all"),(0,f.recordEvent)("analytics_filter",a)}onAdvancedFilterAction(e,t){const{report:r,addCesSurveyForAnalytics:o}=this.props;switch(e){case"add":(0,f.recordEvent)("analytics_filters_add",{report:r,filter:t.key});break;case"remove":(0,f.recordEvent)("analytics_filters_remove",{report:r,filter:t.key});break;case"filter":const e=Object.keys(t).reduce(((e,r)=>(e[(0,w.snakeCase)(r)]=t[r],e)),{});o(),(0,f.recordEvent)("analytics_filters_filter",{report:r,...e});break;case"clear_all":(0,f.recordEvent)("analytics_filters_clear_all",{report:r});break;case"match":(0,f.recordEvent)("analytics_filters_all_any",{report:r,value:t.match})}}render(){const{advancedFilters:e,filters:t,path:r,query:o,showDatePicker:a,defaultDateRange:c}=this.props,{period:l,compare:s,before:i,after:m}=(0,b.getDateParamsFromQuery)(o,c),{primary:n,secondary:u}=(0,b.getCurrentDates)(o,c),_={period:l,compare:s,before:i,after:m,primaryDate:n,secondaryDate:u},p=this.context;return(0,d.jsx)(y.ReportFilters,{query:o,siteLocale:h.ne.siteLocale,currency:p.getCurrencyConfig(),path:r,filters:t,advancedFilters:e,showDatePicker:a,onDateSelect:this.onDateSelect,onFilterSelect:this.onFilterSelect,onAdvancedFilterAction:this.onAdvancedFilterAction,dateQuery:_,isoDateFormat:b.isoDateFormat})}}S.contextType=g.CurrencyContext;const x=(0,p.compose)((0,l.withSelect)((e=>{const{woocommerce_default_date_range:t}=e(s.settingsStore).getSetting("wc_admin","wcAdminSettings");return{defaultDateRange:t}})),(0,l.withDispatch)((e=>{const{addCesSurveyForAnalytics:t}=e(v.STORE_KEY);return{addCesSurveyForAnalytics:t}})))(S);function A(e){return(0,d.jsxs)("div",{className:"woocommerce-analytics-report-header",children:[(0,d.jsx)(x,{...e}),!!window.wcAdminFeatures?.["analytics-scheduled-import"]&&(0,d.jsx)(_,{})]})}},2592:(e,t,r)=>{r.r(t),r.d(t,{default:()=>x});var o=r(86087),a=r(27723),c=r(18537),l=r(52619),s=r(47143),i=r(40314),m=r(33958);const n=(0,l.applyFilters)("woocommerce_admin_customers_report_filters",[{label:(0,a.__)("Show","woocommerce"),staticParams:["paged","per_page"],param:"filter",showFilters:()=>!0,filters:[{label:(0,a.__)("All Customers","woocommerce"),value:"all"},{label:(0,a.__)("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:m.wd,labels:{placeholder:(0,a.__)("Type to search for a customer","woocommerce"),button:(0,a.__)("Single Customer","woocommerce")}}}]},{label:(0,a.__)("Advanced filters","woocommerce"),value:"advanced"}]}]),u=(0,l.applyFilters)("woocommerce_admin_customers_report_advanced_filters",{title:(0,a._x)("Customers match