@harbortouch/skytab-analytics-report-utils 0.13.1 → 0.14.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.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,37 @@ 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
+ format
792
+ }) => {
793
+ const formatDate2 = (date) => {
794
+ return [
795
+ date.getFullYear(),
796
+ String(date.getMonth() + 1).padStart(2, "0"),
797
+ String(date.getDate()).padStart(2, "0")
798
+ ].join("-");
799
+ };
800
+ const filename = REPORT_DEFAULT_NAME_MAP[reportType].replace(/\s+/g, "_") ?? "Report";
801
+ return `${filename}_${formatDate2(startDate)}_to_${formatDate2(endDate)}.${format}`.toLocaleLowerCase();
802
+ };
772
803
 
773
804
  // src/columns/index.ts
774
805
  var COLUMN_REGISTRY = {
@@ -1751,6 +1782,7 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
1751
1782
  getDateToFormat,
1752
1783
  getNumberToFormat,
1753
1784
  getReportConfig,
1785
+ getReportExportFileName,
1754
1786
  getReportFormattingLocaleOptions,
1755
1787
  isNumericType,
1756
1788
  itemTaxConfig,
package/dist/index.d.cts CHANGED
@@ -1246,6 +1246,12 @@ 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, format, }: {
1250
+ reportType: ReportType;
1251
+ startDate: Date;
1252
+ endDate: Date;
1253
+ format: "csv" | "xlsx" | "pdf";
1254
+ }) => string;
1249
1255
 
1250
1256
  declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
1251
1257
  declare function isNumericType(type?: FieldType): boolean;
@@ -1428,4 +1434,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
1428
1434
  }[]) => LocaleOption[];
1429
1435
  declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
1430
1436
 
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 };
1437
+ 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,12 @@ 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, format, }: {
1250
+ reportType: ReportType;
1251
+ startDate: Date;
1252
+ endDate: Date;
1253
+ format: "csv" | "xlsx" | "pdf";
1254
+ }) => string;
1249
1255
 
1250
1256
  declare function getColumnAlignment(type?: FieldType): ColumnAlignment;
1251
1257
  declare function isNumericType(type?: FieldType): boolean;
@@ -1428,4 +1434,4 @@ declare const getReportFormattingLocaleOptions: (locations: {
1428
1434
  }[]) => LocaleOption[];
1429
1435
  declare const formatFieldValue: (value: unknown, type: FieldType, localeOptions: LocaleOption, fullRecord: Record<string, unknown> | null | undefined, fieldConfig?: ColumnPresentationConfig) => string;
1430
1436
 
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 };
1437
+ 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,37 @@ 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
+ format
729
+ }) => {
730
+ const formatDate2 = (date) => {
731
+ return [
732
+ date.getFullYear(),
733
+ String(date.getMonth() + 1).padStart(2, "0"),
734
+ String(date.getDate()).padStart(2, "0")
735
+ ].join("-");
736
+ };
737
+ const filename = REPORT_DEFAULT_NAME_MAP[reportType].replace(/\s+/g, "_") ?? "Report";
738
+ return `${filename}_${formatDate2(startDate)}_to_${formatDate2(endDate)}.${format}`.toLocaleLowerCase();
739
+ };
710
740
 
711
741
  // src/columns/index.ts
712
742
  var COLUMN_REGISTRY = {
@@ -1688,6 +1718,7 @@ export {
1688
1718
  getDateToFormat,
1689
1719
  getNumberToFormat,
1690
1720
  getReportConfig,
1721
+ getReportExportFileName,
1691
1722
  getReportFormattingLocaleOptions,
1692
1723
  isNumericType,
1693
1724
  itemTaxConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbortouch/skytab-analytics-report-utils",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
4
4
  "description": "Centralized report column presentation configuration for SkyTab Analytics",
5
5
  "engines": {
6
6
  "node": ">=22.6.0",