@harbortouch/skytab-analytics-report-utils 0.8.0 → 0.8.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/index.js CHANGED
@@ -570,11 +570,13 @@ var dailySalesPaymentsConfig = {
570
570
  var FIRST_COLUMN_WIDTH6 = 240;
571
571
  var FIELDS9 = {
572
572
  discountName: { type: "string", columnKey: "discountName", size: FIRST_COLUMN_WIDTH6 },
573
- discountsCount: { type: "number", columnKey: "discountCount", footerCalculation: { type: "sum" } },
573
+ ticketCount: { type: "number", columnKey: "ticketCount", footerCalculation: { type: "sum" } },
574
+ itemCount: { type: "number", columnKey: "itemCount", footerCalculation: { type: "sum" } },
574
575
  discountsAmount: { type: "money", columnKey: "discountAmount", footerCalculation: { type: "sum" } }
575
576
  };
576
577
  var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
577
- "discountsCount",
578
+ "ticketCount",
579
+ "itemCount",
578
580
  "discountsAmount"
579
581
  ];
580
582
  var DAILY_SALES_DISCOUNTS_DEFAULT_VISIBLE_COLUMNS = DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS;
@@ -882,10 +884,15 @@ var COLUMN_REGISTRY = {
882
884
  shortTitleKey: "common.report-col.discount-amount.short",
883
885
  infoTextKey: "common.report-col.discount-amount.info"
884
886
  },
885
- discountCount: {
886
- titleKey: "common.report-col.discount-count",
887
- shortTitleKey: "common.report-col.discount-count.short",
888
- infoTextKey: "common.report-col.discount-count.info"
887
+ ticketCount: {
888
+ titleKey: "common.report-col.ticket-count",
889
+ shortTitleKey: "common.report-col.ticket-count.short",
890
+ infoTextKey: "common.report-col.ticket-count.info"
891
+ },
892
+ itemCount: {
893
+ titleKey: "common.report-col.item-count",
894
+ shortTitleKey: "common.report-col.item-count.short",
895
+ infoTextKey: "common.report-col.item-count.info"
889
896
  },
890
897
  discover: {
891
898
  titleKey: "common.report-col.discover",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbortouch/skytab-analytics-report-utils",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
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,41 +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 interface FormatNumberOptions {
23
- locale?: string;
24
- decimals?: number;
25
- }
26
- export declare const formatDate: (date: Date, options?: FormatDateOptions) => string;
27
- export declare const formatTime: (date: Date | string | number, options: FormatTimeOptions) => string;
28
- export declare const formatMoney: (amount: number, options?: FormatMoneyOptions) => string;
29
- export declare const formatPercent: (value: number, decimals?: number) => string;
30
- export declare const formatInteger: (value: number) => string;
31
- export declare const formatFixedNumber: (value: number, decimals?: number) => string;
32
- export declare const formatString: (value: unknown) => string;
33
- export declare const getNumberToFormat: (value: unknown) => number;
34
- export declare const getDateToFormat: (value?: unknown) => Date | null;
35
- export declare const formatMoneyWithoutSymbol: (amount: number, options?: FormatNumberOptions) => string;
36
- export declare const getReportFormattingLocaleOptions: (locations: {
37
- currency: string;
38
- countryCode: string;
39
- language: string;
40
- }[]) => LocaleOption[];
41
- 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,6 +0,0 @@
1
- import { type ReportConfig } from '../types';
2
- type EmployeeTimecardField = 'locationId' | 'locationName' | 'businessDate' | 'employeeName' | 'isActive' | 'lookup' | 'payrollCode' | 'jobName' | 'isBreak' | 'startTime' | 'endTime' | 'shiftHours';
3
- export declare const EMPLOYEE_TIMECARD_AVAILABLE_COLUMNS: EmployeeTimecardField[];
4
- export declare const EMPLOYEE_TIMECARD_DEFAULT_VISIBLE_COLUMNS: EmployeeTimecardField[];
5
- export declare const employeeTimecardConfig: ReportConfig<EmployeeTimecardField>;
6
- export {};
@@ -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<TField = string> {
6
- type: FooterCalculationType;
7
- numeratorField?: TField;
8
- denominatorField?: TField;
9
- }
10
- export interface ColumnPresentationConfig<TField = string> {
11
- columnKey?: ReportColumnKey;
12
- type: FieldType;
13
- size?: number;
14
- enableSorting?: boolean;
15
- filteringAvailable?: boolean;
16
- footerCalculation?: FooterCalculation<TField>;
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<TField>>;
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 {};