1(globalThis.webpackChunk_N_E=globalThis.webpackChunk_N_E||[]).push([[8585,5154],{33321:(e,l,t)=>{"use strict";t.d(l,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var a,s=t(67294);function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var t=arguments[l];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let __WEBPACK_DEFAULT_EXPORT__=e=>s.createElement("svg",_extends({xmlns:"http://www.w3.org/2000/svg",className:"cross-circular_svg__svg-icon",style:{width:"1em",height:"1em",verticalAlign:"middle",fill:"currentColor",overflow:"hidden"},viewBox:"0 0 1024 1024"},e),a||(a=s.createElement("path",{d:"M647.744 285.696 512 421.504 376.256 285.696l-90.56 90.56L421.504 512 285.76 647.744l90.496 90.496L512 602.496 647.744 738.24l90.496-90.496L602.496 512 738.24 376.256zm226.304-135.744c-199.936-199.936-524.16-199.936-724.096 0-199.936 199.936-199.936 524.16 0 724.096 199.936 199.936 524.16 199.936 724.096 0 199.936-199.936 199.936-524.16 0-724.096m-90.496 633.6c-149.952 149.952-393.088 149.952-543.04 0s-149.952-393.088 0-543.04c149.952-149.952 393.088-149.952 543.04 0 149.952 149.952 149.952 393.024 0 543.04"})))},11803:(e,l,t)=>{"use strict";t.d(l,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var a,s=t(67294);function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var t=arguments[l];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}let __WEBPACK_DEFAULT_EXPORT__=e=>s.createElement("svg",_extends({xmlns:"http://www.w3.org/2000/svg",fill:"none",className:"google_svg__shrink-0",viewBox:"0 0 20 20"},e),a||(a=s.createElement("g",{clipPath:"url(#google_svg__a)"},s.createElement("path",{fill:"#4285F4",d:"M19.805 10.23c0-.68-.055-1.363-.172-2.032H10.2v3.851h5.402a4.63 4.63 0 0 1-2 3.039v2.499h3.223c1.893-1.742 2.98-4.314 2.98-7.357"}),s.createElement("path",{fill:"#34A853",d:"M10.2 20c2.697 0 4.971-.885 6.629-2.413l-3.223-2.5c-.896.61-2.054.956-3.402.956-2.61 0-4.821-1.76-5.615-4.126H1.264v2.576A10 10 0 0 0 10.2 20"}),s.createElement("path",{fill:"#FBBC04",d:"M4.586 11.917a6 6 0 0 1 0-3.829V5.512H1.264a10.01 10.01 0 0 0 0 8.98z"}),s.createElement("path",{fill:"#EA4335",d:"M10.2 3.958a5.43 5.43 0 0 1 3.836 1.5l2.855-2.856A9.6 9.6 0 0 0 10.2.001a10 10 0 0 0-8.936 5.511l3.321 2.576c.79-2.37 3.006-4.13 5.615-4.13"}))))},15835:(e,l,t)=>{"use strict";t.d(l,{hrr:()=>a.hrr});var a=t(63750)},52600:(e,l,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/campaign-details/google",function(){return t(61860)}])},61860:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>campaign_details_google});var a=t(75766),s=t(72253),r=t(14932),n=t(91309),i=t(4586),o=t(85893),d=t(67294),c=t(11163),u=t(23834),m=t(88767),g=t(69346),x=t(40805),p=t(30809),v=t(55053),h=t(45291),y=t(37366),f=t(67756),_=t(11803),b=t(47636),j=t(51856),N=t(85857),C=t(35331),w=t(40274),D=t(19849),A=t(71312),E=t(41529),I=t(82332),T=t(79389),G=t(28312),k=t(33276),O=t(47120);let google_KeywordsInsightsAccordion=function(e){var l=e.keywordsInsightsDetails,t=e.className,a=(0,i._)(l).sort(function(e,l){return Number(l.metrics.clicks)-Number(e.metrics.clicks)}),s=(0,o.jsx)(O.Z,{title:"Keywords Analytics",children:(0,o.jsx)("div",{className:"overflow-x-auto mt-3 no-scrollbar",children:(0,o.jsxs)("table",{className:"min-w-full border-collapse border border-gray-300",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"bg-gray-100 text-gray-700 text-xs lg:text-sm",children:[(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Keyword"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-right",children:"Views"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-right",children:"Clicks"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-right",children:"Conversion"})]})}),(0,o.jsx)("tbody",{children:null==a?void 0:a.map(function(e,l){var t;return(0,o.jsxs)("tr",{className:"border border-gray-300 text-xxs lg:text-sm",children:[(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:e.adGroupCriterion.keyword.text}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2 text-right",children:e.metrics.impressions}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2 text-right",children:e.metrics.clicks}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2 text-right",children:null===(t=e.metrics.allConversions)||void 0===t?void 0:t.toLocaleStr
1ing()})]},l)})})]})})});return(0,o.jsx)("div",{className:"px-4 py-2 lg:mt-5 lg:px-6 lg:py-5 bg-white rounded-lg lg:rounded-xl shadow lg:shadow-sm lg:border lg:border-gray-200 ".concat(void 0===t?"":t),children:s})};var P=t(11971),L=t(79870),S=t(88028),F=t(21803),R=t(24243),Z=t(1278);let google_LocationsInsightsAccordion=function(e){var l=e.locationsInsightsDetails,t=e.className,a=(0,i._)(l).sort(function(e,l){return Number(l.metrics.clicks)-Number(e.metrics.clicks)}),s=(0,o.jsx)(O.Z,{title:"Locations Analytics",children:(0,o.jsx)("div",{className:"overflow-x-auto mt-3 no-scrollbar",children:(0,o.jsxs)("table",{className:"min-w-full border-collapse border border-gray-300",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"bg-gray-100 text-gray-700 text-xs lg:text-sm",children:[(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Location"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-right",children:"Views"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-right",children:"Clicks"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-right",children:"Conversion"})]})}),(0,o.jsx)("tbody",{children:null==a?void 0:a.map(function(e,l){var t,a,s,r;return(0,o.jsxs)("tr",{className:"border border-gray-300 text-xxs lg:text-sm",children:[(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:null!==(r=null===(s=e.segments)||void 0===s?void 0:null===(a=s.geoTargetCityCanonicalName)||void 0===a?void 0:null===(t=a.split(","))||void 0===t?void 0:t.join(", "))&&void 0!==r?r:""}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2 text-right",children:e.metrics.impressions}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2 text-right",children:e.metrics.clicks}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2 text-right",children:e.metrics.allConversions})]},l)})})]})})});return(0,o.jsx)("div",{className:"px-4 py-2 lg:mt-5 lg:px-6 lg:py-5 bg-white rounded-lg lg:rounded-xl shadow lg:shadow-sm lg:border lg:border-gray-200 ".concat(void 0===t?"":t),children:s})},CallInsightsAccordion=function(e){var l=e.callsInsightsDetails,t=e.className,a=(0,o.jsx)(O.Z,{title:"Call Analytics",children:(0,o.jsx)("div",{className:"overflow-x-auto mt-3 no-scrollbar",children:(0,o.jsxs)("table",{className:"min-w-full border-collapse border border-gray-300",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"bg-gray-100 text-gray-700 text-xs lg:text-sm",children:[(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Start Time"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"End Time"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-right",children:"Duration (sec)"}),(0,o.jsx)("th",{className:"border border-gray-300 px-4 py-2 text-right",children:"Status"})]})}),(0,o.jsx)("tbody",{children:null==l?void 0:l.map(function(e,l){var t=e.callView,a=t.callDurationSeconds,s=t.startCallDateTime,r=t.endCallDateTime,n=t.callStatus,i=(0,x.gU)(new Date(s),{day:"numeric",month:"short",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0}),d=(0,x.gU)(new Date(r),{day:"numeric",month:"short",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0});return(0,o.jsxs)("tr",{className:"border border-gray-300 text-xxs lg:text-sm",children:[(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:i}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2",children:d}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2 text-right",children:a}),(0,o.jsx)("td",{className:"border border-gray-300 px-4 py-2 text-right capitalize",children:n.toLowerCase()})]},l)})})]})})});return(0,o.jsx)("div",{className:"px-4 py-2 lg:px-6 lg:py-5 bg-white rounded-lg lg:rounded-xl shadow lg:shadow-sm lg:border lg:border-gray-200 ".concat(void 0===t?"":t),children:a})};var K=t(5152),M=t.n(K),U=t(99065),B=t(28433),V=M()(function(){return Promise.all([t.e(3218),t.e(816)]).then(t.bind(t,23218))},{loadableGenerated:{webpack:function(){return[23218]}},ssr:!1});let google_GoogleCampaignInfoTab=function(e){var l,t,a,s,r,i,u,v=e.className,y=e.campaignDetails,f=e.mediaAssetsDetails,_=e.user,O=e.campaignInsightsDetails,K=e.partnerConfig,M=e.onCampaignStatusUpdate,z=e.keywordsInsightsDetails,q=e.locationsInsightsDetails,W=e.callInsightsDetails,X=null==y?void 0:y.google_ads_data,Q=(0,n._)((0,d.useState)(!1),2),H=Q[0],J=Q[1],Y=(0,n._)((0,d.useState)(!1),2),$=Y[0],ee=Y[1],el=(0,n._)((0,d.useState)(!1),2),et=el[0],ea=el[1],es=(0,m.useMutation)(p.pw),er=(0,c.useRouter)(),makeApiCallToUpdateCampaignStatus=function(e){es.mutateAsync({headers:(0,g.Ny)(_),queryParams:er.query,data:{id:y.id,status:e}},{onError:function(e){(0,x.F4)(e,"GoogleCampaignInfoTab.updateCampaignStatus")},onSuccess:function(){M()}})},en=(0,m.useQuery)(["getOrderDetails",null==y?void 0:y.order_id],function(){return(0,C.s$)({orderId:null==y?void 0:y.order_id,headers:(0,g.Ny)(_)})},{retry:0,enabled:!!(null==y?void 0:y.order_id),onError:function(e){(0,x.F4)(e,"GoogleCampaignInfoTab.orderDetailsResponse")}}),ei=null!==(u=null==en?void 0:null===(l=en.data)||void 0===l?void 0:l.data)&&void 0!==u?u:null,eo=null===(a=y.google_ads_data)||void 0===a?void 0:null===(t=a.lead_form_url)||void 0===t?void 0:t.includes("connectform.co/lead-forms");return(0,o.jsxs)("div",{className:"flex flex-col flex-1 overflow-y-hidden h-full ".concat(void 0===v?"":v),children:[(0,o.jsxs)("div",{className:"flex flex-col flex-1 overflow-y-scroll no-scrollbar pb-32 lg:pb-1",children:[(0,o.jsx)(j.Z,{googleAdsData:X,mediaAssetsDetails:f,type:null==y?void 0:y.type,campaignDetails:y}),(0,o.jsxs)("div",{className:"mt-4 bg-white rounded-lg shadow p-4 lg:p-5 lg:p-7 lg:rounded-xl lg:border lg:border-gray-200 lg:shadow-sm",children:[(0,o.jsx)("p",{className:"font-medium text-sm lg:text-lg lg:text-xl lg:text-gray-900 lg:mb-4",children:"Locations"}),(0,o.jsx)(w.Z,{geoLocations:null==X?void 0:X.geo_locations,className:"mt-3 lg:mt-0"}),(0,o.jsx)(D.Z,{campaignDetails:y,className:"mt-3 gap-2 items-center",adPlatform:N.Vm.GOOGLE})]}),O?(0,o.jsx)(V,{campaignDetails:y,data:O,className:"mt-4"}):(0,o.jsx)("div",{className:"mt-4 py-6 flex items-center justify-center text-center bg-white shadow rounded-lg w-full",children:(0,o.jsx)(h.Z,{size:35})}),(null==y?void 0:y.type)===b.Bu.GOOGLE_SEARCH?(0,o.jsx)(A.Z,{leadgenForm:null==y?void 0:null===(s=y.details)||void 0===s?void 0:s.leadgen_form,googleAdsData:X,campaignStatus:null==y?void 0:y.status,adPlatform:null==y?void 0:y.platform}):null,(null==y?void 0:y.type)===b.Bu.GOOGLE_P_MAX?(0,o.jsx)(P.Z,{url:null==y?void 0:null===(i=y.details)||void 0===i?void 0:null===(r=i.business_details)||void 0===r?void 0:r.website}):null,[N.Vm.META,N.Vm.GOOGLE].includes(y.platform)&&[b.o3.ACTIVE].includes(null==y?void 0:y.status)&&[b.Uy.LIVE].includes(y.running_status)?(0,o.jsx)(B.ZP,{user:_,campaignDetails:y}):null,[N.Vm.META,N.Vm.GOOGLE].includes(y.platform)&&[b.o3.ACTIVE,b.o3.ARCHIVED].includes(y.status)?(0,o.jsx)(U.Z,{user:_,campaignDetails:y}):null,X?(0,o.jsx)(o.Fragment,{children:(null==y?void 0:y.type)===b.Bu.GOOGLE_P_MAX?(0,o.jsx)(L.Z,{googleAdsData:X,className:"mt-4 lg:mt-5"}):eo?null:(0,o.jsx)(G.Z,{googleAdsData:X,className:"mt-4 lg:mt-5"})}):null,(null==z?void 0:z.length)?(0,o.jsx)(google_KeywordsInsightsAccordion,{keywordsInsightsDetails:z}):(0,o.jsx)(k.Z,{googleAdsData:X}),(null==W?void 0:W.length)?(0,o.jsx)(CallInsightsAccordion,{callsInsightsDetails:W}):null,(null==q?void 0:q.length)?(0,o.jsx)(google_LocationsInsightsAccordion,{locationsInsightsDetails:q}):null,(null==ei?void 0:ei.status)==="paid"?(0,o.jsx)(S.Z,{campaignDetails:y,user:_}):null]}),(0,o.jsx)(E.Z,{orderDetails:ei,campaignDetails:y,onExtendCampaignClick:function(){return ee(!0)},onPaymentSuccess:function(){M(),en.refetch()},user:_,partnerConfig:K,onDuplicateCampaignClick:function(){return J(!0)},onStopCampaignClick:function(){return ea(!0)}}),H?(0,o.jsx)(I.Z,{campaignDetails:y,user:_,onClose:function(){return J(!1)}}):null,$?(0,o.jsx)(T.Z,{campaignDetails:y,user:_,onClose:function(){return ee(!1)}}):null,et?(0,o.jsx)(F.Z,{onStopCampaignClick:function(){(0,R.logEvent)(Z.K.stop_campaign_clicked),makeApiCallToUpdateCampaignStatus(b.o3.ARCHIVED),ea(!1)},loading:es.isLoading,onClose:function(){return ea(!1)}}):null]})};var z=t(16410),q=t(5154);let campaign_details_google=function(e){var l,t,j,N,C,w,D,A,E,I,T,G,k,O,P,L,S,F,R,Z=e.user,K=e.partnerConfig,M=(0,c.useRouter)(),U=M.query[u.az.CAMPAIGN_ID],B=M.query[u.az.SOURCE],V=(0,n._)((0,d.useState)(u.iy[0].id),2),W=V[0],X=V[1],Q=M.query[u.az.SELECTED_TAB];(0,d.useEffect)(function(){if(Q){var e;X((null===(e=u.iy.find(function(e){return e.id===Q}))||void 0===e?void 0:e.id)||u.iy[0].id)}},[Q]);var H=(0,n._)((0,d.useState)(!1),2),J=H[0],Y=H[1],$=(0,m.useQuery)(["getCampaignDetails",U],function(){return(0,p.C9)({headers:(0,g.Ny)(Z),queryParams:M.query})},{retry:0,enabled:!!U,onError:function(e){(0,x.F4)(e,"GoogleCampaignDetails.getCampaignDetails")}}),ee=null!==(L=null==$?void 0:null===(l=$.data)||void 0===l?void 0:l.data)&&void 0!==L?L:null,el=null==ee?void 0:ee.google_ads_data,et=(0,m.useQuery)(["getGoogleMediaAssetsDetails",U],function(){var e,l,t,n,o,d,c,m,x,p;return(0,y.Kb)({headers:(0,g.Ny)(Z),queryParams:(0,r._)((0,s._)({},M.query),(0,a._)({},u.az.ASSET_RESOURCE_NAMES,null===(l=(0,i._)(null!==(c=null==el?void 0:null===(t=el.media_assets)||void 0===t?void 0:t.MARKETING_IMAGE)&&void 0!==c?c:[]).concat((0,i._)(null!==(m=null==el?void 0:null===(n=el.media_assets)||void 0===n?void 0:n.YOUTUBE_VIDEO)&&void 0!==m?m:[]),(0,i._)(null!==(x=null==el?void 0:null===(o=el.media_assets)||void 0===o?void 0:o.SQUARE_MARKETING_IMAGE)&&void 0!==x?x:[]),(0,i._)(null!==(p=null==el?void 0:null===(d=el.media_assets)||void 0===d?void 0:d.PORTRAIT_MARKETING_IMAGE)&&void 0!==p?p:[])))||void 0===l?void 0:null===(e=l.map(function(e){return e.resource_name}))||void 0===e?void 0:e.join(",")))})},{retry:0,enabled:!!(null==el?void 0:el.media_assets)&&[b.Bu.GOOGLE_P_MAX,b.Bu.GOOGLE_APP_INSTALL].includes(ee.type),onError:function(e){(0,x.F4)(e,"GoogleCampaignDetails.getGoogleMediaAssetsDetails")}}),ea=(0,m.useQuery)(["getGoogleInsights",U],function(){return(0,y.i_)({queryParams:(0,r._)((0,s._)({},M.query),(0,a._)({},u.az.CAMPAIGN_ID,ee.id)),headers:(0,g.Ny)(Z)})},{retry:0,enabled:!!(null==ee?void 0:null===(t=ee.google_ads_data)||void 0===t?void 0:t.campaign_resource),onError:function(e){(0,x.F4)(e,"GoogleCampaignDetails.getGoogleInsights")}});(0,d.useEffect)(function(){Z||M.push("/login")},[Z,M]);var es=null!==(F=null!==(S=null==ee?void 0:ee.friendly_name)&&void 0!==S?S:null==ee?void 0:null===(N=ee.details)||void 0===N?void 0:null===(j=N.business_details)||void 0===j?void 0:j.business_category)&&void 0!==F?F:"",er=null!==(R=null==et?void 0:null===(C=et.data)||void 0===C?void 0:C.data)&&void 0!==R?R:[],en=(null==ea?void 0:null===(D=ea.data)||void 0===D?void 0:null===(w=D.data)||void 0===w?void 0:w.campaign)?(0,x.cy)({insightsArr:null==ea?void 0:null===(E=ea.data)||void 0===E?void 0:null===(A=E.data)||void 0===A?void 0:A.campaign}):null,ei=null==ea?void 0:null===(T=ea.data)||void 0===T?void 0:null===(I=T.data)||void 0===I?void 0:I.keywords,eo=null==ea?void 0:null===(k=ea.data)||void 0===k?void 0:null===(G=k.data)||void 0===G?void 0:G.locations,ed=null==ea?void 0:null===(P=ea.data)||void 0===P?void 0:null===(O=P.data)||void 0===O?void 0:O.calls;return Z?(0,o.jsxs)("div",{className:"flex-1 h-full w-full bg-white lg:max-w-[1400px] xl:max-w-[1600px] lg:mx-auto",children:[(0,o.jsxs)("div",{className:"flex flex-col flex-1 h-full w-full",children:[(0,o.jsxs)("div",{className:"flex items-center mt-4 lg:px-6",children:[(0,o.jsx)("div",{className:"p-3 cursor-pointer hover:bg-gray-50 rounded-full transition-colors",onClick:function(){var e,l=window.innerWidth>=768?"/web/dashboard":"/dashboard";"newTab"===B?null===(e=window)||void 0===e||e.close():window.history.length>1?M.back():M.push(l)},children:(0,o.jsx)(v.Z,{})}),(0,o.jsxs)("p",{className:"text-black text-lg lg:text-3xl lg:ml-2 font-medium cursor-pointer line-clamp-2",onClick:function(){return Y(!0)},children:[es," ",es?"\uD83D\uDD8Aï¸":""]}),(0,o.jsx)("div",{className:"flex-1"}),(0,o.jsxs)("div",{className:"px-2 flex items-center space-x-3",children:[(0,o.jsx)("div",{children:(0,o.jsx)(_.Z,{className:"w-5 h-5 lg:w-7 lg:h-7"})}),(0,o.jsx)("div",{className:"lg:scale-110",children:ee?(0,o.jsx)(f.Z,{campaignDetails:ee}):null})]})]}),ee?(0,o.jsxs)(o.Fragment,{children:[(null==ee?void 0:ee.id)?(0,o.jsx)("div",{className:"flex items-center px-4 lg:px-6 lg:mx-12 mt-5 border-b border-gray-light",children:(0,o.jsx)("div",{className:"flex w-full lg:w-auto lg:gap-10",children:u.iy.map(function(e,l){if("leads"===e.id)return null;var t=e.id===W;return(0,o.jsx)("div",{className:"flex-1 lg:flex-none cursor-pointer pb-4 transition-all relative ".concat(t?"border-b-2 border-primary":"border-b-2 border-transparent hover:border-gray-200"),onClick:function(){return X(e.id)},children:(0,o.jsx)("p",{className:"text-sm lg:text-lg text-center px-2 ".concat(t?"font-bold text-primary":"text-gray-500 font-medium"),children:e.label})},l)})})}):null,(0,o.jsx)("div",{className:"flex flex-col flex-1 mt-4 px-4 lg:px-6 lg:mx-12 pb-10 overflow-hidden",children:W===u.iy[0].id?(0,o.jsx)(google_GoogleCampaignInfoTab,{campaignDetails:ee,mediaAssetsDetails:er,user:Z,campaignInsightsDetails:en,onCampaignStatusUpdate:function(){$.refetch()},partnerConfig:K,keywordsInsightsDetails:ei,locationsInsightsDetails:eo,callInsightsDetails:ed}):(0,o.jsx)(q.default,{campaignDetails:ee,user:Z})})]}):(0,o.jsx)("div",{className:"flex flex-col items-center justify-center mt-12 flex-1",children:(0,o.jsx)(h.Z,{})})]}),J?(0,o.jsx)(z.Z,{campaignDetails:ee,user:Z,onClose:function(){return Y(!1)},onCampaignUpdated:function(){$.refetch()}}):null]}):null}},5154:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var a=t(75766),s=t(72253),r=t(14932),n=t(85893),i=t(23834),o=t(88767),d=t(69346),c=t(35331),u=t(85857),m=t(66715),g=t(40805),x=t(45291),p=t(76005),v=t
1(15207),h=t(37366),CustomTooltip=function(e){var l,t,a,s=e.active,r=e.payload,i=e.label;if(!s||!r||!r.length)return null;var o=r[0].payload;return(0,n.jsxs)("div",{className:"bg-white border rounded p-2 shadow text-xs min-w-[100px] w-max",children:[(0,n.jsx)("p",{className:"text-base mb-2",children:i}),(0,n.jsxs)("div",{className:"space-y-1.5",children:[(0,n.jsxs)("div",{className:"flex justify-between gap-4",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"CTR:"}),(0,n.jsxs)("span",{className:"font-semibold",children:[null!==(a=null===(t=o.ctr)||void 0===t?void 0:null===(l=t.toFixed)||void 0===l?void 0:l.call(t,2))&&void 0!==a?a:0,"%"]})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-4",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"Clicks:"}),(0,n.jsx)("span",{className:"font-semibold",children:o.clicks})]}),(0,n.jsxs)("div",{className:"flex justify-between gap-4",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"Impressions:"}),(0,n.jsx)("span",{className:"font-semibold",children:o.impressions})]})]})]})};let __WEBPACK_DEFAULT_EXPORT__=function(e){var l,t,y,f,_,b,j=e.campaignDetails,N=e.user,C=new Date,w=new Date;w.setDate(C.getDate()-90);var D=JSON.stringify({since:w.toISOString().split("T")[0],until:C.toISOString().split("T")[0]}),A=(0,o.useQuery)(["metaDayWiseInsightsResponse",j.id],function(){var e;return(0,c.nK)({queryParams:(e={},(0,a._)(e,i.az.CAMPAIGN_ID,null==j?void 0:j.meta_id),(0,a._)(e,i.az.TIME_INCREMENT,"1"),(0,a._)(e,i.az.TIME_RANGE,D),(0,a._)(e,i.az.LIMIT,"250"),e),headers:(0,d.Ny)(N)})},{retry:0,enabled:!!(null==j?void 0:j.meta_id),onError:function(e){(0,g.F4)(e,"ConversionsChartComp.getCampaignInsights")}}),E=(0,o.useQuery)(["googleDayWiseInsightsResponse",j.id],function(){return(0,h.mu)({queryParams:(0,a._)({},i.az.CAMPAIGN_ID,null==j?void 0:j.id),headers:(0,d.Ny)(N)})},{retry:0,enabled:(null==j?void 0:j.platform)===u.Vm.GOOGLE,onError:function(e){(0,g.F4)(e,"ConversionsChartComp.getGoogleDayWiseInsights")}});if(A.isLoading||E.isLoading)return(0,n.jsx)("div",{className:"flex flex-col items-center justify-center flex-1",children:(0,n.jsx)(x.Z,{})});var I=null!==(b=null!==(_=null==A?void 0:null===(l=A.data)||void 0===l?void 0:l.data)&&void 0!==_?_:null==E?void 0:null===(y=E.data)||void 0===y?void 0:null===(t=y.data)||void 0===t?void 0:t.map(function(e){var l,t;return(0,r._)((0,s._)({},(0,g.cy)({insightsArr:[e]})),{date_start:null===(l=e.segments)||void 0===l?void 0:l.date,date_stop:null===(t=e.segments)||void 0===t?void 0:t.date})}))&&void 0!==b?b:[],T=null==j?void 0:null===(f=j.details)||void 0===f?void 0:f.budget_and_scheduling,G=(0,g.Ky)(T),k=I.map(function(e){var l,t,a,r=parseFloat(null!==(a=e.spend)&&void 0!==a?a:"0"),n=(r*=100/(100-(null==T?void 0:T.platform_fee_percentage)))/G.exchange_rate,i=new Date(e.date_start),o=i.getDate(),d=i.toLocaleString("en-US",{month:"short"}),c=(null==j?void 0:j.platform)===u.Vm.GOOGLE?e.conversions:(0,g.cp)(e,j.type),x=(null===(t=(0,m._D)({insights:e,campaignDetails:j}))||void 0===t?void 0:null===(l=t.find(function(e){return"conversion_rate"===e.key}))||void 0===l?void 0:l.formatted_value)||null;return(0,s._)({date:"".concat(o," ").concat(d),conversions:c,spent:Math.round(n),currency:null==T?void 0:T.currency,cpco:Number(c?(n/c).toFixed(2):0),ctr:parseFloat(e.ctr||"0")||(parseInt(e.impressions||"0")?(parseInt(e.clicks||"0")/parseInt(e.impressions||"0")*100).toFixed(2):0),clicks:parseInt(e.clicks||"0"),impressions:parseInt(e.impressions||"0")},null!==x&&{conversion_rate:parseFloat(x)})}),tooltipFormatter=function(e,l,t){var a=e,s=l,r=t.payload;return"cpco"===l?(s="CPCo",a=(0,g.ZO)(Number(e),null==r?void 0:r.currency)):"conversions"===l?s="Conversions":"spent"===l?(s="Amount Spent",a=(0,g.ZO)(Number(e),null==r?void 0:r.currency)):"conversion_rate"===l&&(s="Conversion Rate",a="".concat(Number(e).toFixed(2),"%")),[a,s]};return(null==I?void 0:I.length)&&0!==k.length?(0,n.jsx)("div",{className:"flex flex-col flex-1 h-full px-4 pb-4 overflow-y-hidden ",children:(0,n.jsxs)("div",{className:" flex-1 overflow-y-scroll no-scrollbar ",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-primary mt-6",children:"Conversions"}),(0,n.jsx)(p.dk,{data:k,xAxisDataKey:"date",yAxisDataKey:"conversions",syncId:"syncId1",tooltipFormatter:tooltipFormatter}),(0,n.jsx)("p",{className:"text-sm font-medium text-primary mt-6",children:"Amount Spent"}),(0,n.jsx)(p.Sr,{data:k,xAxisDataKey:"date",yAxisDataKey:"spent",syncId:"syncId1",tooltipFormatter:tooltipFormatter}),(0,n.jsx)("p",{className:"text-sm font-medium text-primary mt-6",children:"Amount Spent per Conversion"}),(0,n.jsx)(p.dk,{data:k,xAxisDataKey:"date",yAxisDataKey:"cpco",syncId:"syncId1",tooltipFormatter:tooltipFormatter}),(0,n.jsx)("p",{className:"text-sm font-medium text-primary mt-6",children:"Engagement (CTR)"}),(0,n.jsx)(p.Nm,{data:k,xAxisDataKey:"date",lines:[{dataKey:"ctr",stroke:"#294744",name:"CTR",yAxisId:"left"}],syncId:"syncId1",CustomToolTip:CustomTooltip}),k.some(function(e){return e.conversion_rate&&null!=e.conversion_rate})&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-primary mt-6",children:"Good Leads (Conversion Rate)"}),(0,n.jsx)(p.Nm,{data:k,xAxisDataKey:"date",lines:[{dataKey:"conversion_rate",stroke:"#294744",name:"Conversion Rate",yAxisId:"left"}],syncId:"syncId1",tooltipFormatter:tooltipFormatter})]}),(0,n.jsx)("div",{className:"mt-4"})," "]})}):(0,n.jsx)(v.Z,{})}},76005:(e,l,t)=>{"use strict";t.d(l,{Nm:()=>o,Sr:()=>i,dk:()=>n});var a=t(85893),s=t(5152),r=t.n(s),ChartLoader=function(){return(0,a.jsx)("div",{className:"flex items-center justify-center h-56",children:(0,a.jsx)("div",{className:"animate-spin w-8 h-8 border-2 border-blue-500 border-t-transparent roun
1ded-full"})})},n=r()(function(){return Promise.all([t.e(6711),t.e(6108),t.e(8833)]).then(t.bind(t,98833))},{loadableGenerated:{webpack:function(){return[98833]}},ssr:!1,loading:ChartLoader}),i=r()(function(){return Promise.all([t.e(6711),t.e(9596)]).then(t.bind(t,49596))},{loadableGenerated:{webpack:function(){return[49596]}},ssr:!1,loading:ChartLoader});r()(function(){return Promise.all([t.e(6711),t.e(6108),t.e(6880),t.e(7032)]).then(t.bind(t,87032))},{loadableGenerated:{webpack:function(){return[87032]}},ssr:!1,loading:ChartLoader});var o=r()(function(){return Promise.all([t.e(6711),t.e(6880),t.e(4045)]).then(t.bind(t,14045))},{loadableGenerated:{webpack:function(){return[14045]}},ssr:!1,loading:ChartLoader})},15207:(e,l,t)=>{"use strict";t.d(l,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var a=t(85893),s=t(15835);let __WEBPACK_DEFAULT_EXPORT__=function(e){var l=e.className;return(0,a.jsx)("div",{className:l,children:(0,a.jsxs)("div",{className:"flex items-center justify-center my-6 text-center border-2 border-dashed border-gray-200 rounded-xl p-8 max-w-md w-full flex-col mx-auto",children:[(0,a.jsx)("div",{className:"mx-auto mb-3 w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center",children:(0,a.jsx)(s.hrr,{className:"text-gray-400",size:24})}),(0,a.jsx)("p",{className:"text-base font-medium text-gray-700",children:"No insights available"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"We couldnât find amount spend data and insights for this period."})]})})}}},e=>{var __webpack_exec__=l=>e(e.s=l);e.O(0,[260,2013,3609,5675,8767,8388,7455,46,5400,3700,4773,367,1941,2137,893,9774,2888,179],()=>__webpack_exec__(52600)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.