@verifiedinc-public/shared-ui-elements 3.18.2-beta.8 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BrandFilterInput/BrandFilterInput.hook.d.ts +25 -0
- package/dist/components/BrandFilterInput/index.d.ts +16 -0
- package/dist/components/BrandFilterInput/types.d.ts +15 -0
- package/dist/components/chart/EmptyChartSection.d.ts +1 -0
- package/dist/components/chart/LoadingChartSection.d.ts +1 -0
- package/dist/components/chart/OneClickPercentageChart/OneClickPercentageChart.d.ts +19 -0
- package/dist/components/chart/OneClickPercentageChart/index.d.ts +1 -0
- package/dist/components/chart/index.d.ts +1 -0
- package/dist/components/chart/index.mjs +1 -1
- package/dist/components/chart/monthly-billable-signups/MonthlyBillableSignupsTable.d.ts +1 -0
- package/dist/components/chart/monthly-billable-signups/index.d.ts +1 -1
- package/dist/components/chart/one-click-time-series/OneClickOverTimeChart.d.ts +5 -17
- package/dist/components/chart/one-click-time-series/OneClickTimeSeriesDataMapper.d.ts +1 -12
- package/dist/components/chart/styles.d.ts +14 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.mjs +1 -1
- package/dist/components/typographies/SectionDescription.d.ts +2 -0
- package/dist/components/typographies/SectionTitle.d.ts +2 -0
- package/dist/components/typographies/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/PageSectionHeader-DdpDhBZG.mjs +1 -0
- package/dist/shared/{index-CW9F-W3V.mjs → index-Cs67MQjU.mjs} +13 -13
- package/package.json +1 -1
- package/dist/shared/PageHeader-x2k3H9mE.mjs +0 -1
- package/dist/shared/PageSectionHeader-BIozeXN1.mjs +0 -1
- /package/dist/components/chart/monthly-billable-signups/{MonthlyBillableSignupsDataMapper.d.ts → monthlyBillableSignupsDataMapper.d.ts} +0 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
import { BrandFilter, Brands } from './types';
|
2
|
+
export declare const toOption: (brands: Brands[]) => {
|
3
|
+
name: string;
|
4
|
+
value: string;
|
5
|
+
_raw: Brands;
|
6
|
+
}[];
|
7
|
+
interface UseBrandFilterInputProps {
|
8
|
+
value: BrandFilter | BrandFilter[] | undefined;
|
9
|
+
multiple?: boolean;
|
10
|
+
onChange?: (brands: BrandFilter | BrandFilter[]) => void;
|
11
|
+
getBrandsQuery: {
|
12
|
+
data?: Brands[];
|
13
|
+
isFetching: boolean;
|
14
|
+
};
|
15
|
+
maximumSelectedBrands?: number;
|
16
|
+
}
|
17
|
+
export declare function useBrandFilterInput({ value, multiple, onChange, getBrandsQuery, maximumSelectedBrands, }: UseBrandFilterInputProps): {
|
18
|
+
brandOptions: {
|
19
|
+
name: string;
|
20
|
+
value: string;
|
21
|
+
_raw: Brands;
|
22
|
+
}[];
|
23
|
+
isFetching: boolean;
|
24
|
+
};
|
25
|
+
export {};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { BrandFilter } from './types';
|
2
|
+
export type Value = BrandFilter;
|
3
|
+
interface BrandFilterInputProps {
|
4
|
+
label: string;
|
5
|
+
multiple?: boolean;
|
6
|
+
value: Value | Value[] | undefined;
|
7
|
+
onChange: (value: Value | Value[] | null) => void;
|
8
|
+
getBrandsQuery: {
|
9
|
+
data?: any[];
|
10
|
+
isFetching: boolean;
|
11
|
+
};
|
12
|
+
maximumSelectedBrands?: number;
|
13
|
+
}
|
14
|
+
export declare function BrandFilterInput({ label, multiple, value, onChange, getBrandsQuery, maximumSelectedBrands, }: Readonly<BrandFilterInputProps>): import("react").JSX.Element;
|
15
|
+
export * from './types';
|
16
|
+
export * from './BrandFilterInput.hook';
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export interface Brands {
|
2
|
+
brandUuid: string;
|
3
|
+
customerUuid: string;
|
4
|
+
brandName: string;
|
5
|
+
integrationType: string;
|
6
|
+
oneClickCreated: number;
|
7
|
+
oneClickSuccess: number;
|
8
|
+
isLiveBrand: boolean;
|
9
|
+
additionalData: any;
|
10
|
+
}
|
11
|
+
export type BrandFilter = {
|
12
|
+
name: string;
|
13
|
+
value: string;
|
14
|
+
_raw: Brands;
|
15
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function EmptyChartSection(): React.ReactNode;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function LoadingChartSection(): React.ReactNode;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { default as React } from 'react';
|
2
|
+
export interface OneClickChartData {
|
3
|
+
uuid: string;
|
4
|
+
chartData: Array<{
|
5
|
+
date: string;
|
6
|
+
oneClickSuccess: number;
|
7
|
+
oneClickCreated: number;
|
8
|
+
}>;
|
9
|
+
}
|
10
|
+
interface OneClickPercentageChartProps {
|
11
|
+
data: OneClickChartData[];
|
12
|
+
isLoading: boolean;
|
13
|
+
isFetching: boolean;
|
14
|
+
isSuccess: boolean;
|
15
|
+
filter?: any;
|
16
|
+
sx?: any;
|
17
|
+
}
|
18
|
+
export declare function OneClickPercentageChart({ data, isLoading, isFetching, isSuccess, filter, sx, }: Readonly<OneClickPercentageChartProps>): React.ReactNode;
|
19
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './OneClickPercentageChart';
|
@@ -9,5 +9,6 @@ export * from './PieChart';
|
|
9
9
|
export * from './RiskScorePieChart';
|
10
10
|
export * from './RiskScoreBarChart';
|
11
11
|
export * from './SimpleLegend';
|
12
|
+
export * from './OneClickPercentageChart';
|
12
13
|
export * from './one-click-time-series';
|
13
14
|
export * from './monthly-billable-signups';
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{j as a}from"../../shared/jsx-runtime-DHlBLioN.mjs";import*as K from"react";import{useCallback as ae,useMemo as re,createElement as Ke,useState as Z,useRef as Ue,useEffect as ve,Fragment as Ve}from"react";import{Box as U,Stack as F,Typography as V,useTheme as P,Paper as be,IconButton as We,TableContainer as qe,Table as ze,TableHead as Ze,TableRow as je,TableCell as N,TableBody as He}from"@mui/material";import{ResponsiveContainer as H,LineChart as Xe,CartesianGrid as oe,XAxis as ie,YAxis as se,Label as le,Tooltip as ce,Legend as we,Line as Ye,AreaChart as Je,Area as Qe,ComposedChart as et,ReferenceLine as ke,ReferenceArea as Oe,Bar as tt,Sector as Se,PieChart as nt,Pie as at,Cell as rt}from"recharts";import{b as Te,c as $e,u as ot}from"../../shared/uuidColor-Dw38-aYm.mjs";import X,{Decimal as de}from"decimal.js";import{AnimatePresence as it}from"framer-motion";import{u as st}from"../../shared/useCopyToClipboard-BALOSYVW.mjs";import"qrcode";import{u as ue}from"../../shared/usePrevious-DyvR1iCQ.mjs";import{a as lt,C as Ce}from"../../shared/motions-BBPeWBPV.mjs";import{c as Ae,i as ct,_ as Y,s as dt,a as T,d as ut,e as pt,f as mt,h as ht,j as ft,k as xt,l as gt,m as yt,n as vt,o as bt,p as jt,u as wt,q as kt}from"../../shared/index-C1wV5bJ6.mjs";import{u as Ot}from"../../shared/useCounter-BV32zXDQ.mjs";import{P as St}from"../../shared/PageSectionHeader-BIozeXN1.mjs";import{k as Tt}from"../../shared/formatKebabToPretty-Du43TgPC.mjs";const $t=["ownerState"],Ct=["variants"],At=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Rt(e){return Object.keys(e).length===0}function Lt(e){return typeof e=="string"&&e.charCodeAt(0)>96}function pe(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Dt=Ae(),Et=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function J({defaultTheme:e,theme:t,themeId:n}){return Rt(t)?e:t[n]||t}function Nt(e){return e?(t,n)=>n[e]:null}function Q(e,t){let{ownerState:n}=t,o=Y(t,$t);const i=typeof e=="function"?e(T({ownerState:n},o)):e;if(Array.isArray(i))return i.flatMap(s=>Q(s,T({ownerState:n},o)));if(i&&typeof i=="object"&&Array.isArray(i.variants)){const{variants:s=[]}=i;let r=Y(i,Ct);return s.forEach(l=>{let c=!0;typeof l.props=="function"?c=l.props(T({ownerState:n},o,n)):Object.keys(l.props).forEach(d=>{n?.[d]!==l.props[d]&&o[d]!==l.props[d]&&(c=!1)}),c&&(Array.isArray(r)||(r=[r]),r.push(typeof l.style=="function"?l.style(T({ownerState:n},o,n)):l.style))}),r}return i}function _t(e={}){const{themeId:t,defaultTheme:n=Dt,rootShouldForwardProp:o=pe,slotShouldForwardProp:i=pe}=e,s=r=>ut(T({},r,{theme:J(T({},r,{defaultTheme:n,themeId:t}))}));return s.__mui_systemSx=!0,(r,l={})=>{ct(r,g=>g.filter(O=>!(O!=null&&O.__mui_systemSx)));const{name:c,slot:d,skipVariantsResolver:m,skipSx:h,overridesResolver:p=Nt(Et(d))}=l,f=Y(l,At),j=m!==void 0?m:d&&d!=="Root"&&d!=="root"||!1,y=h||!1;let w,v=pe;d==="Root"||d==="root"?v=o:d?v=i:Lt(r)&&(v=void 0);const b=dt(r,T({shouldForwardProp:v,label:w},f)),k=g=>typeof g=="function"&&g.__emotion_real!==g||pt(g)?O=>Q(g,T({},O,{theme:J({theme:O.theme,defaultTheme:n,themeId:t})})):g,C=(g,...O)=>{let E=k(g);const $=O?O.map(k):[];c&&p&&$.push(u=>{const x=J(T({},u,{defaultTheme:n,themeId:t}));if(!x.components||!x.components[c]||!x.components[c].styleOverrides)return null;const S=x.components[c].styleOverrides,I={};return Object.entries(S).forEach(([_,L])=>{I[_]=Q(L,T({},u,{theme:x}))}),p(u,I)}),c&&!j&&$.push(u=>{var x;const S=J(T({},u,{defaultTheme:n,themeId:t})),I=S==null||(x=S.components)==null||(x=x[c])==null?void 0:x.variants;return Q({variants:I},T({},u,{theme:S}))}),y||$.push(s);const R=$.length-O.length;if(Array.isArray(g)&&R>0){const u=new Array(R).fill("");E=[...g,...u],E.raw=[...g.raw,...u]}const A=b(E,...$);return r.muiName&&(A.muiName=r.muiName),A};return b.withConfig&&(C.withConfig=b.withConfig),C}}const Mt=_t(),It=(e,t)=>e.filter(n=>t.includes(n)),W=(e,t,n)=>{const o=e.keys[0];Array.isArray(t)?t.forEach((i,s)=>{n((r,l)=>{s<=e.keys.length-1&&(s===0?Object.assign(r,l):r[e.up(e.keys[s])]=l)},i)}):t&&typeof t=="object"?(Object.keys(t).length>e.keys.length?e.keys:It(e.keys,Object.keys(t))).forEach(i=>{if(e.keys.indexOf(i)!==-1){const s=t[i];s!==void 0&&n((r,l)=>{o===i?Object.assign(r,l):r[e.up(i)]=l},s)}}):(typeof t=="number"||typeof t=="string")&&n((i,s)=>{Object.assign(i,s)},t)};function G(e){return e?`Level${e}`:""}function z(e){return e.unstable_level>0&&e.container}function Re(e){return function(t){return`var(--Grid-${t}Spacing${G(e.unstable_level)})`}}function me(e){return function(t){return e.unstable_level===0?`var(--Grid-${t}Spacing)`:`var(--Grid-${t}Spacing${G(e.unstable_level-1)})`}}function he(e){return e.unstable_level===0?"var(--Grid-columns)":`var(--Grid-columns${G(e.unstable_level-1)})`}const Ft=({theme:e,ownerState:t})=>{const n=Re(t),o={};return W(e.breakpoints,t.gridSize,(i,s)=>{let r={};s===!0&&(r={flexBasis:0,flexGrow:1,maxWidth:"100%"}),s==="auto"&&(r={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof s=="number"&&(r={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${s} / ${he(t)}${z(t)?` + ${n("column")}`:""})`}),i(o,r)}),o},Gt=({theme:e,ownerState:t})=>{const n={};return W(e.breakpoints,t.gridOffset,(o,i)=>{let s={};i==="auto"&&(s={marginLeft:"auto"}),typeof i=="number"&&(s={marginLeft:i===0?"0px":`calc(100% * ${i} / ${he(t)})`}),o(n,s)}),n},Pt=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=z(t)?{[`--Grid-columns${G(t.unstable_level)}`]:he(t)}:{"--Grid-columns":12};return W(e.breakpoints,t.columns,(o,i)=>{o(n,{[`--Grid-columns${G(t.unstable_level)}`]:i})}),n},Bt=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=me(t),o=z(t)?{[`--Grid-rowSpacing${G(t.unstable_level)}`]:n("row")}:{};return W(e.breakpoints,t.rowSpacing,(i,s)=>{var r;i(o,{[`--Grid-rowSpacing${G(t.unstable_level)}`]:typeof s=="string"?s:(r=e.spacing)==null?void 0:r.call(e,s)})}),o},Kt=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=me(t),o=z(t)?{[`--Grid-columnSpacing${G(t.unstable_level)}`]:n("column")}:{};return W(e.breakpoints,t.columnSpacing,(i,s)=>{var r;i(o,{[`--Grid-columnSpacing${G(t.unstable_level)}`]:typeof s=="string"?s:(r=e.spacing)==null?void 0:r.call(e,s)})}),o},Ut=({theme:e,ownerState:t})=>{if(!t.container)return{};const n={};return W(e.breakpoints,t.direction,(o,i)=>{o(n,{flexDirection:i})}),n},Vt=({ownerState:e})=>{const t=Re(e),n=me(e);return T({minWidth:0,boxSizing:"border-box"},e.container&&T({display:"flex",flexWrap:"wrap"},e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},{margin:`calc(${t("row")} / -2) calc(${t("column")} / -2)`},e.disableEqualOverflow&&{margin:`calc(${t("row")} * -1) 0px 0px calc(${t("column")} * -1)`}),(!e.container||z(e))&&T({padding:`calc(${n("row")} / 2) calc(${n("column")} / 2)`},(e.disableEqualOverflow||e.parentDisableEqualOverflow)&&{padding:`${n("row")} 0px 0px ${n("column")}`}))},Wt=e=>{const t=[];return Object.entries(e).forEach(([n,o])=>{o!==!1&&o!==void 0&&t.push(`grid-${n}-${String(o)}`)}),t},qt=(e,t="xs")=>{function n(o){return o===void 0?!1:typeof o=="string"&&!Number.isNaN(Number(o))||typeof o=="number"&&o>0}if(n(e))return[`spacing-${t}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const o=[];return Object.entries(e).forEach(([i,s])=>{n(s)&&o.push(`spacing-${i}-${String(s)}`)}),o}return[]},zt=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([t,n])=>`direction-${t}-${n}`):[`direction-xs-${String(e)}`],Zt=["className","children","columns","container","component","direction","wrap","spacing","rowSpacing","columnSpacing","disableEqualOverflow","unstable_level"],Ht=Ae(),Xt=Mt("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,t)=>t.root});function Yt(e){return gt({props:e,name:"MuiGrid",defaultTheme:Ht})}function Jt(e={}){const{createStyledComponent:t=Xt,useThemeProps:n=Yt,componentName:o="MuiGrid"}=e,i=K.createContext(void 0),s=(c,d)=>{const{container:m,direction:h,spacing:p,wrap:f,gridSize:j}=c,y={root:["root",m&&"container",f!=="wrap"&&`wrap-xs-${String(f)}`,...zt(h),...Wt(j),...m?qt(p,d.breakpoints.keys[0]):[]]};return yt(y,w=>vt(o,w),{})},r=t(Pt,Kt,Bt,Ft,Ut,Vt,Gt),l=K.forwardRef(function(c,d){var m,h,p,f,j,y,w,v;const b=mt(),k=n(c),C=ht(k),g=K.useContext(i),{className:O,children:E,columns:$=12,container:R=!1,component:A="div",direction:u="row",wrap:x="wrap",spacing:S=0,rowSpacing:I=S,columnSpacing:_=S,disableEqualOverflow:L,unstable_level:D=0}=C,te=Y(C,Zt);let q=L;D&&L!==void 0&&(q=c.disableEqualOverflow);const fe={},xe={},ge={};Object.entries(te).forEach(([M,B])=>{b.breakpoints.values[M]!==void 0?fe[M]=B:b.breakpoints.values[M.replace("Offset","")]!==void 0?xe[M.replace("Offset","")]=B:ge[M]=B});const Ie=(m=c.columns)!=null?m:D?void 0:$,Fe=(h=c.spacing)!=null?h:D?void 0:S,Ge=(p=(f=c.rowSpacing)!=null?f:c.spacing)!=null?p:D?void 0:I,Pe=(j=(y=c.columnSpacing)!=null?y:c.spacing)!=null?j:D?void 0:_,ye=T({},C,{level:D,columns:Ie,container:R,direction:u,wrap:x,spacing:Fe,rowSpacing:Ge,columnSpacing:Pe,gridSize:fe,gridOffset:xe,disableEqualOverflow:(w=(v=q)!=null?v:g)!=null?w:!1,parentDisableEqualOverflow:g}),Be=s(ye,b);let ne=a.jsx(r,T({ref:d,as:A,ownerState:ye,className:ft(Be.root,O)},ge,{children:K.Children.map(E,M=>{if(K.isValidElement(M)&&xt(M,["Grid"])){var B;return K.cloneElement(M,{unstable_level:(B=M.props.unstable_level)!=null?B:D+1})}return M})}));return q!==void 0&&q!==(g??!1)&&(ne=a.jsx(i.Provider,{value:q,children:ne})),ne});return l.muiName="Grid",l}const Le=Jt({createStyledComponent:bt("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,t)=>t.root}),componentName:"MuiGrid2",useThemeProps:e=>jt({props:e,name:"MuiGrid2"})});function Qt({entry:e,payload:t}){const n=ae(h=>{var p,f,j;return(j=(f=(p=h.payload)==null?void 0:p.data)==null?void 0:f.reduce)==null?void 0:j.call(f,(y,w)=>y+w.value,0)},[]),o=ae(h=>{const p=new de(n(h)||0),f=t?.reduce((w,v)=>w+n(v),0)||0,j=new de(f),y=Number(p.div(j).times(100).toFixed(2,de.ROUND_DOWN));return isNaN(y)||!isFinite(y)?0:y},[n,t]),i=re(()=>n(e),[e,n]),s=ue(i),r=re(()=>Number(o(e)),[e,o]),l=ue(r),c=ae(h=>Math.floor(h).toLocaleString(),[]),d=st({type:"text/plain"}),m=wt();return a.jsxs(lt,{component:"li",direction:"row",spacing:1,sx:{color:e.color},layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[a.jsx(U,{sx:{width:"3px",height:"100%",backgroundColor:e.color,borderRadius:3}}),a.jsxs(F,{children:[a.jsxs(V,{component:"p",variant:"caption",children:[a.jsx(F,{component:"span",display:"inline-flex",mr:.5,children:a.jsx(Ce,{from:s??0,to:i,map:c,children:"0"})}),a.jsxs(F,{component:"span",direction:"row",display:"inline-flex",children:["(",a.jsx(Ce,{from:l??0,to:r,map:c,children:"0"}),"%)"]})]}),a.jsx(V,{variant:"body1",children:e.value}),e.payload.integrationType&&a.jsx(V,{variant:"body2",children:e.payload.integrationType}),e.payload.uuid&&a.jsxs(V,{variant:"body2",sx:{cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:()=>{d.copy(e.payload.uuid).catch(()=>{}),m.enqueueSnackbar("UUID copied to clipboard","success")},children:[e.payload.uuid.slice(0,5),"..."]})]})]})}function De(e){const{payload:t}=e;return a.jsx(Le,{container:!0,direction:"row",component:"ul",gap:2,sx:{mt:2,justifyContent:"flex-start",alignItem:"center",flexWrap:"wrap"},children:a.jsx(it,{children:t?.map(n=>a.jsx(Le,{children:a.jsx(Qt,{entry:n,payload:t})},`item-${n.value}`))})})}function Ee(e){const t=P();return a.jsx(U,{sx:{width:"100%",height:"100%",...e.sx},children:a.jsx(H,{children:a.jsxs(Xe,{width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[a.jsx(oe,{vertical:!1}),a.jsx(ie,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:n=>Te(n,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),a.jsx(se,{textAnchor:"end",dataKey:"value",tickLine:!1,tickFormatter:n=>Number(n).toLocaleString(),allowDecimals:!1,domain:[1,"dataMax"],children:e.label&&a.jsx(le,{value:e.label,angle:-90,position:"insideLeft",style:{textAnchor:"middle"}})}),a.jsx(ce,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},formatter:n=>Number(n).toLocaleString(),labelFormatter:n=>$e(n,{timeZone:e.filter.timezone,hour12:!1})}),a.jsx(we,{content:a.jsx(De,{})}),e.data.map(n=>Ke(Ye,{uuid:n.uuid,integrationType:n.integrationType,key:n.uuid,name:n.name,dataKey:"value",data:n.chartData,type:"monotone",stroke:n.color,strokeWidth:2}))]})})})}const en=(e,t)=>{const n=new Map;return e.forEach(o=>{o.chartData.forEach(i=>{const s=new Date(i.date).getTime().toString();if(!n.has(s)){const r={date:s,total:0,diff:0,totalKey:"",originalTotal:0};t.forEach(({key:l})=>{r[l]=0,r[`${l}_absolute`]=0}),n.set(s,r)}t.forEach(({key:r})=>{const l=n.get(s),c=i[r],d=typeof c=="string"?c.trim()===""?0:parseInt(c,10):typeof c=="number"?c:0;l[`${r}_absolute`]=d,l[r]=0})})}),Array.from(n.values()).map(o=>{var i;const s=(i=t.find(c=>c.isTotal))==null?void 0:i.key,r=t.filter(c=>!c.isTotal).map(c=>c.key);if(!s||r.length===0)return o;const l=o[`${s}_absolute`];return o.originalTotal=l,o.total=l,o[s]=100,r.forEach(c=>{const d=o[`${c}_absolute`],m=l>0?new X(d.toString()).div(l).mul(100).toFixed(2,X.ROUND_DOWN):"0.00";o[c]=parseFloat(m)}),{...o,totalKey:s}}).sort((o,i)=>parseInt(o.date)-parseInt(i.date))};function tn(e){const t=P(),n=re(()=>e.data?en(e.data,e.keyValues):[],[e.data,e.keyValues]);return a.jsx(U,{sx:{width:"100%",height:"100%",...e.sx},children:a.jsx(H,{width:"100%",height:"100%",children:a.jsxs(Je,{data:n,width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[a.jsx(oe,{strokeDasharray:"3 3"}),a.jsx(ie,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:o=>Te(o,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),a.jsx(se,{textAnchor:"end",tickLine:!1,tickFormatter:o=>`${o.toFixed(2)}%`}),a.jsx(ce,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},labelFormatter:o=>$e(o,{timeZone:e.filter.timezone,hour12:!1}),formatter:(o,i,s)=>{const r=s.payload.totalKey,l=s.dataKey,c=l===r,d=s.payload[`${l}_absolute`],m=s.payload.originalTotal,h=c?null:m===0?"0.00":new X(d.toString()).div(m).mul(100).toFixed(2,X.ROUND_DOWN);return[h?`${d.toLocaleString()} (${h}%)`:`${d.toLocaleString()} (TOTAL)`,i]}}),e.keyValues.sort((o,i)=>o.isTotal?-1:i.isTotal?1:0).map(o=>a.jsx(Qe,{type:"monotone",dataKey:o.key,name:o.name,stroke:o.color,fill:o.color,strokeWidth:2,fillOpacity:.6},o.key))]})})})}function nn(e){const t=ue(e.value),{ref:n}=Ot({from:t??0,to:e.value,duration:1,map:e.map});return a.jsx(be,{sx:{p:3,flex:1,...e.sx},children:a.jsxs(F,{spacing:1,alignItems:"center",children:[a.jsx(V,{ref:n,variant:"h4",fontWeight:"bold",children:e.initialValue}),a.jsx(V,{color:"text.secondary",children:e.label})]})})}const Ne={margin:{top:5,right:30,left:20,bottom:5}},an={tickLine:!1,fontSize:12,tickMargin:12},rn={textAnchor:"end",tickLine:!1};function ee({data:e,series:t,xAxis:n,yAxis:o,tooltip:i,bar:s,referenceLines:r,referenceAreas:l,sx:c}){const d=P(),m=p=>!p.isFront,h=p=>!!p.isFront;return a.jsx(U,{sx:{width:"100%",height:"100%",...c},children:a.jsx(H,{children:a.jsxs(et,{data:e,...Ne,children:[a.jsx(oe,{strokeDasharray:"3 3",vertical:!1}),a.jsx(ie,{...an,...n}),a.jsx(se,{...rn,...o}),a.jsx(ce,{cursor:{stroke:d.palette.neutral.main,strokeWidth:1},...i}),r?.filter(m).map((p,f)=>a.jsx(ke,{...p},p.label??f)),l?.filter(m).map((p,f)=>a.jsx(Oe,{...p},p.label??f)),t.map(p=>a.jsx(tt,{name:p.key,dataKey:p.dataKey,fill:p.color,stackId:"stack",isAnimationActive:!1,...s},p.key)),r?.filter(h).map((p,f)=>a.jsx(ke,{...p},p.label??f)),l?.filter(h).map((p,f)=>a.jsx(Oe,{...p},p.label??f))]})})})}function on({data:e,threshold:t=100,sx:n}){const o=P(),i=Object.entries(e??{}).map(([r,l])=>({key:r,[r]:l})),s=i.map(({key:r})=>({key:r,dataKey:r,color:o.palette.error.light}));return a.jsx(ee,{sx:n,data:i,series:s,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,`dataMax + ${t}`]},tooltip:{labelFormatter:r=>"Total"},referenceLines:[{y:t,stroke:o.palette.error.dark,strokeDasharray:"3 3",label:a.jsx(le,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}function sn({data:e,threshold:t=100,sx:n}){const o=P(),i=Object.entries(e??{}).map(([r,l])=>({key:r,[r]:l})),s=i.map(({key:r})=>({key:r,dataKey:r,color:o.palette.warning.light}));return a.jsx(ee,{sx:n,data:i,series:s,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,`dataMax + ${t}`]},tooltip:{labelFormatter:r=>"Total"},referenceLines:[{y:t,stroke:o.palette.error.dark,strokeDasharray:"3 3",label:a.jsx(le,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}function _e({payload:e=[],hiddenItems:t,onToggle:n,legendLabel:o}){return a.jsx(U,{sx:{display:"flex",justifyContent:"center",gap:"20px",paddingTop:"20px"},children:e.map((i,s)=>{const r=t.has(i.payload.name);return a.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",opacity:r?.4:1},onClick:()=>{n?.(i.payload)},children:[a.jsx("div",{style:{width:"12px",height:"12px",backgroundColor:i.color,marginRight:"8px",borderRadius:"2px"}}),a.jsx("span",{style:{color:i.color},children:o?`${o}: ${i.value}`:i.value})]},`legend-${s}`)})})}const ln=e=>{const t=Math.PI/180,{cx:n,cy:o,midAngle:i,innerRadius:s,outerRadius:r,startAngle:l,endAngle:c,fill:d,payload:m,percent:h,value:p,valueText:f,valuePercentage:j,needleVisible:y,customText:w,allActive:v}=e,b=Math.sin(-t*i),k=Math.cos(-t*i),C=n+(r+5)*k,g=o+(r+5)*b,O=n+(r+15)*k,E=o+(r+15)*b,$=O+(k>=0?1:-1)*22,R=E,A=k>=0?"start":"end",u=p.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),x=()=>y||v?null:a.jsx("text",{x:n,y:o,dy:8,textAnchor:"middle",fill:"#333",fontSize:14,children:m.name});return a.jsxs("g",{children:[x(),a.jsx(Se,{cx:n,cy:o,innerRadius:s,outerRadius:r,startAngle:l,endAngle:c,fill:d}),a.jsx(Se,{cx:n,cy:o,startAngle:l,endAngle:c,innerRadius:r+2,outerRadius:r+6,fill:d}),a.jsx("path",{d:`M${C},${g}L${O},${E}L${$},${R}`,stroke:d,fill:"none"}),a.jsx("circle",{cx:$,cy:R,r:2,fill:d,stroke:"none"}),a.jsx("text",{x:$+(k>=0?1:-1)*12,y:R,textAnchor:A,fill:"#333",fontSize:12,children:w||(f?`${f} ${u}`:u)}),j&&a.jsxs("text",{x:$+(k>=0?1:-1)*12,y:R,dy:16,textAnchor:A,fill:"#999",fontSize:11,children:[`${(h*100).toFixed(2)}%`," (",u,")"]})]})},cn=e=>{const{value:t,data:n,color:o,innerRadius:i,outerRadius:s,boxDimensions:r,legendDimensions:l,valueText:c}=e,d=Math.PI/180;let m=0;n.forEach(x=>{m+=x.value});const h=r?r.width/2:150,p=(r?r.height/2:200)-l.height/2,f=180*(1-Math.max(0,Math.min(1,t/m))),j=(Number(i)+2*Number(s))/3,y=Math.sin(-d*f),w=Math.cos(-d*f),v=5,b=h-v,k=p,C=b+v*y,g=k-v*w,O=b-v*y,E=k+v*w,$=b+j*w,R=k+j*y,A=t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),u=c??A;return a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:b,cy:k,r:v,fill:o,stroke:"none",style:{pointerEvents:"none"}},"needle-circle"),a.jsx("path",{d:`M${C} ${g}L${O} ${E} L${$} ${R} L${C} ${g}`,stroke:"none",fill:o,style:{pointerEvents:"none"}},"needle-path"),a.jsx("text",{x:b+v,y:k+26,textAnchor:"middle",fill:"#333",fontSize:12,children:u},"needle-value")]})},dn=(e,t)=>({Allow:t.palette.success.main,Flag:t.palette.warning.main,Block:t.palette.error.main})[e]??t.palette.primary.main;function Me({data:e,sx:t,legendLabel:n,legendToggle:o=!1,valueText:i="",valuePercentage:s=!0,pie:r,needleVisible:l=!1,needleValue:c,needleColor:d="#aaa",allActive:m=!1}){const{innerRadius:h=60,outerRadius:p=100}=r??{},f=P(),[j,y]=Z(void 0),[w,v]=Z(new Set),b=Ue(null),[k,C]=Z(null),[g,O]=Z(null),E=(u,x)=>{m||y(x)},$=()=>{m||y(void 0)},R=u=>{o&&u&&v(x=>{const S=new Set(x);return S.has(u.name)?S.delete(u.name):S.size<e.length-1&&S.add(u.name),S})},A=e.map((u,x)=>({...u,index:x,value:w.has(u.name)?0:u.value}));return ve(()=>{const u=b.current;if(!u)return;const x=new ResizeObserver(I=>{var _;const L=(_=I[0])==null?void 0:_.contentRect;L&&C(L)});x.observe(u);const S=u.getBoundingClientRect();return C(S),()=>{x.disconnect()}},[]),ve(()=>{var u;const x=(u=b.current)==null?void 0:u.querySelector(".recharts-legend-wrapper");if(!x){const _=setInterval(()=>{var L;const D=(L=b.current)==null?void 0:L.querySelector(".recharts-legend-wrapper");if(D){const te=D.getBoundingClientRect();O(te),clearInterval(_)}},100);return()=>{clearInterval(_)}}const S=new ResizeObserver(_=>{var L;const D=(L=_[0])==null?void 0:L.contentRect;D&&O(D)});S.observe(x);const I=x.getBoundingClientRect();return O(I),()=>{S.disconnect()}},[]),a.jsx(U,{ref:b,sx:{width:"100%",height:"100%","& g":{outline:"none"},...t},children:a.jsx(H,{children:a.jsxs(nt,{...Ne,children:[a.jsx(at,{data:A,nameKey:"name",dataKey:"value",innerRadius:h,outerRadius:p,activeIndex:m?A.filter(u=>u.value>0).map(u=>u.index):j,activeShape:u=>ln({...u,valueText:i,valuePercentage:s,needleVisible:l,allActive:m}),paddingAngle:0,onMouseEnter:E,onMouseLeave:$,...r,children:A.map(u=>a.jsx(rt,{fill:u.color??dn(u.name,f),opacity:w.has(u.name)?.5:1,stroke:"none"},u.name))}),a.jsx(we,{content:a.jsx(_e,{legendLabel:n,hiddenItems:w,onToggle:R})}),l&&c!==void 0&&k&&g&&cn({data:A,value:c,color:d,innerRadius:h,outerRadius:p,boxDimensions:k,legendDimensions:g,valueText:i})]})})})}function un({sx:e,data:t,score:n=200,legendLabel:o}){const i=P(),s=[{name:"Allow",customText:"0-299",value:t[0].value,color:i.palette.primary.main},{name:"Flag",customText:"300-599",value:t[1].value,color:i.palette.warning.main},{name:"Block",customText:"Over 600",value:t[2].value,color:i.palette.error.main}];return a.jsx(Me,{data:s,legendToggle:!0,needleValue:n,legendLabel:o,allActive:!0,sx:e})}function pn({data:e,sx:t}){const n=P(),o=(s=>{const r={};return s.forEach(l=>{Object.entries(l).forEach(([c,d])=>{const m=parseInt(c);m<=1e3&&(r[m]=(r[m]||0)+d)})}),Array.from({length:1001},(l,c)=>({key:c.toString(),value:r[c]||0}))})(e),i=[{key:"Risk Score",dataKey:"value",color:n.palette.error.main}];return a.jsx(ee,{data:o,series:i,sx:t,yAxis:{label:{value:"Count",angle:-90,position:"insideLeft"},domain:[0,"dataMax + 10"]},xAxis:{domain:[0,"dataMax"],interval:"preserveStartEnd"},tooltip:{labelFormatter:()=>"Risk Score",formatter:(s,r,l)=>[s,l.payload.key]},referenceAreas:[{x1:0,x2:299,fill:"#ffffff00",isFront:!1,label:"Allow"},{x1:300,x2:600,fill:n.palette.warning.light,isFront:!1,label:"Flag"},{x1:600,fill:n.palette.error.light,isFront:!1,label:"Block"}]})}function mn(){return{chartWrapper:{justifyContent:"center",alignItems:"center",width:"100%",height:500}}}function hn({data:e,isLoading:t,isFetching:n,onRefresh:o,lastUpdated:i,filter:s,LoadingComponent:r,EmptyStateComponent:l,LastUpdatedComponent:c,ContentLoaderComponent:d,RefreshIconComponent:m}){var h;const p=mn(),f=()=>t&&r?a.jsx(r,{}):!e.length&&l?a.jsx(l,{}):a.jsx(Ee,{label:"Uniques",data:e,filter:s,sx:{...p.chartWrapper,opacity:n?.4:1}}),j=()=>d&&m?a.jsx(d,{isLoading:n,children:a.jsx(m,{})}):null;return a.jsxs(F,{spacing:2,children:[a.jsx(F,{children:a.jsx(F,{direction:"row",alignItems:"center",spacing:2,children:a.jsx(St,{title:"1-Click Signups",titleRightChildren:a.jsx(Ve,{children:a.jsx(We,{"data-testid":"refresh-one-click-over-time-chart",onClick:o,disabled:n||!((h=s?.brands)!=null&&h.length),children:j()})},1)})})}),a.jsx(F,{direction:"column",spacing:2,children:f()}),c&&a.jsx(F,{sx:{mt:2},children:a.jsx(c,{lastUpdated:i})})]})}function fn(e){const{brands:t,data:n,keyValue:o,defaultColor:i}=e,s=t.flatMap(({_raw:r})=>{var l,c;const d=n?.find(h=>h.brandUuid===r.brandUuid),m=(d?.interval??[]).map(h=>({date:+new Date(h.date),value:Number(h[o]||0)})).filter(h=>h.value>0);return{uuid:r.brandUuid,name:r.brandName,integrationType:Tt(r.integrationType),color:r.integrationType==="hosted"&&(l=r.additionalData)!=null&&l.primaryColor?(c=r.additionalData)==null?void 0:c.primaryColor:i??ot(r.brandUuid),chartData:m}});return kt.chain(s).sortBy(r=>r.name).toArray().value()}const xn=({data:e})=>a.jsx(qe,{component:be,children:a.jsxs(ze,{children:[a.jsx(Ze,{children:a.jsxs(je,{children:[a.jsx(N,{children:"Month"}),a.jsx(N,{children:"Brand"}),a.jsx(N,{children:"Integration Type"}),a.jsx(N,{align:"right",children:"Started"}),a.jsx(N,{align:"right",children:"Finished"}),a.jsx(N,{align:"right",children:"Total Cost"})]})}),a.jsx(He,{children:e.map(t=>a.jsxs(je,{children:[a.jsx(N,{children:new Date(t.month).toLocaleDateString(void 0,{month:"short",year:"numeric",timeZone:"UTC"})}),a.jsx(N,{children:t.brand}),a.jsx(N,{children:t.integrationType}),a.jsx(N,{align:"right",children:t.total}),a.jsx(N,{align:"right",children:t.finished}),a.jsx(N,{align:"right",children:t.totalCost})]},`${t.brand}-${t.month}`))})]})}),gn=({data:e,brands:t})=>e.flatMap(n=>{const o=t.find(i=>i.brandUuid===n.brandUuid);return!o||!n.interval?[]:n.interval.map(i=>({month:new Date(i.date).toISOString(),brand:o.brandName,integrationType:o.integrationType,total:i.oneClickCreated,finished:i.oneClickSuccess,totalCost:i.totalCost}))});export{nn as BigNumber,on as ErrorCodesChart,xn as MonthlyBillableSignupsTable,hn as OneClickOverTimeChart,Me as PieChart,sn as ReasonCodesChart,pn as RiskScoreBarChart,un as RiskScorePieChart,Ee as SeriesChart,De as SeriesChartLegend,tn as SeriesPercentageChart,ee as SimpleBarChart,_e as SimpleLegend,gn as mapMonthlyBillableSignupsData,fn as mapTimeSeriesData};
|
1
|
+
"use strict";import{j as r}from"../../shared/jsx-runtime-DHlBLioN.mjs";import*as W from"react";import{useCallback as re,useMemo as ae,createElement as He,useState as Z,useRef as Xe,useEffect as je}from"react";import{Box as V,Stack as z,Typography as P,useTheme as I,Paper as ke,TableContainer as Ye,Table as Je,TableHead as Qe,TableRow as we,TableCell as E,TableBody as et}from"@mui/material";import{ResponsiveContainer as H,LineChart as tt,CartesianGrid as oe,XAxis as ie,YAxis as se,Label as le,Tooltip as ce,Legend as Se,Line as nt,AreaChart as rt,Area as at,ComposedChart as ot,ReferenceLine as Oe,ReferenceArea as Te,Bar as it,Sector as Ce,PieChart as st,Pie as lt,Cell as ct}from"recharts";import{b as $e,c as Ae,u as dt}from"../../shared/uuidColor-Dw38-aYm.mjs";import X,{Decimal as de}from"decimal.js";import{AnimatePresence as ut}from"framer-motion";import{u as pt}from"../../shared/useCopyToClipboard-BALOSYVW.mjs";import"qrcode";import{u as ue}from"../../shared/usePrevious-DyvR1iCQ.mjs";import{a as mt,C as Re}from"../../shared/motions-BBPeWBPV.mjs";import{c as De,i as ht,_ as Y,s as ft,a as T,d as xt,e as gt,f as yt,h as vt,j as bt,k as jt,l as kt,m as wt,n as St,o as Ot,p as Tt,u as Ct,q as $t}from"../../shared/index-C1wV5bJ6.mjs";import{u as At}from"../../shared/useCounter-BV32zXDQ.mjs";import{k as Le}from"../../shared/formatKebabToPretty-Du43TgPC.mjs";const Rt=["ownerState"],Dt=["variants"],Lt=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function Nt(e){return Object.keys(e).length===0}function Et(e){return typeof e=="string"&&e.charCodeAt(0)>96}function pe(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const _t=De(),Mt=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function J({defaultTheme:e,theme:t,themeId:n}){return Nt(t)?e:t[n]||t}function Ft(e){return e?(t,n)=>n[e]:null}function Q(e,t){let{ownerState:n}=t,a=Y(t,Rt);const i=typeof e=="function"?e(T({ownerState:n},a)):e;if(Array.isArray(i))return i.flatMap(s=>Q(s,T({ownerState:n},a)));if(i&&typeof i=="object"&&Array.isArray(i.variants)){const{variants:s=[]}=i;let o=Y(i,Dt);return s.forEach(l=>{let c=!0;typeof l.props=="function"?c=l.props(T({ownerState:n},a,n)):Object.keys(l.props).forEach(u=>{n?.[u]!==l.props[u]&&a[u]!==l.props[u]&&(c=!1)}),c&&(Array.isArray(o)||(o=[o]),o.push(typeof l.style=="function"?l.style(T({ownerState:n},a,n)):l.style))}),o}return i}function It(e={}){const{themeId:t,defaultTheme:n=_t,rootShouldForwardProp:a=pe,slotShouldForwardProp:i=pe}=e,s=o=>xt(T({},o,{theme:J(T({},o,{defaultTheme:n,themeId:t}))}));return s.__mui_systemSx=!0,(o,l={})=>{ht(o,g=>g.filter(w=>!(w!=null&&w.__mui_systemSx)));const{name:c,slot:u,skipVariantsResolver:m,skipSx:h,overridesResolver:p=Ft(Mt(u))}=l,f=Y(l,Lt),O=m!==void 0?m:u&&u!=="Root"&&u!=="root"||!1,y=h||!1;let j,v=pe;u==="Root"||u==="root"?v=a:u?v=i:Et(o)&&(v=void 0);const b=ft(o,T({shouldForwardProp:v,label:j},f)),k=g=>typeof g=="function"&&g.__emotion_real!==g||gt(g)?w=>Q(g,T({},w,{theme:J({theme:w.theme,defaultTheme:n,themeId:t})})):g,$=(g,...w)=>{let N=k(g);const C=w?w.map(k):[];c&&p&&C.push(d=>{const x=J(T({},d,{defaultTheme:n,themeId:t}));if(!x.components||!x.components[c]||!x.components[c].styleOverrides)return null;const S=x.components[c].styleOverrides,F={};return Object.entries(S).forEach(([_,D])=>{F[_]=Q(D,T({},d,{theme:x}))}),p(d,F)}),c&&!O&&C.push(d=>{var x;const S=J(T({},d,{defaultTheme:n,themeId:t})),F=S==null||(x=S.components)==null||(x=x[c])==null?void 0:x.variants;return Q({variants:F},T({},d,{theme:S}))}),y||C.push(s);const R=C.length-w.length;if(Array.isArray(g)&&R>0){const d=new Array(R).fill("");N=[...g,...d],N.raw=[...g.raw,...d]}const A=b(N,...C);return o.muiName&&(A.muiName=o.muiName),A};return b.withConfig&&($.withConfig=b.withConfig),$}}const Gt=It(),Pt=(e,t)=>e.filter(n=>t.includes(n)),U=(e,t,n)=>{const a=e.keys[0];Array.isArray(t)?t.forEach((i,s)=>{n((o,l)=>{s<=e.keys.length-1&&(s===0?Object.assign(o,l):o[e.up(e.keys[s])]=l)},i)}):t&&typeof t=="object"?(Object.keys(t).length>e.keys.length?e.keys:Pt(e.keys,Object.keys(t))).forEach(i=>{if(e.keys.indexOf(i)!==-1){const s=t[i];s!==void 0&&n((o,l)=>{a===i?Object.assign(o,l):o[e.up(i)]=l},s)}}):(typeof t=="number"||typeof t=="string")&&n((i,s)=>{Object.assign(i,s)},t)};function G(e){return e?`Level${e}`:""}function K(e){return e.unstable_level>0&&e.container}function Ne(e){return function(t){return`var(--Grid-${t}Spacing${G(e.unstable_level)})`}}function me(e){return function(t){return e.unstable_level===0?`var(--Grid-${t}Spacing)`:`var(--Grid-${t}Spacing${G(e.unstable_level-1)})`}}function he(e){return e.unstable_level===0?"var(--Grid-columns)":`var(--Grid-columns${G(e.unstable_level-1)})`}const Bt=({theme:e,ownerState:t})=>{const n=Ne(t),a={};return U(e.breakpoints,t.gridSize,(i,s)=>{let o={};s===!0&&(o={flexBasis:0,flexGrow:1,maxWidth:"100%"}),s==="auto"&&(o={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof s=="number"&&(o={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${s} / ${he(t)}${K(t)?` + ${n("column")}`:""})`}),i(a,o)}),a},Wt=({theme:e,ownerState:t})=>{const n={};return U(e.breakpoints,t.gridOffset,(a,i)=>{let s={};i==="auto"&&(s={marginLeft:"auto"}),typeof i=="number"&&(s={marginLeft:i===0?"0px":`calc(100% * ${i} / ${he(t)})`}),a(n,s)}),n},Vt=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=K(t)?{[`--Grid-columns${G(t.unstable_level)}`]:he(t)}:{"--Grid-columns":12};return U(e.breakpoints,t.columns,(a,i)=>{a(n,{[`--Grid-columns${G(t.unstable_level)}`]:i})}),n},zt=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=me(t),a=K(t)?{[`--Grid-rowSpacing${G(t.unstable_level)}`]:n("row")}:{};return U(e.breakpoints,t.rowSpacing,(i,s)=>{var o;i(a,{[`--Grid-rowSpacing${G(t.unstable_level)}`]:typeof s=="string"?s:(o=e.spacing)==null?void 0:o.call(e,s)})}),a},Ut=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=me(t),a=K(t)?{[`--Grid-columnSpacing${G(t.unstable_level)}`]:n("column")}:{};return U(e.breakpoints,t.columnSpacing,(i,s)=>{var o;i(a,{[`--Grid-columnSpacing${G(t.unstable_level)}`]:typeof s=="string"?s:(o=e.spacing)==null?void 0:o.call(e,s)})}),a},qt=({theme:e,ownerState:t})=>{if(!t.container)return{};const n={};return U(e.breakpoints,t.direction,(a,i)=>{a(n,{flexDirection:i})}),n},Kt=({ownerState:e})=>{const t=Ne(e),n=me(e);return T({minWidth:0,boxSizing:"border-box"},e.container&&T({display:"flex",flexWrap:"wrap"},e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},{margin:`calc(${t("row")} / -2) calc(${t("column")} / -2)`},e.disableEqualOverflow&&{margin:`calc(${t("row")} * -1) 0px 0px calc(${t("column")} * -1)`}),(!e.container||K(e))&&T({padding:`calc(${n("row")} / 2) calc(${n("column")} / 2)`},(e.disableEqualOverflow||e.parentDisableEqualOverflow)&&{padding:`${n("row")} 0px 0px ${n("column")}`}))},Zt=e=>{const t=[];return Object.entries(e).forEach(([n,a])=>{a!==!1&&a!==void 0&&t.push(`grid-${n}-${String(a)}`)}),t},Ht=(e,t="xs")=>{function n(a){return a===void 0?!1:typeof a=="string"&&!Number.isNaN(Number(a))||typeof a=="number"&&a>0}if(n(e))return[`spacing-${t}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const a=[];return Object.entries(e).forEach(([i,s])=>{n(s)&&a.push(`spacing-${i}-${String(s)}`)}),a}return[]},Xt=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([t,n])=>`direction-${t}-${n}`):[`direction-xs-${String(e)}`],Yt=["className","children","columns","container","component","direction","wrap","spacing","rowSpacing","columnSpacing","disableEqualOverflow","unstable_level"],Jt=De(),Qt=Gt("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,t)=>t.root});function en(e){return kt({props:e,name:"MuiGrid",defaultTheme:Jt})}function tn(e={}){const{createStyledComponent:t=Qt,useThemeProps:n=en,componentName:a="MuiGrid"}=e,i=W.createContext(void 0),s=(c,u)=>{const{container:m,direction:h,spacing:p,wrap:f,gridSize:O}=c,y={root:["root",m&&"container",f!=="wrap"&&`wrap-xs-${String(f)}`,...Xt(h),...Zt(O),...m?Ht(p,u.breakpoints.keys[0]):[]]};return wt(y,j=>St(a,j),{})},o=t(Vt,Ut,zt,Bt,qt,Kt,Wt),l=W.forwardRef(function(c,u){var m,h,p,f,O,y,j,v;const b=yt(),k=n(c),$=vt(k),g=W.useContext(i),{className:w,children:N,columns:C=12,container:R=!1,component:A="div",direction:d="row",wrap:x="wrap",spacing:S=0,rowSpacing:F=S,columnSpacing:_=S,disableEqualOverflow:D,unstable_level:L=0}=$,te=Y($,Yt);let q=D;L&&D!==void 0&&(q=c.disableEqualOverflow);const ge={},ye={},ve={};Object.entries(te).forEach(([M,B])=>{b.breakpoints.values[M]!==void 0?ge[M]=B:b.breakpoints.values[M.replace("Offset","")]!==void 0?ye[M.replace("Offset","")]=B:ve[M]=B});const ze=(m=c.columns)!=null?m:L?void 0:C,Ue=(h=c.spacing)!=null?h:L?void 0:S,qe=(p=(f=c.rowSpacing)!=null?f:c.spacing)!=null?p:L?void 0:F,Ke=(O=(y=c.columnSpacing)!=null?y:c.spacing)!=null?O:L?void 0:_,be=T({},$,{level:L,columns:ze,container:R,direction:d,wrap:x,spacing:Ue,rowSpacing:qe,columnSpacing:Ke,gridSize:ge,gridOffset:ye,disableEqualOverflow:(j=(v=q)!=null?v:g)!=null?j:!1,parentDisableEqualOverflow:g}),Ze=s(be,b);let ne=r.jsx(o,T({ref:u,as:A,ownerState:be,className:bt(Ze.root,w)},ve,{children:W.Children.map(N,M=>{if(W.isValidElement(M)&&jt(M,["Grid"])){var B;return W.cloneElement(M,{unstable_level:(B=M.props.unstable_level)!=null?B:L+1})}return M})}));return q!==void 0&&q!==(g??!1)&&(ne=r.jsx(i.Provider,{value:q,children:ne})),ne});return l.muiName="Grid",l}const Ee=tn({createStyledComponent:Ot("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,t)=>t.root}),componentName:"MuiGrid2",useThemeProps:e=>Tt({props:e,name:"MuiGrid2"})});function nn({entry:e,payload:t}){const n=re(h=>{var p,f,O;return(O=(f=(p=h.payload)==null?void 0:p.data)==null?void 0:f.reduce)==null?void 0:O.call(f,(y,j)=>y+j.value,0)},[]),a=re(h=>{const p=new de(n(h)||0),f=t?.reduce((j,v)=>j+n(v),0)||0,O=new de(f),y=Number(p.div(O).times(100).toFixed(2,de.ROUND_DOWN));return isNaN(y)||!isFinite(y)?0:y},[n,t]),i=ae(()=>n(e),[e,n]),s=ue(i),o=ae(()=>Number(a(e)),[e,a]),l=ue(o),c=re(h=>Math.floor(h).toLocaleString(),[]),u=pt({type:"text/plain"}),m=Ct();return r.jsxs(mt,{component:"li",direction:"row",spacing:1,sx:{color:e.color},layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[r.jsx(V,{sx:{width:"3px",height:"100%",backgroundColor:e.color,borderRadius:3}}),r.jsxs(z,{children:[r.jsxs(P,{component:"p",variant:"caption",children:[r.jsx(z,{component:"span",display:"inline-flex",mr:.5,children:r.jsx(Re,{from:s??0,to:i,map:c,children:"0"})}),r.jsxs(z,{component:"span",direction:"row",display:"inline-flex",children:["(",r.jsx(Re,{from:l??0,to:o,map:c,children:"0"}),"%)"]})]}),r.jsx(P,{variant:"body1",children:e.value}),e.payload.integrationType&&r.jsx(P,{variant:"body2",children:e.payload.integrationType}),e.payload.uuid&&r.jsxs(P,{variant:"body2",sx:{cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:()=>{u.copy(e.payload.uuid).catch(()=>{}),m.enqueueSnackbar("UUID copied to clipboard","success")},children:[e.payload.uuid.slice(0,5),"..."]})]})]})}function _e(e){const{payload:t}=e;return r.jsx(Ee,{container:!0,direction:"row",component:"ul",gap:2,sx:{mt:2,justifyContent:"flex-start",alignItem:"center",flexWrap:"wrap"},children:r.jsx(ut,{children:t?.map(n=>r.jsx(Ee,{children:r.jsx(nn,{entry:n,payload:t})},`item-${n.value}`))})})}function Me(e){const t=I();return r.jsx(V,{sx:{width:"100%",height:"100%",...e.sx},children:r.jsx(H,{children:r.jsxs(tt,{width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[r.jsx(oe,{vertical:!1}),r.jsx(ie,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:n=>$e(n,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),r.jsx(se,{textAnchor:"end",dataKey:"value",tickLine:!1,tickFormatter:n=>Number(n).toLocaleString(),allowDecimals:!1,domain:[1,"dataMax"],children:e.label&&r.jsx(le,{value:e.label,angle:-90,position:"insideLeft",style:{textAnchor:"middle"}})}),r.jsx(ce,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},formatter:n=>Number(n).toLocaleString(),labelFormatter:n=>Ae(n,{timeZone:e.filter.timezone,hour12:!1})}),r.jsx(Se,{content:r.jsx(_e,{})}),e.data.map(n=>He(nt,{uuid:n.uuid,integrationType:n.integrationType,key:n.uuid,name:n.name,dataKey:"value",data:n.chartData,type:"monotone",stroke:n.color,strokeWidth:2}))]})})})}const rn=(e,t)=>{const n=new Map;return e.forEach(a=>{a.chartData.forEach(i=>{const s=new Date(i.date).getTime().toString();if(!n.has(s)){const o={date:s,total:0,diff:0,totalKey:"",originalTotal:0};t.forEach(({key:l})=>{o[l]=0,o[`${l}_absolute`]=0}),n.set(s,o)}t.forEach(({key:o})=>{const l=n.get(s),c=i[o],u=typeof c=="string"?c.trim()===""?0:parseInt(c,10):typeof c=="number"?c:0;l[`${o}_absolute`]=u,l[o]=0})})}),Array.from(n.values()).map(a=>{var i;const s=(i=t.find(c=>c.isTotal))==null?void 0:i.key,o=t.filter(c=>!c.isTotal).map(c=>c.key);if(!s||o.length===0)return a;const l=a[`${s}_absolute`];return a.originalTotal=l,a.total=l,a[s]=100,o.forEach(c=>{const u=a[`${c}_absolute`],m=l>0?new X(u.toString()).div(l).mul(100).toFixed(2,X.ROUND_DOWN):"0.00";a[c]=parseFloat(m)}),{...a,totalKey:s}}).sort((a,i)=>parseInt(a.date)-parseInt(i.date))};function Fe(e){const t=I(),n=ae(()=>e.data?rn(e.data,e.keyValues):[],[e.data,e.keyValues]);return r.jsx(V,{sx:{width:"100%",height:"100%",...e.sx},children:r.jsx(H,{width:"100%",height:"100%",children:r.jsxs(rt,{data:n,width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[r.jsx(oe,{strokeDasharray:"3 3"}),r.jsx(ie,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:a=>$e(a,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),r.jsx(se,{textAnchor:"end",tickLine:!1,tickFormatter:a=>`${a.toFixed(2)}%`}),r.jsx(ce,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},labelFormatter:a=>Ae(a,{timeZone:e.filter.timezone,hour12:!1}),formatter:(a,i,s)=>{const o=s.payload.totalKey,l=s.dataKey,c=l===o,u=s.payload[`${l}_absolute`],m=s.payload.originalTotal,h=c?null:m===0?"0.00":new X(u.toString()).div(m).mul(100).toFixed(2,X.ROUND_DOWN);return[h?`${u.toLocaleString()} (${h}%)`:`${u.toLocaleString()} (TOTAL)`,i]}}),e.keyValues.sort((a,i)=>a.isTotal?-1:i.isTotal?1:0).map(a=>r.jsx(at,{type:"monotone",dataKey:a.key,name:a.name,stroke:a.color,fill:a.color,strokeWidth:2,fillOpacity:.6},a.key))]})})})}function an(e){const t=ue(e.value),{ref:n}=At({from:t??0,to:e.value,duration:1,map:e.map});return r.jsx(ke,{sx:{p:3,flex:1,...e.sx},children:r.jsxs(z,{spacing:1,alignItems:"center",children:[r.jsx(P,{ref:n,variant:"h4",fontWeight:"bold",children:e.initialValue}),r.jsx(P,{color:"text.secondary",children:e.label})]})})}const Ie={margin:{top:5,right:30,left:20,bottom:5}},on={tickLine:!1,fontSize:12,tickMargin:12},sn={textAnchor:"end",tickLine:!1};function ee({data:e,series:t,xAxis:n,yAxis:a,tooltip:i,bar:s,referenceLines:o,referenceAreas:l,sx:c}){const u=I(),m=p=>!p.isFront,h=p=>!!p.isFront;return r.jsx(V,{sx:{width:"100%",height:"100%",...c},children:r.jsx(H,{children:r.jsxs(ot,{data:e,...Ie,children:[r.jsx(oe,{strokeDasharray:"3 3",vertical:!1}),r.jsx(ie,{...on,...n}),r.jsx(se,{...sn,...a}),r.jsx(ce,{cursor:{stroke:u.palette.neutral.main,strokeWidth:1},...i}),o?.filter(m).map((p,f)=>r.jsx(Oe,{...p},p.label??f)),l?.filter(m).map((p,f)=>r.jsx(Te,{...p},p.label??f)),t.map(p=>r.jsx(it,{name:p.key,dataKey:p.dataKey,fill:p.color,stackId:"stack",isAnimationActive:!1,...s},p.key)),o?.filter(h).map((p,f)=>r.jsx(Oe,{...p},p.label??f)),l?.filter(h).map((p,f)=>r.jsx(Te,{...p},p.label??f))]})})})}function ln({data:e,threshold:t=100,sx:n}){const a=I(),i=Object.entries(e??{}).map(([o,l])=>({key:o,[o]:l})),s=i.map(({key:o})=>({key:o,dataKey:o,color:a.palette.error.light}));return r.jsx(ee,{sx:n,data:i,series:s,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,`dataMax + ${t}`]},tooltip:{labelFormatter:o=>"Total"},referenceLines:[{y:t,stroke:a.palette.error.dark,strokeDasharray:"3 3",label:r.jsx(le,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}function cn({data:e,threshold:t=100,sx:n}){const a=I(),i=Object.entries(e??{}).map(([o,l])=>({key:o,[o]:l})),s=i.map(({key:o})=>({key:o,dataKey:o,color:a.palette.warning.light}));return r.jsx(ee,{sx:n,data:i,series:s,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,`dataMax + ${t}`]},tooltip:{labelFormatter:o=>"Total"},referenceLines:[{y:t,stroke:a.palette.error.dark,strokeDasharray:"3 3",label:r.jsx(le,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}function Ge({payload:e=[],hiddenItems:t,onToggle:n,legendLabel:a}){return r.jsx(V,{sx:{display:"flex",justifyContent:"center",gap:"20px",paddingTop:"20px"},children:e.map((i,s)=>{const o=t.has(i.payload.name);return r.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",opacity:o?.4:1},onClick:()=>{n?.(i.payload)},children:[r.jsx("div",{style:{width:"12px",height:"12px",backgroundColor:i.color,marginRight:"8px",borderRadius:"2px"}}),r.jsx("span",{style:{color:i.color},children:a?`${a}: ${i.value}`:i.value})]},`legend-${s}`)})})}const dn=e=>{const t=Math.PI/180,{cx:n,cy:a,midAngle:i,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c,fill:u,payload:m,percent:h,value:p,valueText:f,valuePercentage:O,needleVisible:y,customText:j,allActive:v}=e,b=Math.sin(-t*i),k=Math.cos(-t*i),$=n+(o+5)*k,g=a+(o+5)*b,w=n+(o+15)*k,N=a+(o+15)*b,C=w+(k>=0?1:-1)*22,R=N,A=k>=0?"start":"end",d=p.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),x=()=>y||v?null:r.jsx("text",{x:n,y:a,dy:8,textAnchor:"middle",fill:"#333",fontSize:14,children:m.name});return r.jsxs("g",{children:[x(),r.jsx(Ce,{cx:n,cy:a,innerRadius:s,outerRadius:o,startAngle:l,endAngle:c,fill:u}),r.jsx(Ce,{cx:n,cy:a,startAngle:l,endAngle:c,innerRadius:o+2,outerRadius:o+6,fill:u}),r.jsx("path",{d:`M${$},${g}L${w},${N}L${C},${R}`,stroke:u,fill:"none"}),r.jsx("circle",{cx:C,cy:R,r:2,fill:u,stroke:"none"}),r.jsx("text",{x:C+(k>=0?1:-1)*12,y:R,textAnchor:A,fill:"#333",fontSize:12,children:j||(f?`${f} ${d}`:d)}),O&&r.jsxs("text",{x:C+(k>=0?1:-1)*12,y:R,dy:16,textAnchor:A,fill:"#999",fontSize:11,children:[`${(h*100).toFixed(2)}%`," (",d,")"]})]})},un=e=>{const{value:t,data:n,color:a,innerRadius:i,outerRadius:s,boxDimensions:o,legendDimensions:l,valueText:c}=e,u=Math.PI/180;let m=0;n.forEach(x=>{m+=x.value});const h=o?o.width/2:150,p=(o?o.height/2:200)-l.height/2,f=180*(1-Math.max(0,Math.min(1,t/m))),O=(Number(i)+2*Number(s))/3,y=Math.sin(-u*f),j=Math.cos(-u*f),v=5,b=h-v,k=p,$=b+v*y,g=k-v*j,w=b-v*y,N=k+v*j,C=b+O*j,R=k+O*y,A=t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),d=c??A;return r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:b,cy:k,r:v,fill:a,stroke:"none",style:{pointerEvents:"none"}},"needle-circle"),r.jsx("path",{d:`M${$} ${g}L${w} ${N} L${C} ${R} L${$} ${g}`,stroke:"none",fill:a,style:{pointerEvents:"none"}},"needle-path"),r.jsx("text",{x:b+v,y:k+26,textAnchor:"middle",fill:"#333",fontSize:12,children:d},"needle-value")]})},pn=(e,t)=>({Allow:t.palette.success.main,Flag:t.palette.warning.main,Block:t.palette.error.main})[e]??t.palette.primary.main;function Pe({data:e,sx:t,legendLabel:n,legendToggle:a=!1,valueText:i="",valuePercentage:s=!0,pie:o,needleVisible:l=!1,needleValue:c,needleColor:u="#aaa",allActive:m=!1}){const{innerRadius:h=60,outerRadius:p=100}=o??{},f=I(),[O,y]=Z(void 0),[j,v]=Z(new Set),b=Xe(null),[k,$]=Z(null),[g,w]=Z(null),N=(d,x)=>{m||y(x)},C=()=>{m||y(void 0)},R=d=>{a&&d&&v(x=>{const S=new Set(x);return S.has(d.name)?S.delete(d.name):S.size<e.length-1&&S.add(d.name),S})},A=e.map((d,x)=>({...d,index:x,value:j.has(d.name)?0:d.value}));return je(()=>{const d=b.current;if(!d)return;const x=new ResizeObserver(F=>{var _;const D=(_=F[0])==null?void 0:_.contentRect;D&&$(D)});x.observe(d);const S=d.getBoundingClientRect();return $(S),()=>{x.disconnect()}},[]),je(()=>{var d;const x=(d=b.current)==null?void 0:d.querySelector(".recharts-legend-wrapper");if(!x){const _=setInterval(()=>{var D;const L=(D=b.current)==null?void 0:D.querySelector(".recharts-legend-wrapper");if(L){const te=L.getBoundingClientRect();w(te),clearInterval(_)}},100);return()=>{clearInterval(_)}}const S=new ResizeObserver(_=>{var D;const L=(D=_[0])==null?void 0:D.contentRect;L&&w(L)});S.observe(x);const F=x.getBoundingClientRect();return w(F),()=>{S.disconnect()}},[]),r.jsx(V,{ref:b,sx:{width:"100%",height:"100%","& g":{outline:"none"},...t},children:r.jsx(H,{children:r.jsxs(st,{...Ie,children:[r.jsx(lt,{data:A,nameKey:"name",dataKey:"value",innerRadius:h,outerRadius:p,activeIndex:m?A.filter(d=>d.value>0).map(d=>d.index):O,activeShape:d=>dn({...d,valueText:i,valuePercentage:s,needleVisible:l,allActive:m}),paddingAngle:0,onMouseEnter:N,onMouseLeave:C,...o,children:A.map(d=>r.jsx(ct,{fill:d.color??pn(d.name,f),opacity:j.has(d.name)?.5:1,stroke:"none"},d.name))}),r.jsx(Se,{content:r.jsx(Ge,{legendLabel:n,hiddenItems:j,onToggle:R})}),l&&c!==void 0&&k&&g&&un({data:A,value:c,color:u,innerRadius:h,outerRadius:p,boxDimensions:k,legendDimensions:g,valueText:i})]})})})}function mn({sx:e,data:t,score:n=200,legendLabel:a}){const i=I(),s=[{name:"Allow",customText:"0-299",value:t[0].value,color:i.palette.primary.main},{name:"Flag",customText:"300-599",value:t[1].value,color:i.palette.warning.main},{name:"Block",customText:"Over 600",value:t[2].value,color:i.palette.error.main}];return r.jsx(Pe,{data:s,legendToggle:!0,needleValue:n,legendLabel:a,allActive:!0,sx:e})}function hn({data:e,sx:t}){const n=I(),a=(s=>{const o={};return s.forEach(l=>{Object.entries(l).forEach(([c,u])=>{const m=parseInt(c);m<=1e3&&(o[m]=(o[m]||0)+u)})}),Array.from({length:1001},(l,c)=>({key:c.toString(),value:o[c]||0}))})(e),i=[{key:"Risk Score",dataKey:"value",color:n.palette.error.main}];return r.jsx(ee,{data:a,series:i,sx:t,yAxis:{label:{value:"Count",angle:-90,position:"insideLeft"},domain:[0,"dataMax + 10"]},xAxis:{domain:[0,"dataMax"],interval:"preserveStartEnd"},tooltip:{labelFormatter:()=>"Risk Score",formatter:(s,o,l)=>[s,l.payload.key]},referenceAreas:[{x1:0,x2:299,fill:"#ffffff00",isFront:!1,label:"Allow"},{x1:300,x2:600,fill:n.palette.warning.light,isFront:!1,label:"Flag"},{x1:600,fill:n.palette.error.light,isFront:!1,label:"Block"}]})}const Be=()=>({regularChartWrapper:{justifyContent:"center",alignItems:"center",width:"100%",height:500},smallChartWrapper:{justifyContent:"center",alignItems:"center",width:"100%",height:300}});function We(e){return r.jsx(P,{variant:"h6",fontWeight:"900",...e})}function Ve(e){return r.jsx(P,{variant:"h6",fontWeight:"400",...e})}function fe(){const e=Be();return r.jsxs(z,{sx:e.smallChartWrapper,children:[r.jsx(We,{children:"No data available for the selected period and brands"}),r.jsx(Ve,{children:"Please select a different period or brand"})]})}function xe(){const e=Be();return r.jsxs(z,{sx:e.smallChartWrapper,children:[r.jsx(We,{children:"Loading..."}),r.jsx(Ve,{children:"Preparing your chart data"})]})}function fn({data:e,isLoading:t,isFetching:n,isSuccess:a,filter:i,sx:s}){var o,l;const c=I(),u={oneClickCreated:{key:"oneClickCreated",name:"Started",color:c.palette.neutral.main,isTotal:!0},oneClickSuccess:{key:"oneClickSuccess",name:"Finished",color:c.palette.primary.main}};return t?r.jsx(xe,{}):!e.length||!((l=(o=e[0])==null?void 0:o.chartData)!=null&&l.length)||!a?r.jsx(fe,{}):r.jsx(Fe,{data:e,keyValues:Object.values(u),filter:i,sx:{opacity:n?.4:1,...s}})}const xn={chartWrapper:{justifyContent:"center",alignItems:"center",width:"100%",height:500}};function gn({data:e,isLoading:t,isFetching:n,isSuccess:a,filter:i}){return t?r.jsx(xe,{}):!e.length||!a?r.jsx(fe,{}):r.jsx(Me,{label:"Uniques",data:e,filter:i,sx:{...xn.chartWrapper,opacity:n?.4:1}})}function yn(e){const{brands:t,data:n,keyValue:a,defaultColor:i}=e,s=t.flatMap(({_raw:o})=>{var l,c;const u=n?.find(h=>h.brandUuid===o.brandUuid),m=(u?.interval??[]).map(h=>({date:+new Date(h.date),value:Number(h[a]||0)})).filter(h=>h.value>0);return{uuid:o.brandUuid,name:o.brandName,integrationType:Le(o.integrationType),color:o.integrationType==="hosted"&&(l=o.additionalData)!=null&&l.primaryColor?(c=o.additionalData)==null?void 0:c.primaryColor:i??dt(o.brandUuid),chartData:m}});return $t.chain(s).sortBy(o=>o.name).toArray().value()}const vn=({data:e,brands:t})=>e.flatMap(n=>{const a=t.find(i=>i.brandUuid===n.brandUuid);return!a||!n.interval?[]:n.interval.map(i=>({month:new Date(i.date).toISOString(),brand:a.brandName,integrationType:Le(a.integrationType),total:i.oneClickCreated,finished:i.oneClickSuccess,totalCost:i.totalCost}))}),bn=({data:e,isLoading:t})=>t?r.jsx(xe,{}):e!=null&&e.length?r.jsx(Ye,{component:ke,children:r.jsxs(Je,{children:[r.jsx(Qe,{children:r.jsxs(we,{children:[r.jsx(E,{children:"Month"}),r.jsx(E,{children:"Brand"}),r.jsx(E,{children:"Integration Type"}),r.jsx(E,{align:"right",children:"Started"}),r.jsx(E,{align:"right",children:"Finished"}),r.jsx(E,{align:"right",children:"Total Cost"})]})}),r.jsx(et,{children:e.map(n=>r.jsxs(we,{children:[r.jsx(E,{children:new Date(n.month).toLocaleDateString(void 0,{month:"short",year:"numeric",timeZone:"UTC"})}),r.jsx(E,{children:n.brand}),r.jsx(E,{children:n.integrationType}),r.jsx(E,{align:"right",children:n.total}),r.jsx(E,{align:"right",children:n.finished}),r.jsx(E,{align:"right",children:n.totalCost})]},`${n.brand}-${n.month}`))})]})}):r.jsx(fe,{});export{an as BigNumber,ln as ErrorCodesChart,bn as MonthlyBillableSignupsTable,gn as OneClickOverTimeChart,fn as OneClickPercentageChart,Pe as PieChart,cn as ReasonCodesChart,hn as RiskScoreBarChart,mn as RiskScorePieChart,Me as SeriesChart,_e as SeriesChartLegend,Fe as SeriesPercentageChart,ee as SimpleBarChart,Ge as SimpleLegend,vn as mapMonthlyBillableSignupsData,yn as mapTimeSeriesData};
|
@@ -1,26 +1,14 @@
|
|
1
|
-
import { SeriesChartData } from '../SeriesChart';
|
2
1
|
import { default as React } from 'react';
|
3
|
-
import {
|
4
|
-
|
2
|
+
import { SeriesChartData } from '../SeriesChart';
|
3
|
+
import { BrandFilter } from '../../BrandFilterInput';
|
4
|
+
export interface OneClickOverTimeChartProps {
|
5
5
|
data: SeriesChartData[];
|
6
6
|
isLoading: boolean;
|
7
|
+
isSuccess: boolean;
|
7
8
|
isFetching: boolean;
|
8
|
-
onRefresh: () => void;
|
9
|
-
lastUpdated: number;
|
10
9
|
filter: {
|
11
10
|
timezone: string;
|
12
11
|
brands: BrandFilter[];
|
13
12
|
};
|
14
|
-
LoadingComponent?: React.ComponentType;
|
15
|
-
EmptyStateComponent?: React.ComponentType;
|
16
|
-
LastUpdatedComponent?: React.ComponentType<{
|
17
|
-
lastUpdated: number;
|
18
|
-
}>;
|
19
|
-
ContentLoaderComponent?: React.ComponentType<{
|
20
|
-
isLoading: boolean;
|
21
|
-
children: React.ReactNode;
|
22
|
-
}>;
|
23
|
-
RefreshIconComponent?: React.ComponentType;
|
24
13
|
}
|
25
|
-
export declare function OneClickOverTimeChart({ data, isLoading, isFetching,
|
26
|
-
export {};
|
14
|
+
export declare function OneClickOverTimeChart({ data, isLoading, isFetching, isSuccess, filter, }: Readonly<OneClickOverTimeChartProps>): React.ReactNode;
|
@@ -1,15 +1,4 @@
|
|
1
|
-
|
2
|
-
brandUuid: string;
|
3
|
-
brandName: string;
|
4
|
-
integrationType: string;
|
5
|
-
additionalData?: {
|
6
|
-
primaryColor?: string;
|
7
|
-
};
|
8
|
-
}
|
9
|
-
export interface BrandFilter {
|
10
|
-
value: string;
|
11
|
-
_raw: Brand;
|
12
|
-
}
|
1
|
+
import { BrandFilter } from '../../BrandFilterInput';
|
13
2
|
export interface TimeSeriesDataPoint {
|
14
3
|
date: number;
|
15
4
|
value: number;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export declare const useStyle: () => {
|
2
|
+
regularChartWrapper: {
|
3
|
+
justifyContent: string;
|
4
|
+
alignItems: string;
|
5
|
+
width: string;
|
6
|
+
height: number;
|
7
|
+
};
|
8
|
+
smallChartWrapper: {
|
9
|
+
justifyContent: string;
|
10
|
+
alignItems: string;
|
11
|
+
width: string;
|
12
|
+
height: number;
|
13
|
+
};
|
14
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{A as a,c as s,l as e,B as
|
1
|
+
"use strict";import{A as a,c as s,l as e,B as t,n,m as r,C as o,D as i,f as p,E as u,j as m,F as c,I as d,b as l,L as I,O as P,h as B,e as g,P as S,Q as h,R as k,S as f,d as C,k as T,T as b,g as y,a as A,V as F,i as L,t as R,u as D}from"../shared/index-Cs67MQjU.mjs";import{a as E,b as O,P as x,S as H}from"../shared/PageSectionHeader-DdpDhBZG.mjs";import{C as N,W as V,u as W}from"../shared/index-C1wV5bJ6.mjs";import{SnackbarProvider as v}from"notistack";export{a as AcceptTermsNotice,s as Alert,e as Backdrop,t as Banner,n as BrandFilterInput,r as Button,o as CredentialRequestsEditor,N as CustomAlertComponent,i as DateInput,p as DateRangeInput,u as EmailInput,m as ExactBirthdayBanner,c as FullWidthAlert,d as Image,l as LegalLink,I as LinkButton,P as OTPInput,B as OneClickForm,E as PageHeader,O as PageSectionHeader,x as Paragraph,g as PhoneInput,S as PrivacyPolicyNotice,h as QRCodeDisplay,k as ResendPhoneBanner,f as SSNInput,H as SectionHeader,C as SelectInput,v as SnackbarProvider,T as TestPhoneNumbersBanner,b as TextButton,y as TimezoneInput,A as Typography,F as VerifiedImage,L as VerifiedIncLogo,V as When,R as toOption,D as useBrandFilterInput,W as useSnackbar};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{a,
|
1
|
+
"use strict";import{a,b as e,P as r,S as s}from"../../shared/PageSectionHeader-DdpDhBZG.mjs";export{a as PageHeader,e as PageSectionHeader,r as Paragraph,s as SectionHeader};
|
package/dist/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{A as e,c as t,l as r,B as o,m as i,C as
|
1
|
+
"use strict";import{A as e,c as t,l as r,B as o,n,m as i,C as m,D as u,f as l,E as c,j as d,F as p,I as h,b as f,L as S,O as g,h as C,e as k,P,Q as y,R as b,S as D,d as B,k as I,T,g as w,a as N,V as R,i as v,o as Y,q as F,r as O,w as x,p as A,s as G,t as L,u as M,v as W}from"./shared/index-Cs67MQjU.mjs";import{a as z,b as E,P as V,S as H}from"./shared/PageSectionHeader-DdpDhBZG.mjs";import{C as j,W as q,u as U}from"./shared/index-C1wV5bJ6.mjs";import{b as Q,d as $,a as K,j as X,u as Z,e as J,c as _,f as aa,g as sa,h as ea,i as ta}from"./shared/useIntersectionObserver-CbpWuEs0.mjs";import{u as ra}from"./shared/useCopyToClipboard-BALOSYVW.mjs";import{a as oa,u as na}from"./shared/useOnClickOutside-P5GTcgh8.mjs";import{u as ia}from"./shared/useCounter-BV32zXDQ.mjs";import{u as ma}from"./shared/usePrevious-DyvR1iCQ.mjs";import{b as ua,a as la,v as ca,e as da,d as pa,p as ha,u as fa,h as Sa,j as ga,g as Ca,o as ka,s as Pa,m as ya,c as ba,l as Da,n as Ba,q as Ia,f as Ta,i as wa,r as Na,z as Ra,t as va,x as Ya,k as Fa,w as Oa,y as xa}from"./shared/shadows-Dhd7FrwF.mjs";import{f as Aa,b as Ga,a as La,c as Ma,u as Wa}from"./shared/uuidColor-Dw38-aYm.mjs";import{masks as za}from"./utils/masks/index.mjs";import{toCapitalize as Ea,toSentenceCase as Va}from"./utils/string/index.mjs";import{k as Ha}from"./shared/formatKebabToPretty-Du43TgPC.mjs";import{M as ja,S as qa,U as Ua,d as Qa,e as $a,f as Ka,g as Xa,a as Za,s as Ja}from"./shared/unix.schema-CMYTtXco.mjs";import{p as _a}from"./shared/phone.schema-XBbyizhq.mjs";import{SnackbarProvider as as}from"notistack";async function ss(a){try{return[await a,null]}catch(s){return[null,s]}}const es=a=>a.replace(/(\d{3})-?(\d{2})-?(\d{4})/,"\u2022\u2022\u2022-\u2022\u2022-$3");export{e as AcceptTermsNotice,t as Alert,r as Backdrop,o as Banner,n as BrandFilterInput,i as Button,m as CredentialRequestsEditor,j as CustomAlertComponent,u as DateInput,l as DateRangeInput,c as EmailInput,d as ExactBirthdayBanner,p as FullWidthAlert,h as Image,f as LegalLink,S as LinkButton,ja as MaskedAndUnmaskedSSNSchema,g as OTPInput,C as OneClickForm,z as PageHeader,E as PageSectionHeader,V as Paragraph,k as PhoneInput,P as PrivacyPolicyNotice,y as QRCodeDisplay,b as ResendPhoneBanner,D as SSNInput,qa as SSNSchema,H as SectionHeader,B as SelectInput,as as SnackbarProvider,I as TestPhoneNumbersBanner,T as TextButton,w as TimezoneInput,N as Typography,Ua as USDateSchema,R as VerifiedImage,v as VerifiedIncLogo,q as When,ua as black,la as blue,ca as colors,Y as countries,da as darkBlue,pa as darkGreen,ha as darkGrey,fa as darkGreyContrast,Sa as darkRed,ga as darkYellow,Qa as descriptionSchema,$a as emailSchema,Ka as fieldSchema,Aa as formatDateMMDDYYYY,Ga as formatDateMMYY,La as formatDateToTimestamp,Ma as formatExtendedDate,Xa as getDateSchemaWithPastValidation,F as getPhoneData,O as getPhoneDataByFieldName,Za as getUnixSchema,Ca as green,ka as grey,Pa as greyContrast,ya as infoContrast,Ha as kebabCaseToPretty,ba as lightBlue,Da as lightGreen,Ba as lightGrey,Ia as lightGreyContrast,Ta as lightRed,wa as lightYellow,za as masks,x as omitProperties,A as parseToPhoneNational,_a as phoneSchema,Na as red,Ra as shadows,G as sortByCountryName,es as ssnFormatter,Ja as stateSchema,va as textDisabled,Ya as theme,Ea as toCapitalize,L as toOption,Va as toSentenceCase,M as useBrandFilterInput,Q as useCallbackRef,ra as useCopyToClipboard,ia as useCounter,$ as useDebounceValue,K as useDisclosure,X as useIntersectionObserver,Z as useLocalStorage,oa as useOnClickOutside,ma as usePrevious,na as useQRCode,J as useScript,_ as useSearchParams,U as useSnackbar,aa as useThrottle,sa as useToggle,ea as useWindowScroll,ta as useWindowSize,Wa as uuidToHashedColor,W as validatePhone,Fa as warningContrast,Oa as white,ss as wrapPromise,xa as yellow};
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";import{j as t}from"./jsx-runtime-DHlBLioN.mjs";import{Typography as n,Box as r,Stack as o}from"@mui/material";const a=({children:i,sx:e,...s})=>t.jsx(n,{variant:"body1",textAlign:"center",width:"100%",marginTop:2,sx:{...e,wordBreak:"break-word"},...s,children:i}),c=({children:i,...e})=>t.jsx(n,{variant:"h2",textAlign:"center",fontWeight:900,...e,children:i});function h(i){return t.jsxs(r,{sx:{mt:6.25},children:[t.jsxs(o,{direction:"row",alignItems:"center",spacing:1,sx:{"& button":{marginTop:"4px!important"}},children:[t.jsx(n,{variant:"h3",fontSize:50,fontWeight:"800",children:i.title}),i.titleRightChildren]}),!!i.description&&t.jsx(n,{variant:"h4",fontSize:30,fontWeight:"700",color:"text.disabled",children:i.description})]})}function d(i){return t.jsxs(r,{children:[t.jsxs(o,{direction:"row",alignItems:"center",spacing:1,children:[t.jsx(n,{variant:"h4",fontSize:34,fontWeight:"900",children:i.title}),i.titleRightChildren]}),!!i.description&&t.jsx(n,{variant:"h5",fontSize:24,fontWeight:"400",children:i.description})]})}export{a as P,c as S,h as a,d as b};
|