@verifiedinc-public/shared-ui-elements 9.1.5 → 9.2.0
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/BillableEventsProductTable/BillableEventsProductTable.mjs +1 -1
- package/dist/components/chart/BillableEventsProductTable/BillableEventsProductTableDataMapper.d.ts +1 -1
- package/dist/components/chart/BillableEventsProductTable/BillableEventsProductTableDataMapper.mjs +1 -1
- package/dist/components/chart/BillableEventsTable/BillableEventsTable.mjs +1 -1
- package/dist/components/chart/BillableEventsTable/BillableEventsTable.types.d.ts +5 -0
- package/dist/components/chart/BillableEventsTable/BillableEventsTableDataMapper.mjs +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{TableContainer as
|
|
1
|
+
"use strict";import{TableContainer as k,Paper as C,Table as x,TableHead as B,TableRow as h,TableCell as t,TableBody as L,TableSortLabel as S}from"@mui/material";import{useMemo as p}from"react";import{EmptyChartSection as v}from"../EmptyChartSection.mjs";import{LoadingChartSection as D}from"../LoadingChartSection.mjs";import{BILLABLE_PRODUCTS as E}from"../BillableEventsTable/BillableEventsTable.types.mjs";import{useBillableSort as P}from"../BillableEventsTable/useBillableSort.hook.mjs";import{white as j}from"../../../styles/colors.mjs";import{jsx as a,jsxs as s}from"react/jsx-runtime";const w=["brand","integrationType"],I=({data:i,isLoading:b,isFetching:g,product:d,columnSlots:l})=>{const{sortKey:c,sortDir:u,handleSort:y,sortedData:T}=P(i,w,"brand"),n=p(()=>E.find(e=>e.product===d),[d]),m=p(()=>n?.columns??[],[n]),o=(e,r,f="left")=>a(S,{active:c===e,direction:c===e?u:"asc",onClick:()=>y(e),sx:f==="right"?{flexDirection:"row"}:void 0,children:r});return!(i!=null&&i.length)&&b?a(D,{}):i!=null&&i.length?a(k,{component:C,sx:{opacity:g?.4:1},children:s(x,{sx:{backgroundColor:j},children:[a(B,{children:s(h,{children:[a(t,{children:o("brand","Brand")}),a(t,{children:o("integrationType","Integration Type")}),m.map(e=>a(t,{align:"right",children:o(e.key,e.label,"right")},e.key))]})}),a(L,{children:T.map(e=>s(h,{children:[a(t,{children:e.brand}),a(t,{children:e.integrationType}),m.map(r=>a(t,{align:"right",children:l!=null&&l[r.key]?l[r.key](e):e.metrics[r.key]??0},r.key))]},e.brandUuid))})]})}):a(v,{})};export{I as BillableEventsProductTable};
|
package/dist/components/chart/BillableEventsProductTable/BillableEventsProductTableDataMapper.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{BILLABLE_PRODUCTS as f}from"../BillableEventsTable/BillableEventsTable.types.mjs";import{formatIntegrationType as b}from"../BillableEventsTable/BillableEventsTableDataMapper.mjs";const m=({product:s,data:c,brands:u})=>{const d=f.find(r=>r.product===s);if(!d)return[];const n=new Map;for(const r of c){const t=u.find(e=>e.brandUuid===r.brandUuid);if(!t||!r.interval)continue;const
|
|
1
|
+
"use strict";import{BILLABLE_PRODUCTS as f}from"../BillableEventsTable/BillableEventsTable.types.mjs";import{formatIntegrationType as b}from"../BillableEventsTable/BillableEventsTableDataMapper.mjs";const m=({product:s,data:c,brands:u})=>{const d=f.find(r=>r.product===s);if(!d)return[];const n=new Map;for(const r of c){const t=u.find(e=>e.brandUuid===r.brandUuid);if(!t||!r.interval)continue;const a=n.get(r.brandUuid),o=a?.metrics??{};for(const e of r.interval)for(const i of d.columns)o[i.key]=(o[i.key]??0)+(Number(e[i.metricKey])||0);a||n.set(r.brandUuid,{brandUuid:r.brandUuid,brand:t.brandName,integrationType:b(t.integrationType),metrics:o,raw:r})}return Array.from(n.values())};export{m as mapBillableEventsProductTableData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{TableContainer as
|
|
1
|
+
"use strict";import{TableContainer as k,Paper as B,Table as C,TableHead as x,TableRow as m,TableCell as l,TableBody as L,TableSortLabel as v}from"@mui/material";import{useEffect as D,useMemo as u}from"react";import{EmptyChartSection as w}from"../EmptyChartSection.mjs";import{LoadingChartSection as E}from"../LoadingChartSection.mjs";import{BillableProduct as P,BILLABLE_PRODUCTS as j}from"./BillableEventsTable.types.mjs";import{useBillableSort as I}from"./useBillableSort.hook.mjs";import{white as M}from"../../../styles/colors.mjs";import{jsx as a,jsxs as t}from"react/jsx-runtime";const O=["brand","integrationType"],R=({data:n,isLoading:g,isFetching:f,visibleProducts:h,onSortedDataChange:o,columnSlots:i})=>{const{sortKey:p,sortDir:y,handleSort:T,sortedData:s}=I(n,O,"brand");D(()=>{o?.(s)},[s,o]);const c=u(()=>{const r=h??Object.values(P);return j.filter(e=>r.includes(e.product))},[h]),b=u(()=>c.flatMap(r=>r.columns),[c]),d=(r,e,S="left")=>a(v,{active:p===r,direction:p===r?y:"asc",onClick:()=>T(r),sx:S==="right"?{flexDirection:"row"}:void 0,children:e});return!(n!=null&&n.length)&&g?a(E,{}):n!=null&&n.length?a(k,{component:B,sx:{opacity:f?.4:1},children:t(C,{sx:{backgroundColor:M},children:[t(x,{children:[t(m,{children:[a(l,{rowSpan:2,children:d("brand","Brand")}),a(l,{rowSpan:2,children:d("integrationType","Integration Type")}),c.map(r=>a(l,{colSpan:r.columns.length,align:"center",sx:{fontWeight:"bold",borderBottom:"none"},children:r.label},r.product))]}),a(m,{children:b.map(r=>a(l,{align:"right",children:d(r.key,r.label,"right")},r.key))})]}),a(L,{children:s.map(r=>t(m,{children:[a(l,{children:r.brand}),a(l,{children:r.integrationType}),b.map(e=>a(l,{align:"right",children:i!=null&&i[e.key]?i[e.key](r):r.metrics[e.key]??0},e.key))]},r.brandUuid))})]})}):a(w,{})};export{R as BillableEventsTable};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartData } from '../BillableEventsProductTable';
|
|
1
3
|
export declare enum BillableProduct {
|
|
2
4
|
TEXT_TO_SIGNUP = "TEXT_TO_SIGNUP",
|
|
3
5
|
ONE_CLICK_VERIFY = "ONE_CLICK_VERIFY",
|
|
@@ -20,6 +22,7 @@ export type BillableEventsTableRow = {
|
|
|
20
22
|
brand: string;
|
|
21
23
|
integrationType: string;
|
|
22
24
|
metrics: Record<string, number>;
|
|
25
|
+
raw: ChartData;
|
|
23
26
|
};
|
|
24
27
|
export type BillableEventsTableProps = {
|
|
25
28
|
data: BillableEventsTableRow[];
|
|
@@ -27,10 +30,12 @@ export type BillableEventsTableProps = {
|
|
|
27
30
|
isFetching: boolean;
|
|
28
31
|
visibleProducts?: BillableProduct[];
|
|
29
32
|
onSortedDataChange?: (sortedData: BillableEventsTableRow[]) => void;
|
|
33
|
+
columnSlots?: Record<string, (row: BillableEventsTableRow) => React.ReactNode>;
|
|
30
34
|
};
|
|
31
35
|
export type BillableEventsProductTableProps = {
|
|
32
36
|
data: BillableEventsTableRow[];
|
|
33
37
|
isLoading: boolean;
|
|
34
38
|
isFetching: boolean;
|
|
35
39
|
product: BillableProduct;
|
|
40
|
+
columnSlots?: Record<string, (row: BillableEventsTableRow) => React.ReactNode>;
|
|
36
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{BILLABLE_PRODUCTS as b}from"./BillableEventsTable.types.mjs";const y={hosted:"SDK","non-hosted":"API","semi-hosted":"Semi-Hosted",sdk:"SDK",api:"API"};function u(
|
|
1
|
+
"use strict";import{BILLABLE_PRODUCTS as b}from"./BillableEventsTable.types.mjs";const y={hosted:"SDK","non-hosted":"API","semi-hosted":"Semi-Hosted",sdk:"SDK",api:"API"};function u(r){return r?y[r.toLowerCase()]??r:""}const g=({productDataSets:r,brands:f})=>{var c;const s=new Map,i=new Map;for(const{product:e,data:d}of r){const t=b.find(n=>n.product===e);if(t)for(const n of d){if(!((c=n.interval)!=null&&c.length))continue;const o=s.get(n.brandUuid)??{};for(const a of t.columns){const l=n.interval.reduce((m,p)=>m+(Number(p[a.metricKey])||0),0);o[a.key]=(o[a.key]??0)+l}t.columns.some(a=>(o[a.key]??0)>0)&&!i.has(n.brandUuid)&&i.set(n.brandUuid,n),s.set(n.brandUuid,o)}}return Array.from(i.entries()).map(([e,d])=>{const t=f.find(n=>n.brandUuid===e);return t?{brandUuid:e,brand:t.brandName,integrationType:u(t.integrationType),metrics:s.get(e)??{},raw:d}:null}).filter(e=>e!==null)};export{u as formatIntegrationType,g as mapBillableEventsTableData};
|