"use strict";(self.webpackChunkautonami=self.webpackChunkautonami||[]).push([[9305],{76628(e,t,a){a.r(t),a.d(t,{default:()=>_});var n=a(86087),r=a(14014),o=a(27723),i=a(99611),m=a(16432),s=a(43690),l=a(92650),c=a(36766),u=a(97482),p=a(10163),d=a(66087),f=a(87361),g=a(83583),y=a(39078),w=(a(13032),a(26387)),E=a(88766);function b(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?v(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a<t;a++)n[a]=e[a];return n}const _=function(){var e=(0,y.Zr)(),t=e.isFeaturesLocked,a=e.isLite;(0,r.A)("engagement",!1,"");var v=(0,u.A)(),_=v.fetchEngagementData,h=v.setEngagementData,A=c.A.getEngagementAnalytics,k=(0,c.A.getEngagementAnalyticsLoading)(),N=A(),M=(0,s.$Z)(),L=function(e){var t=function(e){return e.compare="previous_year",(0,p.lI)(e).primary}(e),a="",n="";t&&((0,d.isEmpty)(t.after)||(a=t.after.format("YYYY-MM-DD HH:mm:ss")),(0,d.isEmpty)(t.before)||(n=t.before.format("YYYY-MM-DD 23:59:59")),(0,d.isEmpty)(a)||(0,d.isEmpty)(n)||_(a,n))};M.hasOwnProperty("period")||(M.period="month");var S=M.period,F=M.compare,Y=M.interval,D=M.after,x=M.before;(0,n.useEffect)(function(){if((0,g.Ls)((0,o.__)("Engagement Analytics","wp-marketing-automations")),t){for(var e=[1,2,3,4,5,6,7].map(function(e){return{day:e,mean:Math.random().toFixed(4),open:1,total:1}}),a=[],n=0;n<24;n++)a.push({hour:n,mean:Math.random().toFixed(4),open:1,total:1});h("data",{day:e,hour:a}),h("isLoading",!1)}else L(M)},[S,F,Y,D,x]);var I,C=[(0,o.__)("Monday","wp-marketing-automations"),(0,o.__)("Tuesday","wp-marketing-automations"),(0,o.__)("Wednesday","wp-marketing-automations"),(0,o.__)("Thursday","wp-marketing-automations"),(0,o.__)("Friday","wp-marketing-automations"),(0,o.__)("Saturday","wp-marketing-automations"),(0,o.__)("Sunday","wp-marketing-automations")],O=function(e,t){return k?(0,n.createElement)(n.Fragment,null,function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=b(Array(7));return e||(t=b(Array(24))),(0,n.createElement)("ul",{className:"bwf-report-section"},t.map(function(e,t){return(0,n.createElement)("li",{className:"bwf-report-e-list",key:t},(0,n.createElement)("div",{className:"bwf-report-e-label"},(0,n.createElement)("div",{className:"bwf-placeholder-temp bwf-h-15 bwf-w-210"})),(0,n.createElement)("div",{className:"bwf-report-e-value"},(0,n.createElement)("div",{className:"bwf-placeholder-temp bwf-h-15 bwf-w-100p"})))}))}(t)):(0,d.isEmpty)(e)?(0,o.__)("No data Available","wp-marketing-automations"):(0,n.createElement)("ul",{className:"bwf-report-section"},e.map(function(e,a){return(0,n.createElement)("li",{className:"bwf-report-e-list",key:a},(0,n.createElement)("div",{className:"bwf-report-e-label"},t?C[parseInt(e.day)-1]:(r=e.hour,r+" ("+((r%12||12)+(r>11?"PM":"AM"))+")")),(0,n.createElement)("div",{className:"bwf-report-e-value"},(0,n.createElement)(i.A,{status:"info",size:"sm",progress:e.total&&e.open?(100*e.mean).toFixed(2):0,noStriped:!0,text:"".concat(e.total&&e.open?(100*e.mean).toFixed(2):0," %")})));var r}))};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"bwf-content-header-new"},(0,n.createElement)("div",{className:"bwf-content-header-left"},(0,n.createElement)("div",{className:"bwf-content-header-title"},(0,o.__)("Engagements","wp-marketing-automations")))),(0,n.createElement)(f.A,null),(0,n.createElement)("div",{className:"bwf-crm-analytics-wrap bwf-report-engagement-wrapper"},!a&&t&&(0,n.createElement)(w.A,{onPage:!0,modalContent:{proLink:(0,g.L4)("upgrade",{utm_medium:"Engagement+Analytics+Upgrade+Modal"})}}),(0,n.createElement)(m.uR,{query:M},a&&(0,n.createElement)(E.A,{title:(0,o.__)("Engagement Analytics","wp-marketing-analytics"),message:(0,o.__)("Use our sample data to explore Engagement Analytics. Use these trends to find out best time to send campaigns.","wp-marketing-automations"),proLink:(0,g.L4)("upgrade",{utm_medium:"Engagement+Analytics+Sample+Data+Notice"})})),(0,n.createElement)("div",{className:"bwf-accordian-wrap"},(0,n.createElement)(l.A,{items:(I=[],I.push({key:1,label:(0,o.__)("Open by Weekday","wp-marketing-automations"),display:O((0,d.isEmpty)(N)?[]:N.day,!0)},{key:2,label:(0,o.__)("Open by Hour","wp-marketing-automations"),display:O((0,d.isEmpty)(N)?[]:N.hour,!1)}),I)}))))}}}]);