1import{m as Ee,c as $e,g as Be,r as o,n as se,X as We,E as Me,f as qe,a5 as Ve,u as ne,A as Y,j as t,T as N,B as Ge,G as n,s as He,R as Ue,S,$ as Xe}from"./index-CrrhTvkO.js";import{A as m}from"./ABMData-wxEQ1kL5.js";/* empty css */import{T as D}from"./TabPanel-BqVfOIUc.js";import{A as T}from"./ABMEndpoints-Cjzircar.js";import{T as re}from"./DataTable-BPmiJJbC.js";import{g as oe}from"./generateColumns-lWMHsPxT.js";import{L as Ye,l as ze}from"./LinearProgress-DB0t_fPl.js";import"./MaterialReactTable-DBRZ1yDb.js";import"./ArrowRight-Drh1WwZb.js";import"./Edit-CkcVNR3N.js";import"./MoreHoriz-Ce_1sjIb.js";import"./PushPin-Tqlub7hJ.js";import"./Collapse-5NBhrKyK.js";import"./InputAdornment-Dj7oPPE2.js";import"./Divider-Dv9gCdPn.js";import"./Slider-Dp5EmFxh.js";import"./usePreviousProps-R2oYi4l6.js";const Je=(R,z)=>{let g=[];return R.forEach((y,L)=>{let P=Intl.DateTimeFormat("en",{month:"short"}).format(new Date(y.toString()));g.push(`${P} ${z[L]}`)}),g},St=()=>{const[R]=Ee(),{userData:z}=R,g=$e(),y=Be(),[L,P]=o.useState("$");let[ie,F]=o.useState(m.accountCards()),[ce,I]=o.useState(m.companyDetails());const[r,O]=o.useState({start_date:se.getPastValueFromToday(6),end_date:se.getCurrentDate()}),{width:le}=We();let[de,E]=o.useState(m.webActivityData());const[Ke,x]=o.useState(!1);Me();const[ue,me]=o.useState([]),[pe,ge]=o.useState([]),[_e,he]=o.useState([]),[xe,ye]=o.useState([]),[be,ve]=o.useState([]),[fe,je]=o.useState([]),[$,Se]=o.useState(0),[J,Ce]=o.useState(5),[B,ke]=o.useState(0),[K,we]=o.useState(5),[Qe,C]=o.useState(!0),[Ze,et]=o.useState([]),[d,W]=o.useState(m.accountEmailActivity()),[Ae,M]=o.useState(!1),[q,V]=o.useState(!0),[tt,G]=o.useState(!0),[Q,b]=o.useState(!0);window.scrollTo(0,0);const[Ne,H]=o.useState("-"),l=qe(),{state:p}=Ve(),[Z,v]=o.useState(!1),[at,st]=o.useState(!1),[f,De]=o.useState({keyName:"",sortDirection:"desc"}),[j,Te]=o.useState({keyName:"",sortDirection:"desc"});o.useEffect(()=>{const e=ne.getItem("dateRanges");e?(r.start_date=e==null?void 0:e.start_date,r.end_date=e==null?void 0:e.end_date,O({...r})):O(Fe()),ee()},[]);const ee=()=>{const e=Re(),a=Le();te(),ae(),Promise.all([e,a]).then(()=>{x(!1)}).catch(i=>{x(!1),g.addToast({message:i.message||"Something went wrong",timeout:2e3,type:"error"})})},te=async()=>{var i,c,u,_,h,A;G(!0),v(!0),x(!0);let e=$>0?$-1:$;const a={headers:{},reqBody:{start_date:r==null?void 0:r.start_date,end_date:r==null?void 0:r.end_date,account_id:p==null?void 0:p.accountId,limit:J,skip:e*J,sort_by_type:f==null?void 0:f.sortDirection,sort_by_column:(f==null?void 0:f.keyName)||"Oppr_Created_Date",count_total:!0}};try{const s=await y.post(T.get_abmAccount_details(a),!0),U={table_data:{columns:((i=s==null?void 0:s.data)==null?void 0:i.table_columns)??[],special_characters:((c=s==null?void 0:s.data)==null?void 0:c.special_characters)??[]}};G(!1),v(!1);const X=oe(U);me(X),he((_=(u=s==null?void 0:s.data)==null?void 0:u.table_data)==null?void 0:_.count_total),ge((A=(h=s==null?void 0:s.data)==null?void 0:h.table_data)==null?void 0:A.data)}catch(s){console.error("API Error:",s),w({months:[],account_score:[]}),G(!1),v(!1),C(!0),g.addToast({message:s.message||"Something went wrong",timeout:2e3,type:"error"})}finally{x(!1)}},ae=async()=>{var i,c,u,_,h,A;b(!0),x(!0);let e=B>0?B-1:B;const a={reqBody:{start_date:r==null?void 0:r.start_date,end_date:r==null?void 0:r.end_date,account_id:p==null?void 0:p.accountId,limit:K,skip:e*K,sort_by_type:j==null?void 0:j.sortDirection,sort_by_column:(j==null?void 0:j.keyName)||"Contact_Score",count_total:!0}};try{const s=await y.post(T.get_abmAccount_contact(a),!0);b(!1);const U={table_data:{columns:((i=s==null?void 0:s.data)==null?void 0:i.table_columns)??[],special_characters:((c=s==null?void 0:s.data)==null?void 0:c.special_characters)??[]}},X=oe(U);ye(X),je((_=(u=s==null?void 0:s.data)==null?void 0:u.table_data)==null?void 0:_.count_total),ve((A=(h=s==null?void 0:s.data)==null?void 0:h.table_data)==null?void 0:A.data)}catch(s){console.error("API Error:",s),b(!1),w({months:[],account_score:[]}),C(!0),g.addToast({message:s.message||"Something went wrong",timeout:2e3,type:"error"})}finally{x(!1)}},Re=async()=>{x(!0),V(!0);const e={headers:{},reqBody:{start_date:r==null?void 0:r.start_date,end_date:r==null?void 0:r.end_date,account_id:p==null?void 0:p.accountId}};return await y.post(T.get_Account_details(e),!0).then(a=>{var i,c;V(!1),Ie(a==null?void 0:a.data),P((c=(i=a==null?void 0:a.data)==null?void 0:i.special_characters)==null?void 0:c.Amount)}).catch(a=>{V(!1),I(m.companyDetails()),H("-"),F(m.accountCards()),w({months:[],account_score:[]}),C(!0),W(m.accountEmailActivity()),g.addToast({message:a.message||"Something went wrong",timeout:2e3,type:"error"})})},Le=async()=>{M(!0);const e={headers:{},reqBody:{start_date:r.start_date,end_date:r.end_date,account_id:p==null?void 0:p.accountId}};return await y.post(T.get_webActivity_details(e),!0).then(a=>{M(!1),Oe(a==null?void 0:a.data)}).catch(a=>{M(!1),E(m.webActivityData()),g.addToast({message:a.message||"Something went wrong",timeout:2e3,type:"error"})})},Pe=e=>{r.start_date=e.startDate,r.end_date=e.endDate,O({...r}),ee(),ae(),te(),ne.setItem("dateRange",{start_date:e.startDate,end_date:e.endDate})},Fe=()=>({start_date:r.start_date,end_date:r.end_date}),k=(e,a=!1)=>{const i=()=>e===0?"transparent":a?e<=10?"#02BC77":e<=30?"#F5A149":"#FF003D":e<=49?"#FF003D":e<=89?"#F5A149":"#02BC77",c=Xe(Ye)(({theme:u})=>({height:15,borderRadius:5,backgroundColor:"#92919130",[`& .${ze.bar}`]:{borderRadius:5,backgroundColor:i()}}));return t.jsx(c,{variant:"determinate",value:e,classes:{root:"linear__loader__custom"}})},[nt,w]=o.useState(),Ie=e=>{if(e.org_data&&Object.keys(e.org_data).length){const i=e.org_data.map(u=>{var _,h;return{...u,value:u.key==="Revenue"&&u.value!=="-"?`${((_=e==null?void 0:e.special_characters)==null?void 0:_.Amount)??"$"} ${(h=Y)==null?void 0:h.amountFormat(u.value)}`:u.value}});I(i);const c=e!=null&&e.org_data[0].value?e==null?void 0:e.org_data[0].value:"-";H(c)}else I(m.companyDetails()),H("-");if(e.cards_data&&Object.keys(e.cards_data).length){const i=e.cards_data.map(c=>{var u;return{...c,value:(u=Y)==null?void 0:u.amountFormat(c.value)}});F(i)}else F(m.accountCards());if(e.engagement_trend&&Object.keys(e.engagement_trend).length){let a=Je(e.engagement_trend.months,e.engagement_trend.year);w({months:a,account_score:e.engagement_trend.account_score,engaged:e.engagement_trend.engaged}),C(!1)}else w({months:[],account_score:[]}),C(!0);if(e.Email_Activity&&Object.keys(e.Email_Activity).length){const i=e.Email_Activity.map(c=>({...c,displayValue:c.key,value:c.value}));W(i)}else W(m.accountEmailActivity())},Oe=e=>{const i=e.Web_Activity.map(c=>({...c,name:c.key,value:c.value}));e.Web_Activity&&Object.keys(e.Web_Activity).length?E(i):E(m.webActivityData())};return t.jsxs("div",{className:"ABM",children:[t.jsxs("div",{className:"commonPageHeading",style:{...l.palette.commonPageHeadingNavbarStyle,...l.palette.outerAppStyle},children:[t.jsxs("div",{style:{width:"20%"},children:[t.jsx(N,{variant:"h5",component:"span",color:l.palette.text.primary,children:"ABM"}),t.jsx(Ge,{breadCrumbsList:m.getDashboardBreadcumbs()})]}),t.jsxs(n,{container:!0,display:"flex",justifyContent:"end",style:le<822?{display:"contents"}:{}
1,children:[t.jsx(He,{left:"0rem"}),t.jsx(n,{item:!0,display:"flex",justifyContent:"end",alignItems:"center",children:t.jsx(Ue,{widthCheckOnFormat:!0,start_date:r.start_date,end_date:r.end_date,onChange:Pe,minLastYear:2,showComparison:!1})})]})]}),t.jsxs("div",{className:"accountDashboard",children:[t.jsx(n,{container:!0,children:t.jsx(n,{item:!0,xs:12,style:{padding:"2rem 1rem 0rem 1rem"},children:q?t.jsx(S,{variant:"rounded",style:{borderRadius:"20px",padding:"0px 17px"},width:"100%",height:201}):t.jsxs("div",{className:"details",style:{backgroundColor:l.palette.background.alt,border:l.palette.mode==="dark"?`1px solid ${l.palette.neutral.main}`:"unset",justifyContent:"normal"},children:[t.jsx("div",{className:"accountCard_cards",style:{backgroundColor:l.palette.background.alt,border:l.palette.mode==="dark"?`1px solid ${l.palette.neutral.main}`:"unset",width:"20%"},children:t.jsx("div",{className:"cardTitle",style:{paddingTop:"5px"},children:Ne})}),t.jsx("div",{className:"accountCard_cards",style:{backgroundColor:l.palette.background.alt,border:l.palette.mode==="dark"?`1px solid ${l.palette.neutral.main}`:"unset",display:"flex",flexDirection:"row",width:"79%",marginLeft:"9px"},children:ce.map((e,a)=>(e==null?void 0:e.key)!=="Company"?t.jsxs("div",{className:"accountCard",style:{flexDirection:"column"},children:[t.jsx("div",{className:"cardTitle",style:{paddingTop:"5px"},children:(e==null?void 0:e.key)||(e==null?void 0:e.keyName)}),t.jsx("div",{className:"dashboardCardValue",children:(e==null?void 0:e.key)!=="Domain"?e==null?void 0:e.value:t.jsx("a",{style:{color:"inherit"},target:"_blank",rel:"noopener noreferrer",href:(e==null?void 0:e.value)==="-"?"":e==null?void 0:e.value,children:(()=>{if(!(e!=null&&e.value)||(e==null?void 0:e.value)==="-")return"";try{const i=new URL(e.value);return i.pathname.replace(/\/$/,"")||i.hostname}catch{return e.value}})()})})]},a):"")})]})})}),t.jsx(n,{container:!0,className:"accountCard",children:Array.from(ie).map((e,a)=>t.jsx(n,{item:!0,xs:2,children:q?t.jsx(S,{variant:"rounded",style:{borderRadius:"20px",padding:"0px 17px"},width:"100%",height:201}):t.jsxs("div",{className:"accountCard_cards",style:{backgroundColor:l.palette.background.alt,border:l.palette.mode==="dark"?`1px solid ${l.palette.neutral.main}`:"unset"},children:[t.jsx("div",{className:"cardTitle",style:{paddingTop:"5px"},children:e.key?e.key:e.name}),t.jsx("div",{className:"dashboardCardValue",style:{paddingTop:"5px",fontWeight:e.value=="-"?200:"bold"},children:e.key==="Closed Won"||e.key==="Current Pipeline"?` ${L??"$"} ${e.value}`:e.value})]})},a))}),t.jsxs(n,{container:!0,className:"Campaign__outerframe",style:{paddingTop:"30px",display:"flex",flexDirection:"column"},children:[t.jsx("div",{className:"Campaign__tabs",style:{paddingLeft:"17px"},children:t.jsx(D,{tabs:["Web Activity"]})}),t.jsx(n,{id:"summary",item:!0,xs:12,style:{padding:"0px 17px 0px 17px"},children:Ae?t.jsx(S,{variant:"rounded",style:{borderRadius:"20px",padding:"0px 17px"},width:"100%",height:279}):t.jsx("div",{className:"details",style:{backgroundColor:l.palette.background.alt,border:l.palette.mode==="dark"?`1px solid ${l.palette.neutral.main}`:"unset"},children:t.jsx(n,{container:!0,style:{padding:"28px 0px 28px 0px",justifyContent:"space-evenly"},className:"accountCard",children:de.map((e,a)=>{var i;return t.jsx(n,{children:t.jsxs("div",{className:"accountCard_cards web_activity",style:{backgroundColor:l.palette.background.alt,border:l.palette.mode==="dark"?`1px solid ${l.palette.neutral.main}`:"unset"},children:[t.jsx("div",{className:"cardTitle",style:{paddingTop:"5px"},children:e.name}),t.jsx("div",{className:"dashboardCardValue",style:{paddingTop:"5px",fontWeight:e.value=="-"?200:"bold"},children:(i=Y)==null?void 0:i.amountFormat(e.value)})]})},a)})})})})]}),t.jsxs(n,{container:!0,className:"Campaign__outerframe",style:{paddingTop:"30px"},children:[t.jsx("div",{className:"Campaign__tabs",style:{paddingLeft:"17px"},children:t.jsx(D,{tabs:["Email Activity"]})}),t.jsx(n,{id:"summary",item:!0,xs:12,style:{padding:"0px 17px 0px 17px"},children:q?t.jsx(S,{variant:"rounded",style:{borderRadius:"20px",padding:"0px 17px"},width:"100%",height:250}):t.jsx(t.Fragment,{children:t.jsx(n,{children:t.jsxs(n,{container:!0,display:"flex",alignItems:"center",style:{margin:"0rem",boxShadow:"0 25px 30px #0000001a",borderRadius:"20px",minHeight:"270px",padding:"2rem",backgroundColor:l.palette.background.light},className:"SFScoring__card",children:[t.jsxs(n,{container:!0,className:"SFScoring__mainScore__item",display:"flex",alignItems:"center",justifyContent:"space-between",children:[t.jsx(n,{item:!0,xs:1.5,className:"SFScoring__mainScore__item__name",children:"Deliverability"}),t.jsx(n,{item:!0,xs:9.5,children:d[0].total===0?k(d[0].value/100*100):k(d[0].value/d[0].total*100)}),t.jsx(n,{item:!0,xs:1,textAlign:"center",children:t.jsxs(N,{className:"width_95_margin_0_auto overall",id:"networkClicks",component:"div",variant:"h6",fontWeight:"bold",children:[d[0].value,"/",t.jsx("span",{className:"SFScoring__totalRange",children:d[0].total})]})})]}),t.jsxs(n,{container:!0,xs:12,className:"SFScoring__mainScore__item",display:"flex",alignItems:"center",justifyContent:"space-between",children:[t.jsx(n,{item:!0,xs:1.5,className:"SFScoring__mainScore__item__name",children:"CTR"}),t.jsx(n,{item:!0,xs:9.5,children:k(d[1].value/d[1].total*100)}),t.jsx(n,{item:!0,xs:1,textAlign:"center",children:t.jsxs(N,{className:"width_95_margin_0_auto overall",id:"networkClicks",component:"div",variant:"h6",fontWeight:"bold",children:[d[1].value,"/",t.jsx("span",{className:"SFScoring__totalRange",children:d[1].total})]})})]}),t.jsxs(n,{container:!0,className:"SFScoring__mainScore__item",display:"flex",alignItems:"center",justifyContent:"space-between",children:[t.jsx(n,{item:!0,xs:1.5,className:"SFScoring__mainScore__item__name",children:"Open Rate"}),t.jsx(n,{item:!0,xs:9.5,children:k(d[2].value/d[2].total*100)}),t.jsx(n,{item:!0,xs:1,textAlign:"center",children:t.jsxs(N,{className:"width_95_margin_0_auto overall",id:"networkClicks",component:"div",variant:"h6",fontWeight:"bold",children:[d[2].value,"/",t.jsx("span",{className:"SFScoring__totalRange",children:d[2].total})]})})]}),t.jsxs(n,{container:!0,className:"SFScoring__mainScore__item",display:"flex",alignItems:"center",justifyContent:"space-between",children:[t.jsx(n,{item:!0,xs:1.5,className:"SFScoring__mainScore__item__name",children:"Unsubscribed Rate"}),t.jsx(n,{item:!0,xs:9.5,children:k(d[3].value/d[3].total*100,!0)}),t.jsx(n,{item:!0,xs:1,textAlign:"center",children:t.jsxs(N,{className:"width_95_margin_0_auto overall",id:"networkClicks",component:"div",variant:"h6",fontWeight:"bold",children:[d[3].value,"/",t.jsx("span",{className:"SFScoring__totalRange",children:d[3].total})]})})]})]})})})})]}
1),t.jsxs(n,{container:!0,className:"Campaign__outerframe",style:{padding:"30px 17px",display:"flex",flexDirection:"column"},children:[t.jsx("div",{className:"Campaign__tabs",children:t.jsx(D,{tabs:["Opportunity Overview"]})}),t.jsx(S,{variant:"rounded",style:{borderRadius:"25px",marginBottom:"20px",display:Z?"block":"none"},width:"100%",height:350}),t.jsx("div",{style:{display:Z?"none":"block"},children:t.jsx(re,{columns:ue,data:pe,enablePagination:!1,style:{margin:0},defineMargin:"0px",totalRows:_e,sortServer:!1,showPagination:!0,serverPagination:!1,handlePageChange:e=>{v(!1),Se(e)},handlePerRowsChange:e=>{v(!1),Ce(e)},handleSort:(e,a)=>{De({keyName:e.key,sortDirection:a}),v(!1)}})}),t.jsx("div",{className:"Campaign__tabs",children:t.jsx(D,{tabs:["Contact Overview"]})}),t.jsx(S,{variant:"rounded",style:{borderRadius:"25px",marginBottom:"20px",display:Q?"block":"none"},width:"100%",height:350}),t.jsx("div",{style:{display:Q?"none":"block"},children:t.jsx(re,{columns:xe,data:be,enablePagination:!1,style:{margin:0},defineMargin:"0px",totalRows:fe,sortServer:!1,showPagination:!0,serverPagination:!1,handlePageChange:e=>{b(!1),ke(e)},handlePerRowsChange:e=>{b(!1),we(e)},handleSort:(e,a)=>{Te({keyName:e.key,sortDirection:a}),b(!1)}})})]})]})]})};export{St as default}; 2//# sourceMappingURL=AccountDashboard-jvTm-s4I.js.map
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.