@harbortouch/skytab-analytics-report-utils 0.13.1 → 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 +31 -0
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +30 -0
- 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,
|
|
@@ -768,7 +769,36 @@ var REPORT_CONFIG_MAP = {
|
|
|
768
769
|
"daily-sales-live": dailySalesLiveConfig,
|
|
769
770
|
"daily-sales-trends": dailySalesTrendsConfig
|
|
770
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
|
+
};
|
|
771
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
|
+
};
|
|
772
802
|
|
|
773
803
|
// src/columns/index.ts
|
|
774
804
|
var COLUMN_REGISTRY = {
|
|
@@ -1751,6 +1781,7 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
1751
1781
|
getDateToFormat,
|
|
1752
1782
|
getNumberToFormat,
|
|
1753
1783
|
getReportConfig,
|
|
1784
|
+
getReportExportFileName,
|
|
1754
1785
|
getReportFormattingLocaleOptions,
|
|
1755
1786
|
isNumericType,
|
|
1756
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
|
@@ -706,7 +706,36 @@ var REPORT_CONFIG_MAP = {
|
|
|
706
706
|
"daily-sales-live": dailySalesLiveConfig,
|
|
707
707
|
"daily-sales-trends": dailySalesTrendsConfig
|
|
708
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
|
+
};
|
|
709
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
|
+
};
|
|
710
739
|
|
|
711
740
|
// src/columns/index.ts
|
|
712
741
|
var COLUMN_REGISTRY = {
|
|
@@ -1688,6 +1717,7 @@ export {
|
|
|
1688
1717
|
getDateToFormat,
|
|
1689
1718
|
getNumberToFormat,
|
|
1690
1719
|
getReportConfig,
|
|
1720
|
+
getReportExportFileName,
|
|
1691
1721
|
getReportFormattingLocaleOptions,
|
|
1692
1722
|
isNumericType,
|
|
1693
1723
|
itemTaxConfig,
|