(window.webpackJsonp=window.webpackJsonp||[]).push([[60],{1120:function(e,t,a){"use strict";a.r(t);var n=a(0),r=a(2),o=a(240),c=a(795),i=a(786),l=a(65),s=a(5),m=a(89),u=a(3),p=(a(1121),a(814)),d=a(64),b=a(36),f=a(242);function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var a=[],n=!0,r=!1,o=void 0;try{for(var c,i=e[Symbol.iterator]();!(n=(c=i.next()).done)&&(a.push(c.value),!t||a.length!==t);n=!0);}catch(e){r=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return y(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a<t;a++)n[a]=e[a];return n}t.default=function(e){var t=e.campaignType;Object(p.a)("orders","",!0,!0,!1,t);var a=e.campaignId,y=i.a.getConversionData(),O=i.a.getConversionLoading(),g=i.a.getConversionLimit(),h=i.a.getConversionOffset(),j=i.a.getConversionTotal(),v=Object(c.a)(),_=v.fetchConversion,k=v.setConversionValues,C=Object(l.a)(Object(s.V)()).formatAmount;Object(n.useEffect)((function(){_(a,g,h)}),[g,h]);var E=[{key:"orderid",label:Object(r.__)("Order ID","wp-marketing-automations"),cellClassName:"bwf-crm-col-stats-m"},{key:"contact",label:Object(r.__)("Contact","wp-marketing-automations"),required:!0,cellClassName:"bwf-crm-col-contact"},{key:"purchaseitems",label:Object(r.__)("Purchased Items","wp-marketing-automations"),cellClassName:"bwf-crm-col-contact-details"},{key:"revenue",label:Object(r.__)("Revenue","wp-marketing-automations"),cellClassName:"bwf-crm-col-stats-m"},{key:"date",label:Object(r.__)("Date","wp-marketing-automations"),cellClassName:"bwf-crm-col-stats-m"}],P=i.a.getConversionPage(),N=function(e){e!==g&&(k("limit",e),k("offset",0))},A=function(e){return Object(n.createElement)(b.a,{href:"admin.php?page=autonami&path=/contact/"+e.cid,type:"bwf-crm",className:"bwf-crm-campaign-order-contact-link bwf-a-no-underline",key:e.cid},Object(n.createElement)(f.a,{contact:e,date:e.date,dateText:Object(r.__)("Placed on","wp-marketing-automations")}))},I=function(e){return e.hasOwnProperty("order_deleted")&&e.order_deleted?Object(n.createElement)(n.Fragment,null,"#"+e.wcid):Object(n.createElement)("a",{target:"_blank",className:"bwf-a-no-underline",href:"post.php?post="+e.wcid+"&action=edit"},"#"+e.wcid)},S=y.map((function(e){return[{display:e.hasOwnProperty("wcid")?I(e):"-",value:e.hasOwnProperty("wcid")?e.wcid:"-"},{display:A(e),value:e.hasOwnProperty("contact_name")?e.contact_name:"-"},{display:e.hasOwnProperty("items")?(t=e.items,a="",o=[],Object.entries(t).map((function(e){var t=w(e,2),r=t[0],c=t[1];Object(u.isEmpty)(a)&&(a=Object(n.createElement)("a",{className:"bwf-a-no-underline",target:"_blank",href:"post.php?action=edit&post="+r,rel:"noreferrer"},c)),o.push(Object(n.createElement)("a",{className:"bwf-a-no-underline",target:"_blank",href:"post.php?action=edit&post="+r},c))})),Object(n.createElement)(n.Fragment,null,Object(u.isEmpty)(a)?"-":a,!Object(u.isEmpty)(o)&&o.length>1&&Object(n.createElement)(m.a,{items:o}))):Object(r.__)("Order Deleted","wp-marketing-automations"),value:"purchase_item"},{display:e.hasOwnProperty("wctotal")?C(e.wctotal):"-",value:e.hasOwnProperty("wctotal")?e.wctotal:0},{display:e.hasOwnProperty("date")?Object(s.K)(e.date):"-",value:e.hasOwnProperty("date")?e.date:"-"}];var t,a,o}));return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(d.a,null),Object(n.createElement)(o.a,{className:"bwf-crm-campaign-report-conversion",rows:S,headers:E,query:{paged:P},rowsPerPage:g,totalRows:j,isLoading:O,onPageChange:function(e,t){k("offset",(e-1)*g)},onQueryChange:function(e){return"per_page"!==e?function(){}:N},rowHeader:!0,showMenu:!1,emptyMessage:Object(r.__)("No orders found","wp-marketing-automations"),hideHeader:"yes"}))}},1121:function(e,t,a){}}]);