@verifiedinc-public/shared-ui-elements 9.3.0 → 9.3.1
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/chart/BillableEventsTable/BillableEventsTable.mjs +1 -1
- package/dist/components/chart/BillableEventsTable/BillableEventsTable.types.d.ts +1 -0
- package/dist/components/chart/BillableEventsTable/BillableEventsTable.types.mjs +1 -1
- package/dist/components/chart/BillableEventsTable/exportBillableEventsToCsv.d.ts +3 -2
- package/dist/components/chart/BillableEventsTable/exportBillableEventsToCsv.mjs +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{TableContainer as
|
|
1
|
+
"use strict";import{TableContainer as x,Paper as B,Table as w,TableHead as L,TableRow as b,TableCell as r,TableBody as v,TableSortLabel as D}from"@mui/material";import{useEffect as E,useMemo as u}from"react";import{EmptyChartSection as P}from"../EmptyChartSection.mjs";import{LoadingChartSection as j}from"../LoadingChartSection.mjs";import{BillableProduct as I,BILLABLE_PRODUCTS as M}from"./BillableEventsTable.types.mjs";import{useBillableSort as O}from"./useBillableSort.hook.mjs";import{white as R}from"../../../styles/colors.mjs";import{jsx as n,jsxs as s}from"react/jsx-runtime";const U=["brand","integrationType"],K=({data:o,isLoading:k,isFetching:T,visibleProducts:y,onSortedDataChange:c,columnSlots:l,topLevelColumns:t=[]})=>{const{sortKey:g,sortDir:S,handleSort:C,sortedData:d}=O(o,U,"brand");E(()=>{c?.(d)},[d,c]);const h=u(()=>{const e=y??Object.values(I);return M.filter(a=>e.includes(a.product))},[y]),m=u(()=>new Set(t.map(e=>e.key)),[t]),f=u(()=>h.flatMap(e=>e.columns).filter(e=>!m.has(e.key)),[h,m]),i=(e,a,p="left")=>n(D,{active:g===e,direction:g===e?S:"asc",onClick:()=>C(e),sx:p==="right"?{flexDirection:"row"}:void 0,children:a});return!(o!=null&&o.length)&&k?n(j,{}):o!=null&&o.length?n(x,{component:B,sx:{opacity:T?.4:1},children:s(w,{sx:{backgroundColor:R},children:[s(L,{children:[s(b,{children:[n(r,{rowSpan:2,children:i("brand","Brand")}),n(r,{rowSpan:2,children:i("integrationType","Integration Type")}),t.map(e=>n(r,{rowSpan:2,children:i(e.key,e.label)},e.key)),h.map(e=>{const a=e.columns.filter(p=>!m.has(p.key)).length;return a===0?null:n(r,{colSpan:a,align:"center",sx:{fontWeight:"bold",borderBottom:"none"},children:e.label},e.product)})]}),n(b,{children:f.map(e=>n(r,{align:"right",children:i(e.key,e.label,"right")},e.key))})]}),n(v,{children:d.map(e=>s(b,{children:[n(r,{children:e.brand}),n(r,{children:e.integrationType}),t.map(a=>n(r,{children:l!=null&&l[a.key]?l[a.key](e):e.metrics[a.key]??0},a.key)),f.map(a=>n(r,{align:"right",children:l!=null&&l[a.key]?l[a.key](e):e.metrics[a.key]??0},a.key))]},e.brandUuid))})]})}):n(P,{})};export{K as BillableEventsTable};
|
|
@@ -31,6 +31,7 @@ export type BillableEventsTableProps = {
|
|
|
31
31
|
visibleProducts?: BillableProduct[];
|
|
32
32
|
onSortedDataChange?: (sortedData: BillableEventsTableRow[]) => void;
|
|
33
33
|
columnSlots?: Record<string, (row: BillableEventsTableRow) => React.ReactNode>;
|
|
34
|
+
topLevelColumns?: BillableEventColumn[];
|
|
34
35
|
};
|
|
35
36
|
export type BillableEventsProductTableProps = {
|
|
36
37
|
data: BillableEventsTableRow[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var i=(e=>(e.TEXT_TO_SIGNUP="TEXT_TO_SIGNUP",e.ONE_CLICK_VERIFY="ONE_CLICK_VERIFY",e.ONE_CLICK_SIGNUP="ONE_CLICK_SIGNUP",e.ONE_CLICK_HEALTH="ONE_CLICK_HEALTH",e))(i||{});const l=[{product:"TEXT_TO_SIGNUP",label:"Text to Signup",columns:[{key:"tts_smsKeywordsReceived",label:"SMS Keywords Received",metricKey:"ttsSent"},{key:"tts_verificationsSucceeded",label:"Verifications Succeeded",metricKey:"ttsVerified"}]},{product:"ONE_CLICK_VERIFY",label:"1-Click Verify",columns:[{key:"verify_smsSent",label:"SMS Sent",metricKey:"oneClickVerificationSending"},{key:"verify_verificationsSucceeded",label:"Verifications Succeeded",metricKey:"oneClickVerificationVerified"}]},{product:"ONE_CLICK_SIGNUP",label:"1-Click Signup",columns:[{key:"signup_autofillsSucceeded",label:"Autofills Succeeded",metricKey:"oneClickSuccess"},{key:"
|
|
1
|
+
"use strict";var i=(e=>(e.TEXT_TO_SIGNUP="TEXT_TO_SIGNUP",e.ONE_CLICK_VERIFY="ONE_CLICK_VERIFY",e.ONE_CLICK_SIGNUP="ONE_CLICK_SIGNUP",e.ONE_CLICK_HEALTH="ONE_CLICK_HEALTH",e))(i||{});const l=[{product:"TEXT_TO_SIGNUP",label:"Text to Signup",columns:[{key:"tts_smsKeywordsReceived",label:"SMS Keywords Received",metricKey:"ttsSent"},{key:"tts_verificationsSucceeded",label:"Verifications Succeeded",metricKey:"ttsVerified"}]},{product:"ONE_CLICK_VERIFY",label:"1-Click Verify",columns:[{key:"verify_smsSent",label:"SMS Sent",metricKey:"oneClickVerificationSending"},{key:"verify_verificationsSucceeded",label:"Verifications Succeeded",metricKey:"oneClickVerificationVerified"}]},{product:"ONE_CLICK_SIGNUP",label:"1-Click Signup",columns:[{key:"signup_riskSignalsLevel",label:"Risk Signals",metricKey:"riskSignalOption"},{key:"signup_autofillsSucceeded",label:"Autofills Succeeded",metricKey:"oneClickSuccess"},{key:"signup_riskSignalsReturned",label:"Risk Signals Returned",metricKey:"riskSignal"}]},{product:"ONE_CLICK_HEALTH",label:"1-Click Health",columns:[{key:"health_autofillsStarted",label:"Autofills Started",metricKey:"oneClickHealthCreated"}]}];export{l as BILLABLE_PRODUCTS,i as BillableProduct};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BillableProduct, BillableEventsTableRow } from './BillableEventsTable.types';
|
|
1
|
+
import { BillableProduct, BillableEventColumn, BillableEventsTableRow } from './BillableEventsTable.types';
|
|
2
2
|
interface ExportBillableEventsToCsvOptions {
|
|
3
3
|
data: BillableEventsTableRow[];
|
|
4
4
|
visibleProducts?: BillableProduct[];
|
|
5
5
|
filename?: string;
|
|
6
|
+
topLevelColumns?: BillableEventColumn[];
|
|
6
7
|
columnFormatters?: Record<string, (value: number, row: BillableEventsTableRow) => string>;
|
|
7
8
|
}
|
|
8
|
-
export declare function exportBillableEventsToCsv({ data, visibleProducts, filename, columnFormatters, }: ExportBillableEventsToCsvOptions): void;
|
|
9
|
+
export declare function exportBillableEventsToCsv({ data, visibleProducts, filename, topLevelColumns, columnFormatters, }: ExportBillableEventsToCsvOptions): void;
|
|
9
10
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";import{BillableProduct as
|
|
2
|
-
`)?`"${
|
|
3
|
-
`),
|
|
1
|
+
"use strict";import{BillableProduct as L,BILLABLE_PRODUCTS as B}from"./BillableEventsTable.types.mjs";function n(u){const o=String(u);return o.includes(",")||o.includes('"')||o.includes(`
|
|
2
|
+
`)?`"${o.replace(/"/g,'""')}"`:o}function R({data:u,visibleProducts:o,filename:y="billable-events",topLevelColumns:i=[],columnFormatters:r}){const k=o??Object.values(L),h=B.filter(e=>k.includes(e.product)),b=new Set(i.map(e=>e.key)),m=h.flatMap(e=>e.columns).filter(e=>!b.has(e.key)),a=[],f=["","",...i.map(()=>"")];for(const e of h){const s=e.columns.filter(t=>!b.has(t.key)).length;if(s!==0){f.push(n(e.label));for(let t=1;t<s;t++)f.push("")}}a.push(f.join(","));const p=["Brand","Integration Type"];for(const e of i)p.push(n(e.label));for(const e of m)p.push(n(e.label));a.push(p.join(","));for(const e of u){const s=[n(e.brand),n(e.integrationType)];for(const t of i){const l=e.metrics[t.key]??0,c=r?.[t.key];s.push(c?n(c(l,e)):String(l))}for(const t of m){const l=e.metrics[t.key]??0,c=r?.[t.key];s.push(c?n(c(l,e)):String(l))}a.push(s.join(","))}const g=a.join(`
|
|
3
|
+
`),j=new Blob([g],{type:"text/csv;charset=utf-8;"}),v=URL.createObjectURL(j),d=document.createElement("a");d.href=v,d.download=`${y}.csv`,d.click(),URL.revokeObjectURL(v)}export{R as exportBillableEventsToCsv};
|