@verifiedinc-public/shared-ui-elements 9.2.1 → 9.2.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.
@@ -3,6 +3,7 @@ interface ExportBillableEventsToCsvOptions {
3
3
  data: BillableEventsTableRow[];
4
4
  visibleProducts?: BillableProduct[];
5
5
  filename?: string;
6
+ columnFormatters?: Record<string, (value: number, row: BillableEventsTableRow) => string>;
6
7
  }
7
- export declare function exportBillableEventsToCsv({ data, visibleProducts, filename, }: ExportBillableEventsToCsvOptions): void;
8
+ export declare function exportBillableEventsToCsv({ data, visibleProducts, filename, columnFormatters, }: ExportBillableEventsToCsvOptions): void;
8
9
  export {};
@@ -1,3 +1,3 @@
1
- "use strict";import{BillableProduct as v,BILLABLE_PRODUCTS as L}from"./BillableEventsTable.types.mjs";function s(c){const t=String(c);return t.includes(",")||t.includes('"')||t.includes(`
2
- `)?`"${t.replace(/"/g,'""')}"`:t}function g({data:c,visibleProducts:t,filename:p="billable-events"}){const d=t??Object.values(v),i=L.filter(e=>d.includes(e.product)),a=i.flatMap(e=>e.columns),n=[],l=["",""];for(const e of i){l.push(s(e.label));for(let o=1;o<e.columns.length;o++)l.push("")}n.push(l.join(","));const u=["Brand","Integration Type"];for(const e of a)u.push(s(e.label));n.push(u.join(","));for(const e of c){const o=[s(e.brand),s(e.integrationType)];for(const m of a)o.push(String(e.metrics[m.key]??0));n.push(o.join(","))}const b=n.join(`
3
- `),h=new Blob([b],{type:"text/csv;charset=utf-8;"}),f=URL.createObjectURL(h),r=document.createElement("a");r.href=f,r.download=`${p}.csv`,r.click(),URL.revokeObjectURL(f)}export{g as exportBillableEventsToCsv};
1
+ "use strict";import{BillableProduct as g,BILLABLE_PRODUCTS as B}from"./BillableEventsTable.types.mjs";function n(c){const t=String(c);return t.includes(",")||t.includes('"')||t.includes(`
2
+ `)?`"${t.replace(/"/g,'""')}"`:t}function R({data:c,visibleProducts:t,filename:m="billable-events",columnFormatters:i}){const v=t??Object.values(g),a=B.filter(e=>v.includes(e.product)),u=a.flatMap(e=>e.columns),s=[],l=["",""];for(const e of a){l.push(n(e.label));for(let o=1;o<e.columns.length;o++)l.push("")}s.push(l.join(","));const f=["Brand","Integration Type"];for(const e of u)f.push(n(e.label));s.push(f.join(","));for(const e of c){const o=[n(e.brand),n(e.integrationType)];for(const d of u){const b=e.metrics[d.key]??0,h=i?.[d.key];o.push(h?n(h(b,e)):String(b))}s.push(o.join(","))}const j=s.join(`
3
+ `),L=new Blob([j],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(L),r=document.createElement("a");r.href=p,r.download=`${m}.csv`,r.click(),URL.revokeObjectURL(p)}export{R as exportBillableEventsToCsv};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "9.2.1",
3
+ "version": "9.2.2",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "sideEffects": false,