@harbortouch/skytab-analytics-report-utils 0.13.0 → 0.14.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/index.cjs +33 -3
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +32 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,7 @@ __export(index_exports, {
|
|
|
48
48
|
getDateToFormat: () => getDateToFormat,
|
|
49
49
|
getNumberToFormat: () => getNumberToFormat,
|
|
50
50
|
getReportConfig: () => getReportConfig,
|
|
51
|
+
getReportExportFileName: () => getReportExportFileName,
|
|
51
52
|
getReportFormattingLocaleOptions: () => getReportFormattingLocaleOptions,
|
|
52
53
|
isNumericType: () => isNumericType,
|
|
53
54
|
itemTaxConfig: () => itemTaxConfig,
|
|
@@ -259,7 +260,7 @@ var FIELDS3 = {
|
|
|
259
260
|
footerCalculation: { type: "sum" }
|
|
260
261
|
},
|
|
261
262
|
locationName: { type: "string", size: 240, columnKey: "locationName" },
|
|
262
|
-
orderNumber: { type: "number", columnKey: "ticketNumber", footerCalculation: { type: "
|
|
263
|
+
orderNumber: { type: "number", columnKey: "ticketNumber", footerCalculation: { type: "none" } },
|
|
263
264
|
businessDate: { type: "date", columnKey: "date" },
|
|
264
265
|
ticketOpenedAt: { type: "time", columnKey: "ticketOpen" },
|
|
265
266
|
ticketClosedAt: { type: "time", columnKey: "ticketClosed" },
|
|
@@ -344,8 +345,7 @@ var FIELDS4 = {
|
|
|
344
345
|
locationName: { type: "string", columnKey: "locationName" },
|
|
345
346
|
orderNumber: {
|
|
346
347
|
type: "number",
|
|
347
|
-
columnKey: "ticketNumber"
|
|
348
|
-
footerCalculation: { type: "count" }
|
|
348
|
+
columnKey: "ticketNumber"
|
|
349
349
|
},
|
|
350
350
|
dateOpen: { type: "string", columnKey: "date" },
|
|
351
351
|
timeOpen: { type: "string", columnKey: "ticketOpen" },
|
|
@@ -769,7 +769,36 @@ var REPORT_CONFIG_MAP = {
|
|
|
769
769
|
"daily-sales-live": dailySalesLiveConfig,
|
|
770
770
|
"daily-sales-trends": dailySalesTrendsConfig
|
|
771
771
|
};
|
|
772
|
+
var REPORT_DEFAULT_NAME_MAP = {
|
|
773
|
+
"sales-summary": "Sales",
|
|
774
|
+
"ticket-analytics": "Tickets",
|
|
775
|
+
"ticket-live": "Tickets Live",
|
|
776
|
+
"product-mix": "Product Mix",
|
|
777
|
+
"modifier-mix": "Modifier Mix",
|
|
778
|
+
"item-tax": "Sales Tax by Item",
|
|
779
|
+
"employee-timecard": "Employee Timecard",
|
|
780
|
+
"employee-tip": "Employee Tip",
|
|
781
|
+
"sales-by-item": "Sales by Item",
|
|
782
|
+
"daily-sales": "Daily Sales",
|
|
783
|
+
"daily-sales-live": "Daily Sales Live",
|
|
784
|
+
"daily-sales-trends": "Daily Sales Trends"
|
|
785
|
+
};
|
|
772
786
|
var getReportConfig = (reportType) => REPORT_CONFIG_MAP[reportType];
|
|
787
|
+
var getReportExportFileName = ({
|
|
788
|
+
reportType,
|
|
789
|
+
startDate,
|
|
790
|
+
endDate
|
|
791
|
+
}) => {
|
|
792
|
+
const formatDate2 = (date) => {
|
|
793
|
+
return [
|
|
794
|
+
date.getFullYear(),
|
|
795
|
+
String(date.getMonth() + 1).padStart(2, "0"),
|
|
796
|
+
String(date.getDate()).padStart(2, "0")
|
|
797
|
+
].join("-");
|
|
798
|
+
};
|
|
799
|
+
const filename = REPORT_DEFAULT_NAME_MAP[reportType].replace(/\s+/g, "_") ?? "Report";
|
|
800
|
+
return `${filename}_${formatDate2(startDate)}_to_${formatDate2(endDate)}`;
|
|
801
|
+
};
|
|
773
802
|
|
|
774
803
|
// src/columns/index.ts
|
|
775
804
|
var COLUMN_REGISTRY = {
|
|
@@ -1752,6 +1781,7 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
1752
1781
|
getDateToFormat,
|
|
1753
1782
|
getNumberToFormat,
|
|
1754
1783
|
getReportConfig,
|
|
1784
|
+
getReportExportFileName,
|
|
1755
1785
|
getReportFormattingLocaleOptions,
|
|
1756
1786
|
isNumericType,
|
|
1757
1787
|
itemTaxConfig,
|
package/dist/index.d.cts
CHANGED
|
@@ -1246,6 +1246,11 @@ declare const Report: {
|
|
|
1246
1246
|
};
|
|
1247
1247
|
type ReportType = (typeof Report)[keyof typeof Report];
|
|
1248
1248
|
declare const getReportConfig: (reportType: ReportType) => ReportConfig<string> | null;
|
|
1249
|
+
declare const getReportExportFileName: ({ reportType, startDate, endDate, }: {
|
|
1250
|
+
reportType: ReportType;
|
|
1251
|
+
startDate: Date;
|
|
1252
|
+
endDate: Date;
|
|
1253
|
+
}) => string;
|
|
1249
1254
|
|
|
1250
1255
|
declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
|
|
1251
1256
|
declare function isNumericType(type?: FieldType): boolean;
|
|
@@ -1428,4 +1433,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
|
|
|
1428
1433
|
}[]) => LocaleOption[];
|
|
1429
1434
|
declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
|
|
1430
1435
|
|
|
1431
|
-
export { COLUMN_REGISTRY, type CalculateReportTotalsOptions, type ColumnAlignment, type ColumnGroupConfig, type ColumnMetadata, type ColumnPresentationConfig, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type FieldType, type FooterCalculation, type FooterCalculationType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, Report, type ReportColumnKey, type ReportConfig, type ReportType, type SalesByItemDetailField, type SalesSummaryField, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, employeeTimecardConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getColumnExportHeaderLabel, getColumnMetadata, getDateToFormat, getNumberToFormat, getReportConfig, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
|
1436
|
+
export { COLUMN_REGISTRY, type CalculateReportTotalsOptions, type ColumnAlignment, type ColumnGroupConfig, type ColumnMetadata, type ColumnPresentationConfig, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type FieldType, type FooterCalculation, type FooterCalculationType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, Report, type ReportColumnKey, type ReportConfig, type ReportType, type SalesByItemDetailField, type SalesSummaryField, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, employeeTimecardConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getColumnExportHeaderLabel, getColumnMetadata, getDateToFormat, getNumberToFormat, getReportConfig, getReportExportFileName, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1246,6 +1246,11 @@ declare const Report: {
|
|
|
1246
1246
|
};
|
|
1247
1247
|
type ReportType = (typeof Report)[keyof typeof Report];
|
|
1248
1248
|
declare const getReportConfig: (reportType: ReportType) => ReportConfig<string> | null;
|
|
1249
|
+
declare const getReportExportFileName: ({ reportType, startDate, endDate, }: {
|
|
1250
|
+
reportType: ReportType;
|
|
1251
|
+
startDate: Date;
|
|
1252
|
+
endDate: Date;
|
|
1253
|
+
}) => string;
|
|
1249
1254
|
|
|
1250
1255
|
declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
|
|
1251
1256
|
declare function isNumericType(type?: FieldType): boolean;
|
|
@@ -1428,4 +1433,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
|
|
|
1428
1433
|
}[]) => LocaleOption[];
|
|
1429
1434
|
declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
|
|
1430
1435
|
|
|
1431
|
-
export { COLUMN_REGISTRY, type CalculateReportTotalsOptions, type ColumnAlignment, type ColumnGroupConfig, type ColumnMetadata, type ColumnPresentationConfig, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type FieldType, type FooterCalculation, type FooterCalculationType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, Report, type ReportColumnKey, type ReportConfig, type ReportType, type SalesByItemDetailField, type SalesSummaryField, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, employeeTimecardConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getColumnExportHeaderLabel, getColumnMetadata, getDateToFormat, getNumberToFormat, getReportConfig, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
|
1436
|
+
export { COLUMN_REGISTRY, type CalculateReportTotalsOptions, type ColumnAlignment, type ColumnGroupConfig, type ColumnMetadata, type ColumnPresentationConfig, type DailySalesCacheField, type DailySalesDiscountsField, type DailySalesField, type DailySalesLiveField, type DailySalesPaymentsField, type DailySalesRefundsVoidsField, type DailySalesTaxesField, type DailySalesTrendsField, type EmployeeTimecardField, type FieldType, type FooterCalculation, type FooterCalculationType, type FormatDateOptions, type FormatMoneyOptions, type FormatNumberOptions, type FormatTimeOptions, type ItemTaxField, type LocaleOption, type ModifierMixField, type ProductMixField, Report, type ReportColumnKey, type ReportConfig, type ReportType, type SalesByItemDetailField, type SalesSummaryField, type TicketLiveField, type TicketSummaryField, type TimeFormat, calculateFieldTotal, calculateReportTotals, dailySalesCacheConfig, dailySalesConfig, dailySalesDiscountsConfig, dailySalesLiveConfig, dailySalesPaymentsConfig, dailySalesRefundsVoidsConfig, dailySalesTaxesConfig, dailySalesTrendsConfig, employeeTimecardConfig, formatDate, formatFieldValue, formatFixedNumber, formatInteger, formatMoney, formatMoneyWithoutSymbol, formatPercent, formatString, formatTime, getColumnAlignment, getColumnExportHeaderLabel, getColumnMetadata, getDateToFormat, getNumberToFormat, getReportConfig, getReportExportFileName, getReportFormattingLocaleOptions, isNumericType, itemTaxConfig, modifierMixConfig, productMixConfig, salesByItemDetailConfig, salesSummaryConfig, ticketLiveConfig, ticketSummaryConfig };
|
package/dist/index.js
CHANGED
|
@@ -197,7 +197,7 @@ var FIELDS3 = {
|
|
|
197
197
|
footerCalculation: { type: "sum" }
|
|
198
198
|
},
|
|
199
199
|
locationName: { type: "string", size: 240, columnKey: "locationName" },
|
|
200
|
-
orderNumber: { type: "number", columnKey: "ticketNumber", footerCalculation: { type: "
|
|
200
|
+
orderNumber: { type: "number", columnKey: "ticketNumber", footerCalculation: { type: "none" } },
|
|
201
201
|
businessDate: { type: "date", columnKey: "date" },
|
|
202
202
|
ticketOpenedAt: { type: "time", columnKey: "ticketOpen" },
|
|
203
203
|
ticketClosedAt: { type: "time", columnKey: "ticketClosed" },
|
|
@@ -282,8 +282,7 @@ var FIELDS4 = {
|
|
|
282
282
|
locationName: { type: "string", columnKey: "locationName" },
|
|
283
283
|
orderNumber: {
|
|
284
284
|
type: "number",
|
|
285
|
-
columnKey: "ticketNumber"
|
|
286
|
-
footerCalculation: { type: "count" }
|
|
285
|
+
columnKey: "ticketNumber"
|
|
287
286
|
},
|
|
288
287
|
dateOpen: { type: "string", columnKey: "date" },
|
|
289
288
|
timeOpen: { type: "string", columnKey: "ticketOpen" },
|
|
@@ -707,7 +706,36 @@ var REPORT_CONFIG_MAP = {
|
|
|
707
706
|
"daily-sales-live": dailySalesLiveConfig,
|
|
708
707
|
"daily-sales-trends": dailySalesTrendsConfig
|
|
709
708
|
};
|
|
709
|
+
var REPORT_DEFAULT_NAME_MAP = {
|
|
710
|
+
"sales-summary": "Sales",
|
|
711
|
+
"ticket-analytics": "Tickets",
|
|
712
|
+
"ticket-live": "Tickets Live",
|
|
713
|
+
"product-mix": "Product Mix",
|
|
714
|
+
"modifier-mix": "Modifier Mix",
|
|
715
|
+
"item-tax": "Sales Tax by Item",
|
|
716
|
+
"employee-timecard": "Employee Timecard",
|
|
717
|
+
"employee-tip": "Employee Tip",
|
|
718
|
+
"sales-by-item": "Sales by Item",
|
|
719
|
+
"daily-sales": "Daily Sales",
|
|
720
|
+
"daily-sales-live": "Daily Sales Live",
|
|
721
|
+
"daily-sales-trends": "Daily Sales Trends"
|
|
722
|
+
};
|
|
710
723
|
var getReportConfig = (reportType) => REPORT_CONFIG_MAP[reportType];
|
|
724
|
+
var getReportExportFileName = ({
|
|
725
|
+
reportType,
|
|
726
|
+
startDate,
|
|
727
|
+
endDate
|
|
728
|
+
}) => {
|
|
729
|
+
const formatDate2 = (date) => {
|
|
730
|
+
return [
|
|
731
|
+
date.getFullYear(),
|
|
732
|
+
String(date.getMonth() + 1).padStart(2, "0"),
|
|
733
|
+
String(date.getDate()).padStart(2, "0")
|
|
734
|
+
].join("-");
|
|
735
|
+
};
|
|
736
|
+
const filename = REPORT_DEFAULT_NAME_MAP[reportType].replace(/\s+/g, "_") ?? "Report";
|
|
737
|
+
return `${filename}_${formatDate2(startDate)}_to_${formatDate2(endDate)}`;
|
|
738
|
+
};
|
|
711
739
|
|
|
712
740
|
// src/columns/index.ts
|
|
713
741
|
var COLUMN_REGISTRY = {
|
|
@@ -1689,6 +1717,7 @@ export {
|
|
|
1689
1717
|
getDateToFormat,
|
|
1690
1718
|
getNumberToFormat,
|
|
1691
1719
|
getReportConfig,
|
|
1720
|
+
getReportExportFileName,
|
|
1692
1721
|
getReportFormattingLocaleOptions,
|
|
1693
1722
|
isNumericType,
|
|
1694
1723
|
itemTaxConfig,
|