1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1786,63],{42437:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/csv-excel-chart",function(){return s(17880)}])},48925:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(85893);s(67294);var l=s(89755),i=s.n(l),r=s(41664),n=s.n(r),d=s(92640);function c(e){let{page_list:t,style:s,showOnMobile:l=!1}=e,r=t[0],c=t.slice(-1)[0],o=t.slice(1,-1),x=(0,d.i)();return(0,a.jsx)("nav",{className:"flex","aria-label":"Breadcrumb",style:{...s},children:(l||x.width>1280)&&(0,a.jsxs)("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[(0,a.jsx)("li",{className:"inline-flex items-center list-none",children:(0,a.jsx)(n(),{legacyBehavior:!0,href:r.url?r.url:"",children:(0,a.jsx)("a",{className:"inline-flex items-center text-xs text-gray-50 hover:text-blue ",children:r.title})})}),0!==o.length?o.map((e,t)=>(0,a.jsx)("li",{className:"list-none",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(i(),{width:12,height:12,src:"/assets/img/icon/chevron-right.svg"}),(0,a.jsx)("a",{href:e.url?e.url:"",className:"ml-1 font-medium text-xs text-gray-50 hover:text-blue",children:e.title})]})},t)):null,(0,a.jsx)("li",{"aria-current":"page",className:"list-none",children:(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(i(),{width:12,height:12,src:"/assets/img/icon/chevron-right.svg"}),(0,a.jsx)(n(),{legacyBehavior:!0,href:c.url?c.url:"",children:(0,a.jsx)("a",{children:(0,a.jsx)("span",{className:"flex items-center ml-1 text-xs font-medium text-gray-50 hover:text-blue",children:c.title})})})]})})]})})}},50063:function(e,t,s){"use strict";s.r(t),s.d(t,{ApexDoughnutChart:function(){return c}});var a=s(85893),l=s(5152),i=s.n(l),r=s(63335),n=s(85718);let d=i()(()=>Promise.all([s.e(5279),s.e(7229)]).then(s.bind(s,47229)),{loadableGenerated:{webpack:()=>[47229]},ssr:!1}),c=e=>{let{labels:t,centerText:s="",values:l=[],legendPosition:i="right",showTotal:c=!0,height:o="100%",showLabel:x=!0,showLegend:h=!0,pieOptions:u,colors:m=n.D}=e,p={series:null==l?void 0:l.map(e=>parseInt(e,10)),options:{chart:{type:"donut"},labels:t,colors:m,plotOptions:{pie:{donut:{size:"50%",labels:{show:x,total:{showAlways:c,show:c,label:s,formatter(e){let t=e.config.series.reduce((e,t)=>e+t);return(0,r.OD)(t)}}}},...u}},legend:{show:h,position:i,offsetX:0,offsetY:0},dataLabels:{dropShadow:{enabled:!1}}}};return(0,a.jsx)(d,{options:p.options,series:p.series,type:"donut",width:"100%",height:o})};t.default=c},41725:function(e,t,s){"use strict";var a=s(85893),l=s(5152),i=s.n(l),r=s(30381),n=s.n(r),d=s(63335),c=s(66929);let o=i()(()=>Promise.all([s.e(5279),s.e(7229)]).then(s.bind(s,47229)),{loadableGenerated:{webpack:()=>[47229]},ssr:!1});t.Z=e=>{var t;let{uniqueTooltip:s,x_values:l=[],series:i=[],annotations:r,strokeWidth:x=4,strokeCurve:h="smooth",forecastPoints:u=0,timeline:m=!1,dateformat:p="MMM D",height:v="300px",yaxis_settings:f,sorting:j=!0,xaxis_title:g,yaxis_title:b,isShowYAxisLines:y=!0,isShowXAxisLines:N=!1,legendPosition:w="bottom",type:_="area",customType:C=null,formatterDisable:S=!1,isPercentageYAxis:k=!1,yAxisFormatter:Z=e=>k?S?"".concat(Math.trunc(e),"%"):"".concat((0,d.OD)(e),"%"):S?"".concat(null==e?void 0:e.toFixed(2)):"".concat((0,d.OD)(e)),isZoomEnabled:A=!0,customXaxisLabel:D=null,customMarkers_:T=null,customTooltip:E=null,customTickAmount:I=null,customMarkerClick:B=null,dashArray:M=0}=e,F=Array.isArray(i)?[...i]:[];!0===j&&(null===(t=F[0])||void 0===t?void 0:t.data)&&(F=(F=F.map(e=>{let t=null==e?void 0:e.data.reduce((e,t)=>parseInt(e,10)+parseInt(t,10),0);return{...e,average:t}})).sort((e,t)=>t.average-e.average));let L=Array.isArray(l)?l:[],P={series:F,options:{legend:{position:w},grid:{yaxis:{lines:{show:y}},xaxis:{lines:{show:N}}},tooltip:E||{custom:s},chart:{height:350,type:"line",zoom:{enabled:A},events:{markerClick:B||(()=>{})}},forecastDataPoints:{count:u},dataLabels:{enabled:!1},stroke:{width:x,curve:h,dashArray:M},xaxis:{tickAmount:I,type:!0===m?"datetime":"category",categories:L,labels:D||{formatter(e){let t=n()(new Date(e));return t.isValid()?t.format(p):e}},title:{text:g}},yaxis:{labels:{formatter:Z},title:{text:b}},colors:c.D,layout:{padding:0},markers:T||{}}};return r&&(P.options.annotations=r),f&&(P.options.yaxis=f),(0,a.jsx)(o,{options:P.options,series:P.series,type:C||_,width:"100%",height:v,className:"p-2 static"})}},68789:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a=s(85893);function l(e){let{width:t=24,height:s=24,className:l}=e;return(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,width:t,height:s,stroke:"currentColor",className:l,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})})}s(67294)},66264:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a=s(85893);function l(e){let{width:t=24,height:s=24,className:l}=e;return(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,width:t,height:s,stroke:"currentColor",className:l,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}s(67294)},94187:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a=s(85893);function l(e){let{width:t=24,height:s=24,className:l}=e;return(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor",width:t,height:s,className:l,children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})}s(67294)},64466:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a=s(85893);function l(e){let{width:t=24,height:s=24,className:l}=e;return(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,width:t,height:s,stroke:"currentColor",className:l,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})})}s(67294)},54809:function(e,t,s){"use strict";s.d(t,{Z:function(){return y}});var a=s(85893),l=s(94184),i=s.n(l),r=s(67294),n=s(92640),d=s(41664),c=s.n(d),o=s(73487),x=s(95591),h=s(3964),u=e=>{let{children:t,noLeftSidebar:s,hideFooter:l}=e,r=(0,n.i)(),{data:d}=(0,x.ZP)("application/version",()=>o.l.get_version().then(e=>{var t;return null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.version}));return(0,a.jsxs)("div",{className:"flex flex-col justify-between w-full min-h-screen",children:[(0,a.jsx)("div",{className:i()("w-full",r.width<1280&&"!px-4",s&&"!pl-0"),children:t}),!l&&(0,a.jsxs)("p",{className:"mb-4 mt-32 text-center text-xs xl:text-sm lg:mt-44 xl:pl-0",children:["\xa9 ",h.v.year," ",(0,a.jsx)(c(),{legacyBehavior:!0,href:"https://b2metric.com/",children:(0,a.jsx)("a",{className:"underline",children:"B2Metric"})})," ","AI Based Digital Optimization | v",d]})]})},m=s(11355),p=s(42545),v=s(67289),f=s(26004),j=s(94186),g=s(96060),b=function(){var e;let{isOpen:t,setIsOpen:s,selectedChart:l}=(0,r.useContext)(v.B),[i,n]=(0,r.useState)({label:"Daily",value:1}),[d,c]=(0,r.useState)(!1),[o,x]=(0,r.useState)(!1),[h,u]=(0,r.useState)(!1);return(0,a.jsx)(m.u.Root,{show:t,as:r.Fragment,children:(0,a.jsxs)(p.V,{as:"div",className:"fixed z-[52]",onClose:s,children:[(0,a.jsx)("div",{onClick:()=>s(!1),className:"fixed inset-0 bg-black/40","aria-hidden":"true"}),(0,a.jsxs)("div",{className:"absolute inset-0 overflow-hidden",children:[(0,a.jsx)(m.u.Child,{as:r.Fragment,enter:"ease-in-out duration-500",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in-out duration-500",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,a.jsx)(p.V.Overlay,{className:"absolute inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,a.jsx)("div",{className:"fixed inset-y-0 right-0 pl-10 max-w-full flex",children:(0,a.jsx)(m.u.Child,{as:r.Fragment,enter:"transform transition ease-in-out duration-500 sm:duration-700",enterFrom:"translate-x-full",enterTo:"translate-x-0",leave:"transform transition ease-in-out duration-500 sm:duration-700",leaveFrom:"translate-x-0",leaveTo:"translate-x-full",children:(0,a.jsxs)("div",{className:"relative w-screen max-w-3xl bg-white overflow-y-auto",children:[(0,a.jsxs)("div",{className:"flex justify-between py-5 bg-gray-95 px-5 items-center",children:[(0,a.jsx)("div",{children:(0,a.jsxs)("p",{className:"text-navy text-xl font-medium",children:["Step Slack alert for"," ",(0,a.jsx)("span",{className:"text-blue",children:null==l?void 0:null===(e=l.info)||void 0===e?void 0:e.title})]})}),(0,a.jsxs)("div",{className:"flex space-x-4",children:[(0,a.jsx)("button",{className:"text-red",onClick:()=>s(!1),children:"Cancel"}),o&&!h&&(0,a.jsxs)("button",{disabled:o,className:"flex px-3 py-2 text-white bg-green rounded-md",children:[d&&(0,a.jsx)(g.Z,{}),"Connection Successfull"]}),!o&&!h&&(0,a.jsxs)("button",{onClick:()=>{var e,t,s,a;c(!0);let r={...null==l?void 0:null===(e=l.info)||void 0===e?void 0:e.param};Object.assign(r,{header:null==l?void 0:null===(t=l.info)||void 0===t?void 0:t.title}),j.bs.insertScope(r,"https://api5.b2metric.com/api/v1"+((null===(s=l.info)||void 0===s?void 0:s.api_url)||{}),null==l?void 0:null===(a=l.info)||void 0===a?void 0:a.method,null==i?void 0:i.value).then(()=>{x(!0),c(!1),setTimeout(()=>{x(!1)},3e3)}).catch(()=>{x(!1),c(!1),u(!0),setTimeout(()=>{u(!1)},3e3)})},className:"flex px-3 py-2 text-white bg-green rounded-md",children:[d&&(0,a.jsx)(g.Z,{}),"Connect Slack"]}
1),h&&!o&&(0,a.jsxs)("button",{disabled:!0,className:"flex px-3 py-2 text-white bg-red rounded-md",children:[d&&(0,a.jsx)(g.Z,{}),"Error. Try again!"]})]})]}),(0,a.jsxs)("div",{className:"px-5 pb-40",children:[(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("h5",{className:"text-navy text-xl font-medium",children:"Preview"}),(0,a.jsx)("p",{className:"text-gray-50 text-sm",children:"This is a preview of the graph you will receive in your chosen Slack channel"}),(0,a.jsx)("div",{className:"min-h-[320px]",children:null==l?void 0:l.chart})]}),(0,a.jsxs)("div",{className:"mt-4 space-y-1 mb-10",children:[(0,a.jsx)("h5",{className:"text-navy text-xl font-medium",children:"Frequency"}),(0,a.jsx)("p",{className:"text-gray-50 text-sm",children:"How frequently you wish to receive the graph"}),(0,a.jsx)("div",{className:"max-w-xs",children:(0,a.jsx)(f.Z,{width:"100%",options:[{label:"Daily",value:1},{label:"Weekly",value:7},{label:"Monthly",value:30}],handleChange:e=>{n(e)},defaultSelect:i})})]})]})]})})})]})]})})},y=e=>{let{children:t,noLeftSidebar:s,bgColor:l,isOpen:r=!1,className:n,hideFooter:d}=e;return(0,a.jsxs)("div",{className:i()("flex flex-row relative",l,n),children:[(0,a.jsx)(b,{slackIsOpen:r}),(0,a.jsx)(u,{noLeftSidebar:s,hideFooter:d,children:t})]})}},20355:function(e,t,s){"use strict";var a=s(85893),l=s(48925),i=s(35890),r=s(75131),n=s(89755),d=s.n(n);s(67294);var c=s(92640),o=s(68789);t.Z=e=>{let{page_title:t,breadcrumb_list:s,periodVisible:n=!1,shareAreaVisible:x=!1,saveButtonHandler:h=()=>{},period:u,setPeriod:m=()=>{},filterOnClickEvent:p,extraFilters:v,extraFilters2:f,calendarButton:j=!1,calendarButtonOnClick:g,chart_id:b=null}=e,y=[{name:"All Time",value:0,year:20,text:"All Time"},{name:"3M",value:3,text:"Last 3 months"},{name:"30D",value:30,text:"Last 30 days"},{name:"15D",value:15,text:"Last 15 days"},{name:"7D",value:7,text:"Last 7 days"},{name:"1D",value:1,text:"Last day"}],N=(0,c.i)();return(0,a.jsx)("div",{children:N.width>1280?(0,a.jsxs)("div",{className:"flex justify-between items-end",children:[(0,a.jsx)("div",{className:"flex space-x-6 justify-center items-center mt-4",children:s&&(0,a.jsx)(l.Z,{page_list:s})}),x?(0,a.jsx)("div",{className:"mb-auto mt-8 flex flex-row",children:(0,a.jsx)("div",{className:"bg-blue px-3 py-1 text-sm rounded-xl text-white font-medium flex mb-2",children:(0,a.jsxs)("button",{className:"flex flex-row m-auto",onClick:h,children:[(0,a.jsx)("div",{className:"mt-1 ",children:(0,a.jsx)(d(),{width:12,height:12,src:"/assets/img/icon/save.svg",className:"mt-"})}),(0,a.jsx)("div",{className:"ml-1 mt-0.5",children:b?"UPDATE":"SAVE"})]})})}):"",v,f,n?(0,a.jsxs)("div",{className:"flex flex-row",children:[(0,a.jsx)("div",{className:"mr-2",children:(0,a.jsx)("div",{className:"flex",children:(0,a.jsx)(r.E,{value:u,onChange:m,children:(0,a.jsx)("div",{className:"flex",children:y.map(e=>(0,a.jsx)(r.E.Option,{value:e,className:"first:rounded-l-2xl last:rounded-r-2xl last:border-r-2 border-l-2 border-y-2 border-gray-80 px-4 py-3.5 cursor-pointer flex flex-row opacity-80",children:(0,a.jsx)("div",{className:"flex",children:(0,a.jsx)("div",{className:"flex",children:(0,a.jsx)("div",{className:"text-sm",children:(0,a.jsx)(r.E.Label,{as:"p",className:"font-medium ".concat((null==u?void 0:u.value)===e.value?"text-blue":"text-navy"),children:e.name})})})})},e.name))})})})}),j&&(0,a.jsx)("button",{onClick:g,className:"bg-white border-2 border-gray-80 rounded-xl px-4 py-3.5 mr-8 text-heroic-blue",children:(0,a.jsx)(o.Z,{width:20,height:20,className:" w-5 h-5"})}),!v&&(0,a.jsx)("div",{className:"flex items-center justify-center mr-8",children:(0,a.jsx)(i.Z,{onClickEvent:p})})]}):""]}):(0,a.jsxs)("div",{className:"flex-col",children:[s&&(0,a.jsx)(l.Z,{page_list:s}),(0,a.jsx)("h3",{className:"text-2xl my-2 mx-2",children:t}),(0,a.jsxs)("div",{className:"flex justify-between",children:[x?(0,a.jsx)("div",{className:"mb-auto mt-8 flex flex-row",children:(0,a.jsx)("div",{className:"bg-blue px-3 py-1 text-sm rounded-xl text-white font-medium flex mb-2 ",children:(0,a.jsxs)("button",{className:"flex flex-row m-auto",onClick:h,children:[(0,a.jsx)("div",{className:"mt-1 ",children:(0,a.jsx)(d(),{width:12,height:12,src:"/assets/img/icon/save.svg",className:"mt-"})}),(0,a.jsx)("div",{className:"ml-1 mt-0.5",children:"SAVE"})]})})}):"",n?(0,a.jsx)("div",{className:"mb-auto mt-4 xl:mt-8 flex flex-row",children:(0,a.jsx)("div",{className:"mr-2",children:(0,a.jsx)("div",{className:"flex",children:(0,a.jsx)(r.E,{value:u,onChange:m,children:(0,a.jsx)("div",{className:"flex",children:y.map(e=>(0,a.jsx)(r.E.Option,{value:e,className:"first:rounded-l-2xl last:rounded-r-2xl last:border-r-2 border-l-2 border-y-2 border-gray-80 px-4 py-3.5 cursor-pointer flex flex-row opacity-80",children:(0,a.jsx)("div",{className:"flex",children:(0,a.jsx)("div",{className:"flex",children:(0,a.jsx)("div",{className:"text-sm",children:(0,a.jsx)(r.E.Label,{as:"p",className:"font-medium ".concat((null==u?void 0:u.value)===e.value?"text-blue":"text-navy"),children:e.name})})})})},e.name))})})})})}):""]})]})})}},97093:function(e,t,s){"use strict";var a=s(85893);s(67294),t.Z=e=>{let{label:t,options:s}=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between ",children:[(0,a.jsx)("span",{className:"text-sm",children:t}),(0,a.jsx)("span",{className:"text-sm rounded-full bg-gray-80 w-8 text-center",children:s.length})]})}},10208:function(e,t,s){"use strict";var a=s(85893),l=s(89925),i=s(67294),r=s(94186),n=s(26004),d=s(66264),c=s(89755),o=s.n(c),x=s(11163),h=s(25057),u=s(97093),m=s(40693);t.Z=e=>{let{is_open:t,set_isOpen:s,chart_category:c,filters:p,options:v,onSaveClick:f,noDateRange:j=!1}=e,[g,b]=(0,i.useState)({}),[y,N]=(0,i.useState)(),[w,_]=(0,i.useState)(!1),[C,S]=(0,i.useState)(!1),k=(0,x.useRouter)(),{dashboardList:Z}=(0,i.useContext)(m.k);return(0,a.jsx)(l.Z,{isOpen:t,closeModalProp:()=>s(!1),children:(0,a.jsxs)("div",{className:"relative tracking-tighter w-96",children:[(0,a.jsx)("button",{className:"absolute right-0 text-red w-6 h-6 hover:cursor-pointer",onClick:()=>{s(!1)},children:(0,a.jsx)(o(),{src:"/assets/img/close.svg",layout:"fill"})}),(0,a.jsx)("h5",{className:"tracking-tighter text-2xl",children:"Save Chart"}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("label",{className:"ml-1",children:"Select Dashboard"}),(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)(n.Z,{placeholder:"Select a Dashboard",backgroundColor:"#fff",border:"2px s
1olid #F5F5F6",padding:"1px 5px",width:"100%",options:Z,handleChange:e=>{b({...g,dashboard_id:e.value})},isClearable:!0,formatGroupLabel:u.Z})})]}),(null==g?void 0:g.dashboard_id)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("label",{className:"ml-1",children:["Chart Name ",(0,a.jsx)("span",{className:"text-xs text-red",children:"*"})]}),(0,a.jsx)("input",{type:"text",placeholder:"Enter chart name",onChange:e=>{b({...g,name:e.target.value})},className:"py-2 px-2 mt-1 bg-white border-2 text-navy border-gray focus:outline-blue w-full rounded-xl",disabled:!(null==g?void 0:g.dashboard_id)})]}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("label",{children:"Row Number"}),(0,a.jsx)("input",{type:"text",placeholder:"Enter Row Number",onChange:e=>{b({...g,row_number:e.target.value})},className:"py-2 px-2 bg-white border-2 text-navy border-gray focus:outline-blue w-full rounded-xl",disabled:!(null==g?void 0:g.name)})]}),!j&&(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(h.Z,{hoverText:"When viewing your report on the dashboard, you always view it with this date range.",noUnderline:!0,isRight:!0,width:"72",children:(0,a.jsxs)("label",{className:"flex space-x-2 items-center",children:[(0,a.jsx)("input",{type:"checkbox",className:"w-5 h-5",checked:C,onChange:e=>S(e.target.checked)}),(0,a.jsx)("span",{children:"Save with this date range. "}),(0,a.jsxs)("i",{className:"text-gray-50 text-sm",children:[null==p?void 0:p.start_date," - ",null==p?void 0:p.end_date]})]})})})]}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)("button",{onClick:()=>{let e={...p};C||j||(null==e||delete e.start_date,null!=e&&delete e.end_date),r.$C.saveChart(g.dashboard_id,g.name,c,g.row_number,e,v).then(()=>N(!0)).then(()=>f()).then(()=>k.replace("/dashboard/".concat(g.dashboard_id))).catch(e=>{var t;return(null===(t=e.response)||void 0===t?void 0:t.status)===409?_(!0):null})},className:"py-2 px-4 bg-blue disabled:bg-gray-50 text-white rounded-xl hover:bg-navy transition delay-100",disabled:!(null==g?void 0:g.name),children:"Save"})}),y&&!w?(0,a.jsxs)("div",{className:"text-green flex",children:[(0,a.jsx)(d.Z,{width:40,height:40}),(0,a.jsx)("div",{className:"mt-2",children:"Your chart saved."})]}):null,w?(0,a.jsx)("div",{className:"text-red flex",children:(0,a.jsx)("div",{className:"mt-2",children:"This chart already exist."})}):null]})})}},1121:function(e,t,s){"use strict";var a=s(85893),l=s(94187);s(67294),t.Z=e=>{let{message:t}=e;return(0,a.jsx)("div",{className:"bg-red-90 p-4 h-auto mt-4 rounded-xl text-navy text-center font-medium flex items-center w-full",children:(0,a.jsxs)("div",{className:"m-auto flex",children:[(0,a.jsx)(l.Z,{width:20,height:20,className:"text-red "}),(0,a.jsx)("span",{className:"text-m",children:t})]})})}},41335:function(e,t,s){"use strict";var a=s(85893),l=s(64466);s(67294),t.Z=e=>{let{message:t}=e;return(0,a.jsx)("div",{className:"bg-blue-95 p-4 h-auto mt-4 rounded-xl text-navy text-center font-medium flex items-center w-full",children:(0,a.jsxs)("div",{className:"m-auto flex",children:[(0,a.jsx)(l.Z,{width:20,height:20,className:"text-blue"}),(0,a.jsx)("span",{className:"text-m",children:t})]})})}},17822:function(e,t,s){"use strict";var a=s(85893),l=s(89755),i=s.n(l),r=s(1121),n=s(41335),d=s(67294),c=s(94184),o=s.n(c);t.Z=e=>{let{title:t,extension:s,onFileChange:l,className:c,customErrMsg:x}=e,[h,u]=(0,d.useState)(),[m,p]=(0,d.useState)(),[v,f]=(0,d.useState)();return(0,d.useEffect)(()=>{v&&l(v)},[v,l]),(0,a.jsx)("div",{className:"bg-gray-500 w-full ",children:(0,a.jsx)("main",{className:"container mx-auto max-w-screen-lg h-full",children:(0,a.jsx)("article",{"aria-label":"File Upload Modal",className:"relative h-full flex flex-col ",children:(0,a.jsxs)("section",{className:"h-full overflow-auto w-full flex flex-col",children:[(0,a.jsxs)("header",{className:o()("border-dashed border-2 border-gray-80 py-12 flex flex-col justify-center items-center bg-gray-95 rounded-2xl",c),children:[(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center pt-3 pb-1.5 px-4 roun
1ded-2xl bg-white",children:[(0,a.jsx)(i(),{src:"/assets/img/icon/upload.svg",width:32,height:32}),(0,a.jsx)("span",{className:"text-blue mt-[2px] text-xs",children:"5GB"})]}),(0,a.jsx)("p",{className:"mt-4 font-medium text-navy flex px-4",children:(0,a.jsxs)("span",{children:[v?v.name:t,(0,a.jsx)("button",{id:"button",className:"underline ml-1 font-medium",onClick:()=>{document.getElementById("hidden-input").click()},children:v?"Change":"Choose"})]})}),(0,a.jsx)("input",{id:"hidden-input",type:"file",multiple:!0,className:"hidden",onChange:e=>{let t=e.target.files[0],a=t.name.split(".")[t.name.split(".").length-1];s.includes(a)?(f(t),p("Your file uploaded: ".concat(t.name)),u(void 0)):(x?u(x):u("The file type you uploaded is not supported. You need to upload .csv, .xls, .xlsx file."),p(void 0),f(void 0))}}),(0,a.jsx)("p",{id:"dataName",className:"text-gray-50 mt-1"})]}),h&&(0,a.jsx)(r.Z,{message:h}),m&&(0,a.jsx)(n.Z,{message:m})]})})})})}},17880:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return S}});var a=s(85893),l=s(9008),i=s.n(l),r=s(54809),n=s(20355),d=s(98377),c=s(67294),o=s(10208),x=s(26004),h=s(89755),u=s.n(h),m=s(17822),p=s(41994),v=s(94184),f=s.n(v),j=s(57632),g=s(41725),b=s(50063),y=s(51602),N=s(1986),w=s(26307),_=s(1388);let C={charts:{line:{id:(0,j.Z)(),src:"/assets/img/icon/line-chart.svg",chartType:"Line Chart",chart:"line"},pie:{id:(0,j.Z)(),src:"/assets/img/icon/donut-chart.svg",chartType:"Pie Chart",chart:"pie"},bar:{id:(0,j.Z)(),src:"/assets/img/icon/bar-chart.svg",chartType:"Bar Chart",chart:"bar"},table:{id:(0,j.Z)(),src:"/assets/img/icon/table.svg",chartType:"Table View",chart:"table"}},places:{chartArea:{id:"chartArea",chartIds:["line","pie","bar","table"]},mainArea:{id:"mainArea",chartIds:[]}},placesOrder:["chartArea","mainArea"]};var S=!0;t.default=()=>{let[e,t]=(0,c.useState)(),[s,l]=(0,c.useState)(!1),[h,v]=(0,c.useState)(),j={page_num:0,page_size:20,total_row_count:0},[S,k]=(0,c.useState)([]),[Z,A]=(0,c.useState)(!1),[D,T]=(0,c.useState)([]),[E,I]=(0,c.useState)(""),[B,M]=(0,c.useState)(""),[F,L]=(0,c.useState)(null),[P,O]=(0,c.useState)(null),[z,V]=(0,c.useState)(null),[R,Y]=(0,c.useState)(null),[W,H]=(0,c.useState)(null),[X,G]=(0,c.useState)(),[K,U]=(0,c.useState)(!0),q=e=>{let{src:t,chartType:s,chart:l}=e;return(0,a.jsxs)("div",{onClick:()=>{M(l)},className:f()("flex items-center justify-center flex-col hover:bg-gray-95 cursor-pointer rounded-xl tracking-tighter px-3 py-2",B===l&&"bg-blue-95"),children:[(0,a.jsx)(u(),{src:t,width:50,height:50}),(0,a.jsx)("p",{children:s})]})},J=e=>{let{userSelectedChartType:t}=e;return(0,a.jsxs)(w.Z,{children:["line"===t&&W&&(0,a.jsx)(g.Z,{x_values:W.xaxis,series:W.series}),"pie"===t&&X&&(0,a.jsx)("div",{className:"w-full h-[60vh]",children:(0,a.jsx)(b.default,{labels:X.labels,values:X.values})}),"bar"===t&&X&&(0,a.jsx)("div",{className:"w-full h-[70vh]",droppableId:"mainArea",children:(0,a.jsx)(y.Z,{x_axis:X.labels,y_values:X.values,show_legend:!1})}),"table"===t&&R&&(0,a.jsx)(N.Z,{data:null==R?void 0:R.data,columns:null==R?void 0:R.headers})]})},$=()=>{A(!0),p.B.list_data_sources().then(e=>{k(e),A(!1)})},Q=()=>{p.B.upload_csv_excel(h).then(()=>{$()})};(0,c.useEffect)(()=>{h&&Q()},[h]);let ee=()=>{p.B.column_list(E).then(e=>{T(e.columns)})};(0,c.useEffect)(()=>{$()},[]),(0,c.useEffect)(()=>{E&&(ee(),t(e=>({...e,file_name:E})))},[E]),(0,c.useEffect)(()=>{t(e=>({...e,chartType:B}))},[B]),(0,c.useEffect)(()=>{z&&("pie"===B||"bar"===B)&&(t(e=>({...e,filters:{label_column:z.value}})),p.B.custom_data_chart(E,B,JSON.stringify({label_column:z.value,...j})).then(e=>{G(e)})),z&&"line"===B&&F&&P&&(t(e=>({...e,filters:{x_axis:F,y_axis:null==P?void 0:P.map(e=>e.value)}})),p.B.custom_data_chart(E,B,{x_axis:F.value,y_axis:P.map(e=>e.value),...j}).then(e=>{H(e)})),z&&"table"===B&&(t(e=>({...e,filters:{columns:null==z?void 0:z.map(e=>e.value)}})),p.B.custom_data_chart(E,"table_view",{columns:(null==B?void 0:B.length)>0&&(null==z?void 0:z.map(e=>e.value)),...j}).then(e=>{Y(e)}))},[z,F,P]);let[et,es]=(0,c.useState)(C);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i(),{children:(0,a.jsx)("title",{children:"Chart Wizard - B2Metric"})}),(0,a.jsx)(d.Z,{}),(0,a.jsxs)(r.Z,{children:[(0,a.jsx)(n.Z,{page_title:"Chart Wizard",breadcrumb_list:[{title:"Business KPIs",url:"/"},{title:"Chart Wizard",url:"/csv-excel-chart"}],periodVisible:!1,shareAreaVisible:!0,saveButtonHandler:e=>{e.preventDefault(),l(!0)}}),(0,a.jsxs)("button",{className:"text-sm text-blue flex items-center justify-center space-x-1",onClick:()=>U(!K),children:[(0,a.jsx)("div",{className:"flex items-center ",children:K?(0,a.jsx)(u(),{className:"transition-transform",src:"/assets/img/icon/blue-close.svg",layout:"fixed",width:16,height:16}):(0,a.jsx)(u(),{className:"transition-transform",src:"/assets/img/icon/eye.svg",layout:"fixed",width:16,height:16})}),(0,a.jsx)("p",{className:"transition-transform delay-75",children:K?"Hide Steps":"Show Steps"})]}
1),(0,a.jsx)(_.Z5,{onDragEnd:e=>{if(M(e.draggableId),("pie"===e.draggableId||"bar"===e.draggableId)&&V(D[0]),"line"===e.draggableId&&(L(D[0]),O([D[0]])),"table"===e.draggableId&&V([D[0]]),!e.destination||e.destination.droppableId===e.source.droppableId||e.destination.index===e.source.index||"mainArea"!==e.destination.droppableId)return;let t={...et};t.places.mainArea.chartIds.splice(e.destination.index,1,e.draggableId),es(t)},children:(0,a.jsxs)("div",{className:"flex h-[78vh] mt-4 gap-4",children:[(0,a.jsxs)("div",{className:f()("flex-col flex justify-between gap-4 transition-[width] !duration-[2000]",K?"w-2/6":"w-0"),children:[(0,a.jsx)("div",{className:f()("border border-gray-70 rounded-xl py-2 flex-grow",!K&&"border-r-0"),children:(0,a.jsxs)("div",{className:f()("flex flex-col justify-center h-full px-8",!K&&"hidden"),children:[(0,a.jsxs)("div",{className:"text-gray-50 mb-4",children:[(0,a.jsx)("p",{className:"",children:"Step 1"}),(0,a.jsx)("p",{className:"text-sm",children:"You can upload a new file or select a file that already uploaded."})]}),(0,a.jsx)(m.Z,{className:"!py-4",title:"Please select your CSV/Excel file",extension:["csv","xls","xlsx"],onFileChange:e=>v(e)}),(0,a.jsx)("div",{className:"flex mt-4 items-center justify-center",children:(0,a.jsx)("div",{className:"w-full ",children:(0,a.jsx)(x.Z,{width:"100%",options:S,isLoading:Z,handleChange:e=>{V(e),I(e.value)}})})})]})}),(0,a.jsxs)("div",{className:f()("border border-gray-70 rounded-xl px-8 py-2 flex-grow items-center justify-center",!K&&"hidden"),children:[(0,a.jsxs)("div",{className:"text-gray-50",children:[(0,a.jsx)("p",{className:"",children:"Step 2"}),(0,a.jsx)("p",{className:"text-sm",children:"You can select a chart type."})]}),(0,a.jsxs)("div",{className:"flex flex-row justify-between gap-2",children:[z&&(0,a.jsx)(_.bK,{droppableId:"chartArea",direction:"horizontal",children:e=>(0,a.jsxs)("div",{...e.droppableProps,ref:e.innerRef,className:" flex px-8 py-4",children:[et.places.chartArea.chartIds.map((e,t)=>(0,a.jsx)(_._l,{draggableId:et.charts[e].chart,index:t,children:t=>(0,a.jsx)("div",{...t.dragHandleProps,...t.draggableProps,ref:t.innerRef,children:(0,a.jsx)(q,{provided:t,src:et.charts[e].src,chartType:et.charts[e].chartType,chart:et.charts[e].chart})})},et.charts[e].id)),e.placeholder]})}),!z&&(0,a.jsx)("p",{className:"text-center w-full pt-8 font-medium text-gray-70",children:"You should complete step 1."})]})]}),(0,a.jsx)("div",{className:f()("border border-gray-70 rounded-xl px-8 py-4 flex-grow relative",!K&&"hidden"),children:(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"text-gray-50 mb-2",children:[(0,a.jsx)("p",{className:"",children:"Step 3"}),(0,a.jsx)("p",{className:"text-sm",children:"You can select columns and axis here."})]}),!B&&(0,a.jsx)("p",{className:"text-center w-full pt-3 font-medium text-gray-70",children:"You should complete step 2."}),("pie"===B||"bar"===B)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("label",{children:"Select column"}),(0,a.jsx)(x.Z,{width:"100%",options:D,handleChange:e=>V(e),defaultSelect:z})]}),"line"===B&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("label",{children:"X Axis"}),(0,a.jsx)(x.Z,{width:"100%",options:D,handleChange:e=>L(e),defaultSelect:F})]}),(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("label",{children:"Y Axis (Multiple)"}),(0,a.jsx)(x.Z,{width:"100%",options:D,isMulti:!0,handleChange:e=>O(e),defaultSelect:P})]})]}),"table"===B&&(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("label",{children:"Columns (Multiple)"}),(0,a.jsx)(x.Z,{width:"100%",options:D,isMulti:!0,handleChange:e=>V(e),defaultSelect:z})]})]})})]}),(0,a.jsx)(_.bK,{droppableId:"mainArea",children:e=>(0,a.jsxs)("div",{...e.droppableProps,ref:e.innerRef,className:"border border-gray-70 rounded-xl px-8 py-8 flex-grow overflow-auto bg-blue",children:[et.places.mainArea.chartIds.map((e,t)=>{var s,l;return(0,a.jsx)(_.bK,{droppableId:null===(s=et.charts[e])||void 0===s?void 0:s.id,index:t,children:t=>(0,a.jsx)("div",{...t.dragHandleProps,...t.draggableProps,ref:t.innerRef,children:(0,a.jsx)(J,{userSelectedChartType:et.charts[e].chart})})},null===(l=et.charts[e])||void 0===l?void 0:l.id)}),e.placeholder]})})]})}),(0,a.jsx)(o.Z,{is_open:s,set_isOpen:l,chart_category:"CUSTOM_DATA_EXCEL_CSV",filters:null==e?void 0:e.filters,options:{chartType:(null==e?void 0:e.chartType)==="table"?"table_view":null==e?void 0:e.chartType,f
1ile_name:null==e?void 0:e.file_name}})]})]})}},41994:function(e,t,s){"use strict";s.d(t,{B:function(){return l}});var a=s(94186);let l={custom_data_chart:async(e,t,s)=>await a.Dd.get("/csv-excel/get-chart-with-custom-data",{params:{file_name:e,chart_type:t,filters:s}}).then(e=>e.data),column_list:async e=>await a.Dd.get("/csv-excel/column-list",{params:{file_name:e}}).then(e=>e.data),column_values:async(e,t)=>await a.Dd.get("csv-excel/column-values",{params:{file_name:e,column_name:t}}).then(e=>e.data),list_data_sources:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"list";return await a.Dd.get("csv-excel/list-data-uploads",{params:{return_type:e}}).then(e=>e.data)},load_sample_data:async e=>await a.Dd.get("csv-excel/sample-data",{params:{file_name:e}}).then(e=>e.data),upload_csv_excel:async(e,t,s)=>{let l=new FormData;return l.append("file",e),l.append("custom_file_name",t),l.append("settings",JSON.stringify(s)),await a.Dd.post("csv-excel/upload-file",l,{headers:{"Content-Type":"multipart/form-data"}}).then(e=>e.data)},file_info:async e=>{let t=new FormData;return t.append("file",e),await a.Dd.post("csv-excel/file-info",t,{headers:{"Content-Type":"multipart/form-data"}}).then(e=>e.data)},delete_data:async e=>await a.Dd.delete("csv-excel/delete-data",{params:{data_id:e}}),browse_data:async e=>await a.Dd.get("csv-excel/browse-data",{params:{data_id:e}}).then(e=>e.data),extend_data:async(e,t)=>{let s=new FormData;return s.append("file",t),s.append("data_id",e),await a.Dd.post("csv-excel/extend-data",s,{headers:{"Content-Type":"multipart/form-data"}})},update_config:async(e,t)=>await a.Dd.put("csv-excel/update-config",{data_id:e,update_fields:t}).then(e=>e.data)}}},function(e){e.O(0,[8063,8377,9774,2888,179],function(){return e(e.s=42437)}),_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.