"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9041],{939041:function(e,t,n){n.d(t,{Z:function(){return e_}});var a=n(824246),r=n(827378),l=n(298784),o=n(760032),i=n(867746),s=n(491623),c=n(28873);let d=()=>(0,a.jsx)(c.Z,{title:"User Accepted T&C Metrics"});var u=n(655863),p=n(452054),f=n(975490),C=n(630808),m=n(925773),g=n(572142),y=n(156421),h=n(893772),v=n(973143),D=n(512709),b=n(768014);let x=["component","direction","spacing","divider","children"],A=e=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[e],j=({ownerState:e,theme:t})=>{let n=(0,m.Z)({display:"flex",flexDirection:"column"},(0,g.k9)({theme:t},(0,g.P$)({values:e.direction,breakpoints:t.breakpoints.values}),e=>({flexDirection:e})));if(e.spacing){let a=(0,y.hB)(t),r=Object.keys(t.breakpoints.values).reduce((t,n)=>(("object"==typeof e.spacing&&null!=e.spacing[n]||"object"==typeof e.direction&&null!=e.direction[n])&&(t[n]=!0),t),{}),l=(0,g.P$)({values:e.direction,base:r}),o=(0,g.P$)({values:e.spacing,base:r});"object"==typeof l&&Object.keys(l).forEach((e,t,n)=>{let a=l[e];if(!a){let a=t>0?l[n[t-1]]:"column";l[e]=a}});let i=(t,n)=>({"& > :not(style) + :not(style)":{margin:0,[`margin${A(n?l[n]:e.direction)}`]:(0,y.NA)(a,t)}});n=(0,v.Z)(n,(0,g.k9)({theme:t},o,i))}return(0,g.dt)(t.breakpoints,n)},T=(0,D.ZP)("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,t)=>[t.root]})(j),Z=r.forwardRef(function(e,t){let n=(0,b.Z)({props:e,name:"MuiStack"}),l=(0,h.Z)(n),{component:o="div",direction:i="column",spacing:s=0,divider:c,children:d}=l,u=(0,C.Z)(l,x);return(0,a.jsx)(T,(0,m.Z)({as:o,ownerState:{direction:i,spacing:s},ref:t},u,{children:c?function(e,t){let n=r.Children.toArray(e).filter(Boolean);return n.reduce((e,a,l)=>(e.push(a),l{let{theme:t}=e;return{["&.".concat(S.Z.root)]:{padding:t.spacing(2)}}});var U=n(161320),O=n.n(U),I=n(381337),k=n(495343),N={ENCOURAGE:"ENCOURAGE",B2B_USER_ACCOUNT:"B2B_USER_ACCOUNT",B2C_USER_ACCOUNT:"B2C_USER_ACCOUNT"};let G=e=>{let{onChange:t,style:n,value:r}=e;return(0,a.jsxs)(I.Z,{label:"Privacy Program",onChange:e=>{t("undefined"===e.target.value?void 0:e.target.value)},select:!0,size:"small",style:n,value:r||"undefined",variant:"outlined",children:[(0,a.jsx)(k.Z,{value:"undefined",children:"Select"}),(0,a.jsx)(k.Z,{value:N.ENCOURAGE,children:"ENCOURAGE"}),(0,a.jsx)(k.Z,{value:N.B2B_USER_ACCOUNT,children:"B2B USER ACCOUNT"}),(0,a.jsx)(k.Z,{value:N.B2C_USER_ACCOUNT,children:"B2C USER ACCOUNT"})]})};G.defaultProps={style:void 0,value:void 0};let _={filters:{endDate:void 0,privacyProgram:N.ENCOURAGE,search:void 0,startDate:void 0,type:void 0}};var F=r.createContext({actions:{clearFilters:()=>(0,l.noop)(),updateFilters:e=>(0,l.noop)(e)},privacyProgramState:_}),$=n(129602),z=n(18013),L=n(36479),Q=n(119989),V=n(931811),q=n(2779),H=n(831734),J=n(996900),K=n(979280),W=n(936712),X=n(433564),ee=n(638807),et=n(735020),en=n(67461);function ea(){let e=(0,Q.Z)(["\n query InitialAcceptedTcCountsByDayChartQuery(\n $input: AcceptedTcCountsByDayInput!\n ) {\n initialAcceptedTcCountsByDay(input: $input) {\n date\n total\n clientCounts {\n client\n count\n }\n }\n }\n"]);return ea=function(){return e},e}H.kL.register(H.uw,H.f$,H.ZL,H.od,H.jn,H.Dx,H.u,H.De,et.Z);let er=(0,V.Ps)(ea()),el=e=>{let{fromDate:t,toDate:n,privacyProgram:o}=e,{data:i,error:s}=(0,q.a)(er,{variables:{input:{fromDate:t,toDate:n,privacyProgram:o}}}),c=(0,l.cloneDeep)((0,l.get)(i,"initialAcceptedTcCountsByDay")||[]);(null==s?void 0:s.message)==="Unauthorized"&&(0,en.Z)();let[d]=r.useState({sortBy:"date",sortDirection:K.default.DESCENDING});c=c.sort((0,W.DY)(d));let u=0;c.forEach(e=>{u+=e.total});let p=e=>e>0?e:null,f={plugins:{datalabels:{display:!1,formatter:p,color:"#FFF"},legend:{position:"top"},title:{display:!0,text:"Total Initial Accepted T&C Counts by Day for selected date range: ".concat(u)}},responsive:!0,scales:{x:{stacked:!0},y:{stacked:!0,grace:10}}},C=c.map(e=>O()(e.date).format("MM/DD/YYYY")),m=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"AIGR"===e.client).flatMap(e=>e.count)[0]),g=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"AIST"===e.client).flatMap(e=>e.count)[0]),y=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"MyACT"===e.client).flatMap(e=>e.count)[0]),h=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"Unspecified"===e.client).flatMap(e=>e.count)[0]),v=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"ENCOURAGE"===e.client).flatMap(e=>e.count)[0]);for(var D=0;D0?(0,a.jsx)(ee.Z,{color:"primary",onClick:()=>(0,X.B)("".concat(o),O()(t).format("MM/DD/YYYY"),O()(n).format("MM/DD/YYYY")),variant:"contained",children:"Download in PDF"}):(0,a.jsx)(a.Fragment,{}),(0,a.jsx)(J.$Q,{options:f,data:{labels:C,datasets:[{label:"ENCOURAGE",data:v,borderColor:"rgba(54, 162, 235)",backgroundColor:"rgba(54, 162, 235, 1)"},{label:"MYACT",data:y,borderColor:"rgb(0, 79, 143)",backgroundColor:"rgba(0, 79, 143, 1)"},{label:"AIST",data:g,borderColor:"rgba(10, 209, 0)",backgroundColor:"rgba(10, 209, 0, 1)"},{label:"AIGR",data:m,borderColor:"rgba(255, 221, 26)",backgroundColor:"rgba(255, 221, 26, 1)"},{label:"Unspecified",data:h,borderColor:"rgba(255, 77, 77)",backgroundColor:"rgba(255, 77, 77, 1)"}]},plugins:[et.Z,{id:"sumOfStackedBarsToTop",afterDatasetsDraw(e,t,n){let{ctx:a,scales:{x:r}}=e;e.data.datasets[0].data.forEach((t,n)=>{let l=[];e.data.datasets.forEach(e=>{e.data[n]>0&&l.push(e.data[n])});let o=l.reduce(function(e,t){return e+t},0);a.font="bold 12px sans-serif",a.fillStyle="rgba(0, 79, 143, 1)",a.textAlign="center",a.fillText(o,r.getPixelForValue(n),e.getDatasetMeta(4).data[n].y-10)})}}],className:"aigr-chart"})]});return b},eo=(0,l.flow)($.C);var ei=eo(el),es=n(319551);function ec(){let e=(0,Q.Z)(["\n query InitialAcceptedTcCountsByDayTableQuery(\n $input: AcceptedTcCountsByDayInput!\n ) {\n initialAcceptedTcCountsByDay(input: $input) {\n date\n total\n clientCounts {\n client\n count\n }\n }\n }\n"]);return ec=function(){return e},e}let ed=(0,V.Ps)(ec()),eu=e=>{let{fromDate:t,toDate:n,privacyProgram:r}=e,{data:o,error:i}=(0,q.a)(ed,{variables:{input:{fromDate:t,toDate:n,privacyProgram:r}}}),s=(0,l.cloneDeep)((0,l.get)(o,"initialAcceptedTcCountsByDay")||[]);(null==i?void 0:i.message)==="Unauthorized"&&(0,en.Z)();let c=0;function d(e){let t=e.filter(e=>"A"!==e);return 0===t.length&&t.push(0),t}s.forEach(e=>{c+=e.total});let u=new Date(t).toISOString().slice(0,10),p=new Date(n).toISOString().slice(0,10),f={downloadOptions:{filename:"InitialAcceptedTcCountsByDay_".concat(u,"_").concat(p,".csv"),filterOptions:{useDisplayedColumnsOnly:!0,useDisplayedRowsOnly:!0}},filter:!0,filterType:"multiselect",print:!1,responsive:"standard",rowsPerPage:10,rowsPerPageOptions:[10,25,50],rowHover:!0};return(0,a.jsx)(es.ZP,{columns:[{label:"Created Date",name:"date",options:{customBodyRender:e=>O()(e).format("MM/DD/YYYY"),filter:!0,sort:!0}},{label:"Total",name:"total",options:{filter:!0,sort:!0}},{label:"ENCOURAGE",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"ENCOURAGE"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}},{label:"MYACT",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"MyACT"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}},{label:"AIST",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"AIST"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}},{label:"AIGR",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"AIGR"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}},{label:"Unspecified",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"Unspecified"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}}],data:s,options:f,title:"Total Initial Accepted T&C Counts by Day for selected date range: "+c})},ep=(0,l.flow)($.C);var ef=ep(eu);let eC=e=>{let{fromDate:t,toDate:n,privacyProgram:l}=e,[o,i]=r.useState("chart"),s=(e,t)=>{null!==t&&i(t)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(z.Z,{color:"primary",value:o,exclusive:!0,onChange:s,children:[(0,a.jsx)(L.Z,{sx:{width:"110px",height:"25px"},value:"chart",children:"Chart View"}),(0,a.jsx)(L.Z,{sx:{width:"110px",height:"25px"},value:"table",children:"Table View"})]}),(0,a.jsx)("br",{}),o.includes("chart")?(0,a.jsx)(ei,{fromDate:t,toDate:n,privacyProgram:l}):(0,a.jsx)(ef,{fromDate:t,toDate:n,privacyProgram:l})]})},em=(0,l.flow)($.C);var eg=em(eC);function ey(){let e=(0,Q.Z)(["\n query CurrentAcceptedTcCountsByDayChartQuery(\n $input: AcceptedTcCountsByDayInput!\n ) {\n currentAcceptedTcCountsByDay(input: $input) {\n date\n total\n clientCounts {\n client\n count\n }\n }\n }\n"]);return ey=function(){return e},e}H.kL.register(H.uw,H.f$,H.ZL,H.od,H.jn,H.Dx,H.u,H.De,et.Z);let eh=(0,V.Ps)(ey()),ev=e=>{let{fromDate:t,toDate:n,privacyProgram:o}=e,{data:i,error:s}=(0,q.a)(eh,{variables:{input:{fromDate:t,toDate:n,privacyProgram:o}}}),c=(0,l.cloneDeep)((0,l.get)(i,"currentAcceptedTcCountsByDay")||[]);(null==s?void 0:s.message)==="Unauthorized"&&(0,en.Z)();let[d]=r.useState({sortBy:"date",sortDirection:K.default.DESCENDING});c=c.sort((0,W.DY)(d));let u=0;c.forEach(e=>{u+=e.total});let p=e=>e>0?e:null,f={plugins:{datalabels:{display:!1,formatter:p,color:"#FFF"},legend:{position:"top"},title:{display:!0,text:"Total Current Accepted T&C Counts by Day for selected date range: ".concat(u)}},responsive:!0,scales:{x:{stacked:!0},y:{stacked:!0,grace:10}}},C=c.map(e=>O()(e.date).format("MM/DD/YYYY")),m=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"AIGR"===e.client).flatMap(e=>e.count)[0]),g=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"AIST"===e.client).flatMap(e=>e.count)[0]),y=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"MyACT"===e.client).flatMap(e=>e.count)[0]),h=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"Unspecified"===e.client).flatMap(e=>e.count)[0]),v=c.map(e=>e.clientCounts.sort((e,t)=>e.client.localeCompare(t.client)).filter(e=>"ENCOURAGE"===e.client).flatMap(e=>e.count)[0]);for(var D=0;D0?(0,a.jsx)(ee.Z,{color:"primary",onClick:()=>(0,X.B)("".concat(o),O()(t).format("MM/DD/YYYY"),O()(n).format("MM/DD/YYYY")),variant:"contained",children:"Download in PDF"}):(0,a.jsx)(a.Fragment,{}),(0,a.jsx)(J.$Q,{options:f,data:{labels:C,datasets:[{label:"ENCOURAGE",data:v,borderColor:"rgba(54, 162, 235)",backgroundColor:"rgba(54, 162, 235, 1)"},{label:"MYACT",data:y,borderColor:"rgb(0, 79, 143)",backgroundColor:"rgba(0, 79, 143, 1)"},{label:"AIST",data:g,borderColor:"rgba(10, 209, 0)",backgroundColor:"rgba(10, 209, 0, 1)"},{label:"AIGR",data:m,borderColor:"rgba(255, 221, 26)",backgroundColor:"rgba(255, 221, 26, 1)"},{label:"Unspecified",data:h,borderColor:"rgba(255, 77, 77)",backgroundColor:"rgba(255, 77, 77, 1)"}]},plugins:[et.Z,{id:"sumOfStackedBarsToTop",afterDatasetsDraw(e,t,n){let{ctx:a,scales:{x:r}}=e;e.data.datasets[0].data.forEach((t,n)=>{let l=[];e.data.datasets.forEach(e=>{e.data[n]>0&&l.push(e.data[n])});let o=l.reduce(function(e,t){return e+t},0);a.font="bold 12px sans-serif",a.fillStyle="rgba(0, 79, 143, 1)",a.textAlign="center",a.fillText(o,r.getPixelForValue(n),e.getDatasetMeta(4).data[n].y-10)})}}],className:"aigr-chart"})]});return b},eD=(0,l.flow)($.C);var eb=eD(ev);function ex(){let e=(0,Q.Z)(["\n query CurrentAcceptedTcCountsByDayTableQuery(\n $input: AcceptedTcCountsByDayInput!\n ) {\n currentAcceptedTcCountsByDay(input: $input) {\n date\n total\n clientCounts {\n client\n count\n }\n }\n }\n"]);return ex=function(){return e},e}let eA=(0,V.Ps)(ex()),ej=e=>{let{fromDate:t,toDate:n,privacyProgram:r}=e,{data:o,error:i}=(0,q.a)(eA,{variables:{input:{fromDate:t,toDate:n,privacyProgram:r}}}),s=(0,l.cloneDeep)((0,l.get)(o,"currentAcceptedTcCountsByDay")||[]);(null==i?void 0:i.message)==="Unauthorized"&&(0,en.Z)();let c=0;function d(e){let t=e.filter(e=>"A"!==e);return 0===t.length&&t.push(0),t}s.forEach(e=>{c+=e.total});let u=new Date(t).toISOString().slice(0,10),p=new Date(n).toISOString().slice(0,10),f={downloadOptions:{filename:"CurrentAcceptedTcCountsByDay_".concat(u,"_").concat(p,".csv"),filterOptions:{useDisplayedColumnsOnly:!0,useDisplayedRowsOnly:!0}},filter:!0,filterType:"multiselect",print:!1,responsive:"standard",rowsPerPage:10,rowsPerPageOptions:[10,25,50],rowHover:!0};return(0,a.jsx)(es.ZP,{columns:[{label:"Created Date",name:"date",options:{customBodyRender:e=>O()(e).format("MM/DD/YYYY"),filter:!0,sort:!0}},{label:"Total",name:"total",options:{filter:!0,sort:!0}},{label:"ENCOURAGE",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"ENCOURAGE"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}},{label:"MYACT",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"MyACT"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}},{label:"AIST",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"AIST"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}},{label:"AIGR",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"AIGR"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}},{label:"Unspecified",name:"clientCounts",options:{customBodyRender:e=>{let t=e.map(e=>"Unspecified"===e.client?e.count:"A");return d(t)},filter:!1,sort:!1}}],data:s,options:f,title:"Total Current Accepted T&C Counts by Day for selected date range: "+c})},eT=(0,l.flow)($.C);var eZ=eT(ej);let eY=e=>{let{fromDate:t,toDate:n,privacyProgram:l}=e,[o,i]=r.useState("chart"),s=(e,t)=>{null!==t&&i(t)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(z.Z,{color:"primary",value:o,exclusive:!0,onChange:s,children:[(0,a.jsx)(L.Z,{sx:{width:"110px",height:"25px"},value:"chart",children:"Chart View"}),(0,a.jsx)(L.Z,{sx:{width:"110px",height:"25px"},value:"table",children:"Table View"})]}),(0,a.jsx)("br",{}),o.includes("chart")?(0,a.jsx)(eb,{fromDate:t,toDate:n,privacyProgram:l}):(0,a.jsx)(eZ,{fromDate:t,toDate:n,privacyProgram:l})]})},eE=(0,l.flow)($.C);var eM=eE(eY),eB=n(917553);let eR=()=>{let{privacyProgramState:e}=r.useContext(F),[t,n]=r.useState(e.filters);r.useEffect(()=>{(0,l.isEqual)(e.filters,t)||n({...e.filters})},[e.filters]);let o=e=>{n({...t,...e})},i={endDate:O()().format("YYYY-MM-DD"),startDate:O()().subtract(30,"days").format("YYYY-MM-DD")},[s,c]=r.useState(i.startDate),[d,u]=r.useState(i.endDate),[C,m]=r.useState("Initial"),g=e=>{m(e.target.value)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.Z,{variant:"caption",children:"(date range defaulted to last 30 days. Please choose different Dates and Type to run the metrics)"}),(0,a.jsxs)(P,{elevation:2,children:[(0,a.jsxs)(f.ZP,{container:!0,direction:"row",spacing:1,children:[(0,a.jsx)(f.ZP,{item:!0,xs:3,children:(0,a.jsx)(R.Z,{inputProps:{name:"startDate",onChange:t=>{c(t.target.value),n({...e.filters})},value:s},labelProps:{children:"Start Date"}})}),(0,a.jsx)(f.ZP,{item:!0,xs:3,children:(0,a.jsx)(R.Z,{inputProps:{name:"endDate",onChange:t=>{u(t.target.value),n({...e.filters})},value:d},labelProps:{children:"End Date"}})}),s<=d?(0,a.jsxs)(Z,{direction:"row",spacing:2,children:[(0,a.jsx)(G,{onChange:e=>{o({type:e})},value:t.type}),t.type&&(0,a.jsxs)(Y.Z,{value:C,onChange:g,children:[(0,a.jsxs)(Z,{direction:"row",spacing:2,children:[(0,a.jsx)(E.Z,{label:"Initial",value:"Initial",control:(0,a.jsx)(M.Z,{}),defaultChecked:!0}),(0,a.jsx)(B.Z,{placement:"top",title:"First Time Accepted Terms & Conditions",children:(0,a.jsx)(eB.Z,{fontSize:"small"})})]}),(0,a.jsxs)(Z,{direction:"row",children:[(0,a.jsx)(E.Z,{value:"Current",control:(0,a.jsx)(M.Z,{}),label:"Current"}),(0,a.jsx)(B.Z,{placement:"top",title:"Most Recent Accepted Terms & Conditions",children:(0,a.jsx)(eB.Z,{fontSize:"small"})})]})]})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)("br",{}),(0,a.jsx)(p.Z,{children:"Invalid date range"})]})]}),(0,a.jsx)("br",{})," ",(0,a.jsx)("br",{}),t.type&&"Initial"===C?(0,a.jsx)(f.ZP,{container:!0,direction:"column",spacing:2,style:{marginLeft:"-7px"},children:(0,a.jsx)(eg,{fromDate:O()(s).format("MM-DD-YYYY"),toDate:O()(d).add(1,"day").format("MM-DD-YYYY"),privacyProgram:t.type})}):t.type&&"Current"===C?(0,a.jsx)(f.ZP,{container:!0,direction:"column",spacing:2,style:{marginLeft:"-7px"},children:(0,a.jsx)(eM,{fromDate:O()(s).format("MM-DD-YYYY"),toDate:O()(d).add(1,"day").format("MM-DD-YYYY"),privacyProgram:t.type})}):(0,a.jsx)(a.Fragment,{})]})]})};var ew=n(770309),eS=n(429471);let eP=(0,D.ZP)(ew.Z)(e=>{let{theme:t}=e;return{["&.".concat(eS.Z.root)]:{minHeight:"100%",padding:t.spacing(1)}}}),eU=()=>(0,a.jsx)(eP,{children:(0,a.jsx)(eR,{})}),eO=(0,l.flow)(u.Z);var eI=eO(eU),ek=n(856908);let eN=()=>(0,a.jsxs)(ek.Z,{acceptableRoles:[o.Z.AIGR_ADMIN],children:[(0,a.jsx)(eI,{}),(0,a.jsx)(d,{})]}),eG=(0,l.flow)(s.Z,(0,i.Z)());var e_=eG(eN)}}]);