@harbortouch/skytab-analytics-report-utils 0.41.10 → 0.41.11

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.
@@ -2838,6 +2838,7 @@ var dailySalesTrendsOrderTypeConfig = {
2838
2838
  };
2839
2839
 
2840
2840
  // src/report.ts
2841
+ import { isValid, parseISO } from "date-fns";
2841
2842
  var Report = {
2842
2843
  TICKET_LIVE: "ticket-live",
2843
2844
  TICKET_ANALYTICS: "ticket-analytics",
@@ -2911,7 +2912,11 @@ var getReportExportFileName = ({
2911
2912
  endDate,
2912
2913
  format
2913
2914
  }) => {
2914
- const formatDate2 = (date) => {
2915
+ const formatDate2 = (value) => {
2916
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}/.test(value) && isValid(parseISO(value))) {
2917
+ return value.slice(0, 10);
2918
+ }
2919
+ const date = typeof value === "string" ? new Date(value) : value;
2915
2920
  return [
2916
2921
  date.getFullYear(),
2917
2922
  String(date.getMonth() + 1).padStart(2, "0"),
@@ -1861,6 +1861,9 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
1861
1861
  }
1862
1862
  };
1863
1863
 
1864
+ // src/report.ts
1865
+ var import_date_fns = require("date-fns");
1866
+
1864
1867
  // src/reports/salesByItemDetail.ts
1865
1868
  var FIELDS = {
1866
1869
  businessDate: { type: "date", columnKey: "date", filteringAvailable: false },
@@ -4021,7 +4024,7 @@ function resolveRawFiltersToExportFilters(rawFilters, locale, reportType) {
4021
4024
  }
4022
4025
 
4023
4026
  // src/exporters/exportBuilder.ts
4024
- var import_date_fns = require("date-fns");
4027
+ var import_date_fns2 = require("date-fns");
4025
4028
  var ExportBuilder = class {
4026
4029
  constructor(reportType, locations, locale) {
4027
4030
  this.reportType = reportType;
@@ -4163,11 +4166,14 @@ var ExportBuilder = class {
4163
4166
  return config.dataAccessKey ? data[config.dataAccessKey] ?? [] : [];
4164
4167
  }
4165
4168
  formatMaybeDate(value) {
4166
- const date = typeof value === "string" ? (0, import_date_fns.parseISO)(value) : value;
4167
- if (!(0, import_date_fns.isValid)(date)) {
4169
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}/.test(value) && (0, import_date_fns2.isValid)((0, import_date_fns2.parseISO)(value))) {
4170
+ return value.slice(0, 10);
4171
+ }
4172
+ const date = typeof value === "string" ? (0, import_date_fns2.parseISO)(value) : value;
4173
+ if (!(0, import_date_fns2.isValid)(date)) {
4168
4174
  return "";
4169
4175
  }
4170
- return (0, import_date_fns.format)(date, "yyyy-MM-dd");
4176
+ return (0, import_date_fns2.format)(date, "yyyy-MM-dd");
4171
4177
  }
4172
4178
  buildReportMetadataFilters(parameters, name, meta) {
4173
4179
  const locationNames = this.locations.map((l) => l.name).join(", ");
@@ -4208,6 +4214,7 @@ var ExportBuilder = class {
4208
4214
  day: "numeric",
4209
4215
  hour: "numeric",
4210
4216
  minute: "2-digit",
4217
+ timeZone: this.locations[0]?.timezone ?? "UTC",
4211
4218
  timeZoneName: "short"
4212
4219
  }).format(meta.generatedAt);
4213
4220
  filters.push({ label: this.translate("scheduled-reports.generated-at"), value: formatted });
@@ -1,4 +1,4 @@
1
- import { R as ReportType, A as AnalyticsField } from '../report-LuHGzrLx.cjs';
1
+ import { R as ReportType, A as AnalyticsField } from '../report-Dj8UU5d_.cjs';
2
2
  import { E as ExportFilter, R as ReportMetadata, a as ExportSection } from '../types-JAEAu4KX.cjs';
3
3
 
4
4
  declare function resolveRawFiltersToExportFilters(rawFilters: Record<string, (string | number)[] | undefined>, locale: string, reportType?: ReportType): ExportFilter[];
@@ -1,4 +1,4 @@
1
- import { R as ReportType, A as AnalyticsField } from '../report-LuHGzrLx.js';
1
+ import { R as ReportType, A as AnalyticsField } from '../report-Dj8UU5d_.js';
2
2
  import { E as ExportFilter, R as ReportMetadata, a as ExportSection } from '../types-JAEAu4KX.js';
3
3
 
4
4
  declare function resolveRawFiltersToExportFilters(rawFilters: Record<string, (string | number)[] | undefined>, locale: string, reportType?: ReportType): ExportFilter[];
@@ -8,7 +8,7 @@ import {
8
8
  getReportFormattingLocaleOptions,
9
9
  getReportName,
10
10
  resolveTranslate
11
- } from "../chunk-ENBT7KRJ.js";
11
+ } from "../chunk-UUKHJDV3.js";
12
12
 
13
13
  // src/utils/filter-resolver.ts
14
14
  var ANALYTICS_FIELDS = /* @__PURE__ */ new Set([
@@ -217,6 +217,9 @@ var ExportBuilder = class {
217
217
  return config.dataAccessKey ? data[config.dataAccessKey] ?? [] : [];
218
218
  }
219
219
  formatMaybeDate(value) {
220
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}/.test(value) && isValid(parseISO(value))) {
221
+ return value.slice(0, 10);
222
+ }
220
223
  const date = typeof value === "string" ? parseISO(value) : value;
221
224
  if (!isValid(date)) {
222
225
  return "";
@@ -262,6 +265,7 @@ var ExportBuilder = class {
262
265
  day: "numeric",
263
266
  hour: "numeric",
264
267
  minute: "2-digit",
268
+ timeZone: this.locations[0]?.timezone ?? "UTC",
265
269
  timeZoneName: "short"
266
270
  }).format(meta.generatedAt);
267
271
  filters.push({ label: this.translate("scheduled-reports.generated-at"), value: formatted });
package/dist/index.cjs CHANGED
@@ -73,6 +73,9 @@ __export(index_exports, {
73
73
  });
74
74
  module.exports = __toCommonJS(index_exports);
75
75
 
76
+ // src/report.ts
77
+ var import_date_fns = require("date-fns");
78
+
76
79
  // src/reports/salesByItemDetail.ts
77
80
  var FIELDS = {
78
81
  businessDate: { type: "date", columnKey: "date", filteringAvailable: false },
@@ -2985,7 +2988,11 @@ var getReportExportFileName = ({
2985
2988
  endDate,
2986
2989
  format
2987
2990
  }) => {
2988
- const formatDate2 = (date) => {
2991
+ const formatDate2 = (value) => {
2992
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}/.test(value) && (0, import_date_fns.isValid)((0, import_date_fns.parseISO)(value))) {
2993
+ return value.slice(0, 10);
2994
+ }
2995
+ const date = typeof value === "string" ? new Date(value) : value;
2989
2996
  return [
2990
2997
  date.getFullYear(),
2991
2998
  String(date.getMonth() + 1).padStart(2, "0"),
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MessageKey, F as FieldType, C as ColumnAlignment, a as ColumnPresentationConfig, b as ColumnGroupConfig, R as ReportType, c as ReportConfig, d as ReportColumnKey } from './report-LuHGzrLx.cjs';
2
- export { A as AnalyticsField, e as COLUMN_REGISTRY, f as ColumnMessageKey, g as ColumnMetadata, h as FooterCalculation, i as FooterCalculationType, j as Report, k as getColumnExportHeaderLabel, l as getColumnMetadata, m as getFixedColumns, n as getReportConfig, o as getReportExportFileName } from './report-LuHGzrLx.cjs';
1
+ import { M as MessageKey, F as FieldType, C as ColumnAlignment, a as ColumnPresentationConfig, b as ColumnGroupConfig, R as ReportType, c as ReportConfig, d as ReportColumnKey } from './report-Dj8UU5d_.cjs';
2
+ export { A as AnalyticsField, e as COLUMN_REGISTRY, f as ColumnMessageKey, g as ColumnMetadata, h as FooterCalculation, i as FooterCalculationType, j as Report, k as getColumnExportHeaderLabel, l as getColumnMetadata, m as getFixedColumns, n as getReportConfig, o as getReportExportFileName } from './report-Dj8UU5d_.cjs';
3
3
  import { LocaleCode } from '@harbortouch/locale-registry';
4
4
  export { R as RenderedReport, a as ReportDocument, b as ReportFormat, c as ReportSection, d as ResolvedColumn, S as SummaryRow } from './ir-CUi0Z9hv.cjs';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MessageKey, F as FieldType, C as ColumnAlignment, a as ColumnPresentationConfig, b as ColumnGroupConfig, R as ReportType, c as ReportConfig, d as ReportColumnKey } from './report-LuHGzrLx.js';
2
- export { A as AnalyticsField, e as COLUMN_REGISTRY, f as ColumnMessageKey, g as ColumnMetadata, h as FooterCalculation, i as FooterCalculationType, j as Report, k as getColumnExportHeaderLabel, l as getColumnMetadata, m as getFixedColumns, n as getReportConfig, o as getReportExportFileName } from './report-LuHGzrLx.js';
1
+ import { M as MessageKey, F as FieldType, C as ColumnAlignment, a as ColumnPresentationConfig, b as ColumnGroupConfig, R as ReportType, c as ReportConfig, d as ReportColumnKey } from './report-Dj8UU5d_.js';
2
+ export { A as AnalyticsField, e as COLUMN_REGISTRY, f as ColumnMessageKey, g as ColumnMetadata, h as FooterCalculation, i as FooterCalculationType, j as Report, k as getColumnExportHeaderLabel, l as getColumnMetadata, m as getFixedColumns, n as getReportConfig, o as getReportExportFileName } from './report-Dj8UU5d_.js';
3
3
  import { LocaleCode } from '@harbortouch/locale-registry';
4
4
  export { R as RenderedReport, a as ReportDocument, b as ReportFormat, c as ReportSection, d as ResolvedColumn, S as SummaryRow } from './ir-CUi0Z9hv.js';
5
5
 
package/dist/index.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  ticketLiveConfig,
41
41
  ticketSummaryConfig,
42
42
  tipCashoutReconciliationConfig
43
- } from "./chunk-ENBT7KRJ.js";
43
+ } from "./chunk-UUKHJDV3.js";
44
44
 
45
45
  // src/utils/alignment.ts
46
46
  function getColumnAlignment(type) {
@@ -1477,8 +1477,8 @@ declare const getFixedColumns: <TField extends string = string>(config: ReportCo
1477
1477
  }) => TField[];
1478
1478
  declare const getReportExportFileName: ({ reportType, startDate, endDate, format, }: {
1479
1479
  reportType: ReportType;
1480
- startDate: Date;
1481
- endDate: Date;
1480
+ startDate: string | Date;
1481
+ endDate: string | Date;
1482
1482
  format: "csv" | "xlsx" | "pdf";
1483
1483
  }) => string;
1484
1484
 
@@ -1477,8 +1477,8 @@ declare const getFixedColumns: <TField extends string = string>(config: ReportCo
1477
1477
  }) => TField[];
1478
1478
  declare const getReportExportFileName: ({ reportType, startDate, endDate, format, }: {
1479
1479
  reportType: ReportType;
1480
- startDate: Date;
1481
- endDate: Date;
1480
+ startDate: string | Date;
1481
+ endDate: string | Date;
1482
1482
  format: "csv" | "xlsx" | "pdf";
1483
1483
  }) => string;
1484
1484
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbortouch/skytab-analytics-report-utils",
3
- "version": "0.41.10",
3
+ "version": "0.41.11",
4
4
  "description": "Centralized report column presentation configuration for SkyTab Analytics",
5
5
  "engines": {
6
6
  "node": ">=22.6.0",