@harbortouch/skytab-analytics-report-utils 0.7.2 → 0.8.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/index.js CHANGED
@@ -1437,8 +1437,12 @@ function calculateReportTotals(data, fieldConfig, opts) {
1437
1437
  }
1438
1438
  } else {
1439
1439
  derivedFields.push({ field, calc });
1440
- if (calc.numeratorField) fieldsToSum.add(calc.numeratorField);
1441
- if (calc.denominatorField) fieldsToSum.add(calc.denominatorField);
1440
+ if (calc.numeratorField) {
1441
+ fieldsToSum.add(calc.numeratorField);
1442
+ }
1443
+ if (calc.denominatorField) {
1444
+ fieldsToSum.add(calc.denominatorField);
1445
+ }
1442
1446
  }
1443
1447
  }
1444
1448
  const sums = {};
@@ -1517,48 +1521,75 @@ var dailySalesTaxesConfig = {
1517
1521
  };
1518
1522
 
1519
1523
  // src/formatting.ts
1524
+ var dateFormatterCache = /* @__PURE__ */ new Map();
1525
+ var timeFormatterCache = /* @__PURE__ */ new Map();
1526
+ var moneyFormatterCache = /* @__PURE__ */ new Map();
1527
+ var numberFormatterCache = /* @__PURE__ */ new Map();
1528
+ var getDateFormatter = (locale, timeZone) => {
1529
+ const key = `${locale}-${timeZone}`;
1530
+ let fmt = dateFormatterCache.get(key);
1531
+ if (!fmt) {
1532
+ fmt = new Intl.DateTimeFormat(locale, { dateStyle: "short", timeZone });
1533
+ dateFormatterCache.set(key, fmt);
1534
+ }
1535
+ return fmt;
1536
+ };
1537
+ var getTimeFormatter = (locale, timeZone, format) => {
1538
+ const key = `${locale}-${timeZone}-${format}`;
1539
+ let fmt = timeFormatterCache.get(key);
1540
+ if (!fmt) {
1541
+ if (format === "00:00") {
1542
+ fmt = new Intl.DateTimeFormat(locale, { hour: "2-digit", minute: "2-digit", timeZone });
1543
+ } else if (format === "00:00-24H") {
1544
+ fmt = new Intl.DateTimeFormat(locale, {
1545
+ hour: "2-digit",
1546
+ minute: "2-digit",
1547
+ hour12: false,
1548
+ hourCycle: "h23",
1549
+ timeZone
1550
+ });
1551
+ } else {
1552
+ fmt = new Intl.DateTimeFormat(locale, { hour: "2-digit", minute: "2-digit", second: "2-digit", timeZone });
1553
+ }
1554
+ timeFormatterCache.set(key, fmt);
1555
+ }
1556
+ return fmt;
1557
+ };
1558
+ var getMoneyFormatter = (locale, currency, decimals) => {
1559
+ const key = `${locale}-${currency}-${decimals}`;
1560
+ let fmt = moneyFormatterCache.get(key);
1561
+ if (!fmt) {
1562
+ fmt = new Intl.NumberFormat(locale, {
1563
+ style: "currency",
1564
+ currency,
1565
+ minimumFractionDigits: decimals,
1566
+ maximumFractionDigits: decimals
1567
+ });
1568
+ moneyFormatterCache.set(key, fmt);
1569
+ }
1570
+ return fmt;
1571
+ };
1572
+ var getNumberFormatter = (locale, decimals) => {
1573
+ const key = `${locale}-${decimals}`;
1574
+ let fmt = numberFormatterCache.get(key);
1575
+ if (!fmt) {
1576
+ fmt = new Intl.NumberFormat(locale, { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
1577
+ numberFormatterCache.set(key, fmt);
1578
+ }
1579
+ return fmt;
1580
+ };
1520
1581
  var formatDate = (date, options = {}) => {
1521
1582
  const { locale = "en-US", timeZone = "UTC" } = options;
1522
- const d = new Date(date);
1523
- return new Intl.DateTimeFormat(locale, {
1524
- dateStyle: "short",
1525
- timeZone
1526
- }).format(d);
1583
+ return getDateFormatter(locale, timeZone).format(date);
1527
1584
  };
1528
1585
  var formatTime = (date, options) => {
1529
1586
  const { locale = "en-US", timeZone = "UTC", format } = options;
1530
1587
  const d = new Date(date);
1531
- if (format === "00:00") {
1532
- return new Intl.DateTimeFormat(locale, {
1533
- hour: "2-digit",
1534
- minute: "2-digit",
1535
- timeZone
1536
- }).format(d);
1537
- }
1538
- if (format === "00:00-24H") {
1539
- return new Intl.DateTimeFormat(locale, {
1540
- hour: "2-digit",
1541
- minute: "2-digit",
1542
- hour12: false,
1543
- hourCycle: "h23",
1544
- timeZone
1545
- }).format(d);
1546
- }
1547
- return new Intl.DateTimeFormat(locale, {
1548
- hour: "2-digit",
1549
- minute: "2-digit",
1550
- second: "2-digit",
1551
- timeZone
1552
- }).format(d);
1588
+ return getTimeFormatter(locale, timeZone, format).format(d);
1553
1589
  };
1554
1590
  var formatMoney = (amount, options = {}) => {
1555
1591
  const { locale = "en-US", currency = "USD", decimals = 2 } = options;
1556
- return new Intl.NumberFormat(locale, {
1557
- style: "currency",
1558
- currency,
1559
- minimumFractionDigits: decimals,
1560
- maximumFractionDigits: decimals
1561
- }).format(amount);
1592
+ return getMoneyFormatter(locale, currency, decimals).format(amount);
1562
1593
  };
1563
1594
  var formatPercent = (value, decimals = 2) => `${value.toFixed(decimals)}%`;
1564
1595
  var formatInteger = (value) => Math.round(value).toString();
@@ -1579,10 +1610,7 @@ var getDateToFormat = (value) => {
1579
1610
  };
1580
1611
  var formatMoneyWithoutSymbol = (amount, options = {}) => {
1581
1612
  const { locale = "en-US", decimals = 2 } = options;
1582
- return new Intl.NumberFormat(locale, {
1583
- minimumFractionDigits: decimals,
1584
- maximumFractionDigits: decimals
1585
- }).format(amount);
1613
+ return getNumberFormatter(locale, decimals).format(amount);
1586
1614
  };
1587
1615
  var getReportFormattingLocaleOptions = (locations) => {
1588
1616
  if (locations.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbortouch/skytab-analytics-report-utils",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
4
4
  "description": "Centralized report column presentation configuration for SkyTab Analytics",
5
5
  "engines": {
6
6
  "node": ">=22.6.0",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "type": "module",
23
23
  "scripts": {
24
- "build": "tsup && tsc -p tsconfig.build.json",
24
+ "build": "tsup",
25
25
  "dev": "tsup --watch",
26
26
  "lint:js": "eslint src",
27
27
  "lint:js:fix": "eslint src --fix",
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- export type ReportColumnKey = 'fifteenMinInterval' | 'adjustedTips' | 'advantageProgram' | 'amex' | 'amexReturns' | 'attachRate' | 'autoGratuity' | 'averageGrossPrice' | 'bankFees' | 'batchAmount' | 'batchDate' | 'batchNumber' | 'clockInTime' | 'clockOutTime' | 'country' | 'customerName' | 'date' | 'dateClose' | 'daypart' | 'debit' | 'debitReturns' | 'declaredTips' | 'department' | 'depositCurrency' | 'depositDate' | 'discountAmount' | 'discountCount' | 'discover' | 'discoverReturns' | 'ebt' | 'ebtReturns' | 'employeeId' | 'employeeJob' | 'employeeName' | 'exemptTaxes' | 'grandTotal' | 'grossCashSales' | 'grossCashTips' | 'grossCreditCardTips' | 'grossCreditSales' | 'grossSales' | 'grossTips' | 'guestCount' | 'guestsVarLw' | 'guestsVarLwPct' | 'guestsVarLy' | 'guestsVarLyPct' | 'hour' | 'hoursWorked' | 'inclusiveTax' | 'itemName' | 'itemPrice' | 'locationCity' | 'locationId' | 'locationMid' | 'locationName' | 'locationState' | 'mastercard' | 'mcReturns' | 'modifierName' | 'modifierPrice' | 'modifierQuantity' | 'netSales' | 'netTaxCollected' | 'netTips' | 'numberOfGuests' | 'orderType' | 'paymentType' | 'payrollId' | 'quantity' | 'referenceNumber' | 'refundAmount' | 'refundedTaxAmount' | 'revenueCenter' | 'revenueClass' | 'salesVarLw' | 'salesVarLwPct' | 'salesVarLy' | 'salesVarLyPct' | 'salesMixByPct' | 'salesPerGuest' | 'salesPerGuestLw' | 'salesPerGuestLy' | 'scheduledShiftEnd' | 'scheduledShiftStart' | 'settlementBatchDate' | 'shiftDurationHrs' | 'subtotal' | 'taxCollected' | 'taxName' | 'taxRate' | 'taxableSales' | 'ticketClosed' | 'ticketFee' | 'ticketNumber' | 'ticketOpen' | 'ticketTotal' | 'timeOpenMins' | 'tipPct' | 'tipReduction' | 'tipShare' | 'tips' | 'tipsPerHour' | 'totalCollected' | 'totalItemSales' | 'totalModifierSales' | 'totalReturns' | 'totalSales' | 'totalTips' | 'transactionDate' | 'transactionType' | 'untaxedSales' | 'visa' | 'visaReturns' | 'paymentsCount' | 'paymentsAmount' | 'paymentsTotal' | 'refundVoidDescription' | 'refundVoidCount' | 'refundVoidAmount' | 'refundVoidPctSales' | 'discountName' | 'tickets' | 'guests' | 'ticketAverage' | 'guestAverage' | 'net' | 'salePaymentType' | 'status';
2
- export interface ColumnMetadata {
3
- titleKey: string;
4
- shortTitleKey: string;
5
- infoTextKey: string;
6
- }
7
- export declare const COLUMN_REGISTRY: Record<ReportColumnKey, ColumnMetadata>;
8
- export declare function getColumnMetadata(key: ReportColumnKey): ColumnMetadata;
9
- export declare function getColumnExportHeaderLabel(colTitle: string, groupTitle: string | null): string;
@@ -1,37 +0,0 @@
1
- import type { FieldType } from './types';
2
- export type TimeFormat = '00:00' | '00:00:00' | '00:00-24H';
3
- export interface LocaleOption {
4
- currency: string;
5
- locale: string;
6
- }
7
- export interface FormatDateOptions {
8
- locale?: string;
9
- timeZone?: string;
10
- format?: TimeFormat;
11
- }
12
- export interface FormatTimeOptions {
13
- locale?: string;
14
- timeZone?: string;
15
- format: TimeFormat;
16
- }
17
- export interface FormatMoneyOptions {
18
- locale?: string;
19
- currency?: string;
20
- decimals?: number;
21
- }
22
- export declare const formatDate: (date: Date, options?: FormatDateOptions) => string;
23
- export declare const formatTime: (date: Date | string | number, options: FormatTimeOptions) => string;
24
- export declare const formatMoney: (amount: number, options?: FormatMoneyOptions) => string;
25
- export declare const formatPercent: (value: number, decimals?: number) => string;
26
- export declare const formatInteger: (value: number) => string;
27
- export declare const formatFixedNumber: (value: number, decimals?: number) => string;
28
- export declare const formatString: (value: unknown) => string;
29
- export declare const getNumberToFormat: (value: unknown) => number;
30
- export declare const getDateToFormat: (value?: unknown) => Date | null;
31
- export declare const formatMoneyWithoutSymbol: (amount: number, options?: FormatMoneyOptions) => string;
32
- export declare const getReportFormattingLocaleOptions: (locations: {
33
- currency: string;
34
- countryCode: string;
35
- language: string;
36
- }[]) => LocaleOption[];
37
- export declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption) => string;
@@ -1 +0,0 @@
1
- export {};
package/dist/report.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import type { ReportConfig } from './types';
2
- export declare const Report: {
3
- readonly TICKET_LIVE: "ticket-live";
4
- readonly TICKET_ANALYTICS: "ticket-analytics";
5
- readonly SALES_SUMMARY: "sales-summary";
6
- readonly PRODUCT_MIX: "product-mix";
7
- readonly MODIFIER_MIX: "modifier-mix";
8
- readonly ITEM_TAX: "item-tax";
9
- readonly EMPLOYEE_TIMECARD: "employee-timecard";
10
- readonly EMPLOYEE_TIP: "employee-tip";
11
- readonly SALES_BY_ITEM: "sales-by-item";
12
- readonly DAILY_SALES: "daily-sales";
13
- readonly DAILY_SALES_LIVE: "daily-sales-live";
14
- };
15
- export type ReportType = (typeof Report)[keyof typeof Report];
16
- export declare const getReportConfig: (reportType: ReportType) => ReportConfig<string> | null;
@@ -1,9 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type DailySalesField = 'groupById' | 'groupByName' | 'itemsQuantity' | 'salesAmountGross' | 'discountsAmount' | 'inclusiveTaxesAmount' | 'salesAmountNet' | 'salesMixPct' | 'avgPrice' | 'ticketsCount' | 'guestsCount' | 'ticketAverage' | 'guestAverage' | 'ticketAvg' | 'guestAvg';
3
- export declare const DAILY_SALES_AVAILABLE_COLUMNS: DailySalesField[];
4
- export declare const DAILY_SALES_BY_GROUP_AVAILABLE_COLUMNS: DailySalesField[];
5
- export declare const DAILY_SALES_DEFAULT_VISIBLE_COLUMNS: DailySalesField[];
6
- export declare const dailySalesConfig: ReportConfig<DailySalesField>;
7
- export declare const DAILY_SALES_TRENDS_AVAILABLE_COLUMNS: DailySalesField[];
8
- export declare const dailySalesTrendsConfig: ReportConfig<DailySalesField>;
9
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type DailySalesDiscountsField = 'discountName' | 'discountsCount' | 'discountsAmount';
3
- export declare const DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS: DailySalesDiscountsField[];
4
- export declare const DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS: DailySalesDiscountsField[];
5
- export declare const dailySalesDiscountsConfig: ReportConfig<DailySalesDiscountsField>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type DailySalesPaymentsField = 'paymentTypeName' | 'paymentsCount' | 'paymentsAmount' | 'tipsAmount' | 'totalSales';
3
- export declare const DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS: DailySalesPaymentsField[];
4
- export declare const DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS: DailySalesPaymentsField[];
5
- export declare const dailySalesPaymentsConfig: ReportConfig<DailySalesPaymentsField>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type DailySalesRefundsVoidsField = 'description' | 'count' | 'amount' | 'pctSales';
3
- export declare const DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS: DailySalesRefundsVoidsField[];
4
- export declare const DAILY_SALES_REFUNDS_VOIDS_DEFAULT_VISIBLE_COLUMNS: DailySalesRefundsVoidsField[];
5
- export declare const dailySalesRefundsVoidsConfig: ReportConfig<DailySalesRefundsVoidsField>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type DailySalesTaxesField = 'taxName' | 'taxableSales' | 'taxesAmount' | 'exemptSales';
3
- export declare const DAILY_SALES_TAXES_AVAILABLE_COLUMNS: DailySalesTaxesField[];
4
- export declare const DAILY_SALES_TAXES_DEFAULT_VISIBLE_COLUMNS: DailySalesTaxesField[];
5
- export declare const dailySalesTaxesConfig: ReportConfig<DailySalesTaxesField>;
6
- export {};
@@ -1,4 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- export declare const EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS: string[];
3
- export declare const EMPLOYEE_TIMECARD_DEFAULT_VISIBLE_COLUMNS: string[];
4
- export declare const employeeTimecardConfig: ReportConfig;
@@ -1,10 +0,0 @@
1
- export { salesSummaryConfig, SALES_SUMMARY_AVAILABLE_COLUMNS, SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS, } from './salesSummary';
2
- export { ticketSummaryConfig, TICKET_SUMMARY_AVAILABLE_COLUMNS, TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS, } from './ticketSummary';
3
- export { ticketLiveConfig, TICKET_LIVE_AVAILABLE_COLUMNS, TICKET_LIVE_DEFAULT_VISIBLE_COLUMNS } from './ticketLive';
4
- export { productMixConfig, PRODUCT_MIX_AVAILABLE_COLUMNS, PRODUCT_MIX_DEFAULT_VISIBLE_COLUMNS, PRODUCT_MIX_CHART_FIELDS, } from './productMix';
5
- export { modifierMixConfig, MODIFIER_MIX_AVAILABLE_COLUMNS, MODIFIER_MIX_DEFAULT_VISIBLE_COLUMNS } from './modifierMix';
6
- export { itemTaxConfig, ITEM_TAX_AVAILABLE_COLUMNS, ITEM_TAX_DEFAULT_VISIBLE_COLUMNS } from './itemTax';
7
- export { dailySalesConfig, dailySalesTrendsConfig, DAILY_SALES_AVAILABLE_COLUMNS, DAILY_SALES_DEFAULT_VISIBLE_COLUMNS, DAILY_SALES_BY_GROUP_AVAILABLE_COLUMNS, DAILY_SALES_TRENDS_AVAILABLE_COLUMNS, } from './dailySales';
8
- export { dailySalesPaymentsConfig, DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS, DAILY_SALES_PAYMENTS_DEFAULT_VISIBLE_COLUMNS, } from './dailySalesPayments';
9
- export { dailySalesDiscountsConfig, DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS, DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS, } from './dailySalesDiscounts';
10
- export { employeeTimecardConfig, EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS, EMPLOYEE_TIMECARD_DEFAULT_VISIBLE_COLUMNS, } from './employeeTimecard';
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type ItemTaxField = 'locationId' | 'taxIsFlat' | 'merchantId' | 'locationName' | 'locationCity' | 'locationState' | 'itemName' | 'itemPrice' | 'departmentName' | 'revenueClassName' | 'orderTypeName' | 'taxName' | 'taxValue' | 'taxRate' | 'recordsCount' | 'taxableSales' | 'totalCollected' | 'itemTax' | 'taxCollected';
3
- export declare const ITEM_TAX_AVAILABLE_COLUMNS: ItemTaxField[];
4
- export declare const ITEM_TAX_DEFAULT_VISIBLE_COLUMNS: ItemTaxField[];
5
- export declare const itemTaxConfig: ReportConfig<ItemTaxField>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type ModifierMixField = 'groupById' | 'groupByName' | 'groupById2' | 'groupByName2' | 'modifiersSales' | 'modifiersQuantity' | 'itemsQuantity' | 'avgGross' | 'attachRate' | 'modifiersSalesComp' | 'modifiersQuantityComp' | 'itemsQuantityComp' | 'attachRateComp' | 'modifiersSalesVar' | 'modifiersSalesVarPct' | 'modifiersQuantityVar' | 'modifiersQuantityVarPct' | 'attachRateVar' | 'attachRateVarPct';
3
- export declare const MODIFIER_MIX_AVAILABLE_COLUMNS: ModifierMixField[];
4
- export declare const MODIFIER_MIX_DEFAULT_VISIBLE_COLUMNS: ModifierMixField[];
5
- export declare const modifierMixConfig: ReportConfig<ModifierMixField>;
6
- export {};
@@ -1,7 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type ProductMixField = 'groupById' | 'groupByName' | 'salesAmountGross' | 'discountsAmount' | 'inclusiveTaxesAmount' | 'salesAmountNet' | 'itemsQuantity' | 'avgPrice' | 'salesMixPct';
3
- export declare const PRODUCT_MIX_AVAILABLE_COLUMNS: ProductMixField[];
4
- export declare const PRODUCT_MIX_DEFAULT_VISIBLE_COLUMNS: ProductMixField[];
5
- export declare const PRODUCT_MIX_CHART_FIELDS: ProductMixField[];
6
- export declare const productMixConfig: ReportConfig<ProductMixField>;
7
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type SalesByItemDetailField = 'businessDate' | 'ticketClosedAt' | 'hourId' | 'daypartName' | 'locationId' | 'locationName' | 'departmentName' | 'itemName' | 'revenueCenterName' | 'revenueClassName' | 'salesAmountGross' | 'itemsQuantity' | 'transactionId' | 'guestsCount' | 'employeeName' | 'orderTypeName' | 'salesType' | 'itemPrice';
3
- export declare const SALES_BY_ITEM_DETAIL_AVAILABLE_COLUMNS: SalesByItemDetailField[];
4
- export declare const SALES_BY_ITEM_DETAIL_DEFAULT_VISIBLE_COLUMNS: SalesByItemDetailField[];
5
- export declare const salesByItemDetailConfig: ReportConfig<SalesByItemDetailField>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type SalesSummaryField = 'groupById' | 'groupByName' | 'salesAmountNet' | 'salesVarLW' | 'salesVarLY' | 'salesVarLWPct' | 'salesVarLYPct' | 'salesAmountNetLastWeek' | 'salesAmountNetLastYear' | 'salesAmountGross' | 'salesAmountGrossLastWeek' | 'salesAmountGrossLastYear' | 'ticketsCount' | 'ticketsCountLastWeek' | 'ticketsCountLastYear' | 'guestsCount' | 'guestsVarLW' | 'guestsVarLY' | 'guestsVarLWPct' | 'guestsVarLYPct' | 'guestsCountLastWeek' | 'guestsCountLastYear' | 'salesPerGuestTY' | 'salesPerGuestLW' | 'salesPerGuestLY';
3
- export declare const SALES_SUMMARY_AVAILABLE_COLUMNS: SalesSummaryField[];
4
- export declare const SALES_SUMMARY_DEFAULT_VISIBLE_COLUMNS: SalesSummaryField[];
5
- export declare const salesSummaryConfig: ReportConfig<SalesSummaryField>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type TicketLiveField = 'locationName' | 'orderNumber' | 'dateOpen' | 'timeOpen' | 'dateClose' | 'timeClose' | 'durationMinutes' | 'subtotal' | 'discountTotal' | 'surchargeTotal' | 'taxTotal' | 'grandTotal' | 'gratuityTotal' | 'totalTips' | 'paymentsReceived' | 'paymentTypeName' | 'guestCount' | 'customerName' | 'employeeName' | 'orderType';
3
- export declare const TICKET_LIVE_AVAILABLE_COLUMNS: TicketLiveField[];
4
- export declare const TICKET_LIVE_DEFAULT_VISIBLE_COLUMNS: TicketLiveField[];
5
- export declare const ticketLiveConfig: ReportConfig<TicketLiveField>;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type TicketSummaryField = 'ticketId' | 'locationId' | 'orderName' | 'revenueCenterName' | 'daypartName' | 'inclusiveTaxesAmount' | 'locationName' | 'orderNumber' | 'businessDate' | 'ticketOpenedAt' | 'ticketClosedAt' | 'ticketTime' | 'ticketSubtotal' | 'discountsAmount' | 'surchargesAmount' | 'taxesAmount' | 'ticketGrandTotal' | 'gratuitiesAmount' | 'tipAmount' | 'paymentsAmount' | 'paymentTypeName' | 'guestsCount' | 'employeeName' | 'orderTypeName';
3
- export declare const TICKET_SUMMARY_AVAILABLE_COLUMNS: TicketSummaryField[];
4
- export declare const TICKET_SUMMARY_DEFAULT_VISIBLE_COLUMNS: TicketSummaryField[];
5
- export declare const ticketSummaryConfig: ReportConfig<TicketSummaryField>;
6
- export {};
package/dist/totals.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { type ColumnPresentationConfig } from './types';
2
- export interface CalculateReportTotalsOptions {
3
- labelField: string;
4
- label: string;
5
- }
6
- export declare function calculateReportTotals<T>(data: T[], fieldConfig: Record<string, ColumnPresentationConfig>, opts: CalculateReportTotalsOptions): T;
@@ -1 +0,0 @@
1
- export {};
package/dist/types.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import { type ReportColumnKey } from './columns';
2
- export type FieldType = 'string' | 'money' | 'percent' | 'number' | 'fixedNumber' | 'date' | 'time' | 'boolean';
3
- export type ColumnAlignment = 'left' | 'right';
4
- export type FooterCalculationType = 'sum' | 'percentChange' | 'average' | 'none';
5
- export interface FooterCalculation {
6
- type: FooterCalculationType;
7
- numeratorField?: string;
8
- denominatorField?: string;
9
- }
10
- export interface ColumnPresentationConfig {
11
- columnKey?: ReportColumnKey;
12
- type?: FieldType;
13
- size?: number;
14
- enableSorting?: boolean;
15
- filteringAvailable?: boolean;
16
- footerCalculation?: FooterCalculation;
17
- }
18
- export interface ColumnGroupConfig {
19
- id: string;
20
- headerTranslationKey: string;
21
- baseFields: string[];
22
- lastWeekFields?: string[];
23
- lastYearFields?: string[];
24
- }
25
- export interface ReportConfig<TField extends string = string> {
26
- fields: Record<TField, ColumnPresentationConfig>;
27
- availableColumns: TField[];
28
- defaultVisibleColumns: TField[];
29
- columnGroups?: ColumnGroupConfig[];
30
- }
@@ -1,3 +0,0 @@
1
- import { type ColumnAlignment, type FieldType } from '../types';
2
- export declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
3
- export declare function isNumericType(type?: FieldType): boolean;
@@ -1 +0,0 @@
1
- export {};