@harbortouch/skytab-analytics-report-utils 0.26.0 → 0.27.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/{chunk-SUWIUPHT.js → chunk-OJQZXKA5.js} +8 -4
- package/dist/exporters/exportBuilder.cjs +8 -4
- package/dist/exporters/exportBuilder.d.cts +1 -1
- package/dist/exporters/exportBuilder.d.ts +1 -1
- package/dist/exporters/exportBuilder.js +1 -1
- package/dist/index.cjs +30 -6
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +23 -3
- package/dist/{report-Bx5XpFQ0.d.cts → report-D_tOANVX.d.cts} +1 -1
- package/dist/{report-Bx5XpFQ0.d.ts → report-D_tOANVX.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -765,10 +765,10 @@ var FIELDS13 = {
|
|
|
765
765
|
columnKey: "paymentType",
|
|
766
766
|
footerCalculation: { type: "label", label: "table.total" }
|
|
767
767
|
},
|
|
768
|
-
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
769
|
-
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
770
|
-
tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
771
|
-
totalSales: { type: "money", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
768
|
+
paymentsCount: { type: "number-empty", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
769
|
+
paymentsAmount: { type: "money-empty", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
770
|
+
tipsAmount: { type: "money-empty", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
771
|
+
totalSales: { type: "money-empty", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
772
772
|
};
|
|
773
773
|
var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
|
|
774
774
|
"paymentTypeName",
|
|
@@ -3365,6 +3365,8 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
3365
3365
|
return formatString(value, localeOptions);
|
|
3366
3366
|
case "money":
|
|
3367
3367
|
return formatMoney(getNumberToFormat(value), { currency, locale });
|
|
3368
|
+
case "money-empty":
|
|
3369
|
+
return value != null ? formatMoney(getNumberToFormat(value), { currency, locale }) : "";
|
|
3368
3370
|
case "percent":
|
|
3369
3371
|
return formatPercent(getNumberToFormat(value) * 100);
|
|
3370
3372
|
case "fixedNumber":
|
|
@@ -3377,6 +3379,8 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
3377
3379
|
const d = getDateToFormat(value);
|
|
3378
3380
|
return d ? formatTime(d, { locale, format: "00:00:00" }) : "";
|
|
3379
3381
|
}
|
|
3382
|
+
case "number-empty":
|
|
3383
|
+
return value != null ? String(getNumberToFormat(value)) : "";
|
|
3380
3384
|
case "number":
|
|
3381
3385
|
default:
|
|
3382
3386
|
return String(getNumberToFormat(value));
|
|
@@ -1614,6 +1614,8 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
1614
1614
|
return formatString(value, localeOptions);
|
|
1615
1615
|
case "money":
|
|
1616
1616
|
return formatMoney(getNumberToFormat(value), { currency, locale });
|
|
1617
|
+
case "money-empty":
|
|
1618
|
+
return value != null ? formatMoney(getNumberToFormat(value), { currency, locale }) : "";
|
|
1617
1619
|
case "percent":
|
|
1618
1620
|
return formatPercent(getNumberToFormat(value) * 100);
|
|
1619
1621
|
case "fixedNumber":
|
|
@@ -1626,6 +1628,8 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
1626
1628
|
const d = getDateToFormat(value);
|
|
1627
1629
|
return d ? formatTime(d, { locale, format: "00:00:00" }) : "";
|
|
1628
1630
|
}
|
|
1631
|
+
case "number-empty":
|
|
1632
|
+
return value != null ? String(getNumberToFormat(value)) : "";
|
|
1629
1633
|
case "number":
|
|
1630
1634
|
default:
|
|
1631
1635
|
return String(getNumberToFormat(value));
|
|
@@ -2399,10 +2403,10 @@ var FIELDS13 = {
|
|
|
2399
2403
|
columnKey: "paymentType",
|
|
2400
2404
|
footerCalculation: { type: "label", label: "table.total" }
|
|
2401
2405
|
},
|
|
2402
|
-
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
2403
|
-
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
2404
|
-
tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
2405
|
-
totalSales: { type: "money", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
2406
|
+
paymentsCount: { type: "number-empty", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
2407
|
+
paymentsAmount: { type: "money-empty", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
2408
|
+
tipsAmount: { type: "money-empty", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
2409
|
+
totalSales: { type: "money-empty", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
2406
2410
|
};
|
|
2407
2411
|
var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
|
|
2408
2412
|
"paymentTypeName",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ReportType, A as AnalyticsField } from '../report-
|
|
1
|
+
import { R as ReportType, A as AnalyticsField } from '../report-D_tOANVX.cjs';
|
|
2
2
|
import { E as ExportTable, a as ExportFilter } from '../types-BzLsgnfc.cjs';
|
|
3
3
|
|
|
4
4
|
interface ReportDocumentSection {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ReportType, A as AnalyticsField } from '../report-
|
|
1
|
+
import { R as ReportType, A as AnalyticsField } from '../report-D_tOANVX.js';
|
|
2
2
|
import { E as ExportTable, a as ExportFilter } from '../types-BzLsgnfc.js';
|
|
3
3
|
|
|
4
4
|
interface ReportDocumentSection {
|
package/dist/index.cjs
CHANGED
|
@@ -837,10 +837,10 @@ var FIELDS13 = {
|
|
|
837
837
|
columnKey: "paymentType",
|
|
838
838
|
footerCalculation: { type: "label", label: "table.total" }
|
|
839
839
|
},
|
|
840
|
-
paymentsCount: { type: "number", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
841
|
-
paymentsAmount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
842
|
-
tipsAmount: { type: "money", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
843
|
-
totalSales: { type: "money", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
840
|
+
paymentsCount: { type: "number-empty", columnKey: "paymentsCount", footerCalculation: { type: "sum" } },
|
|
841
|
+
paymentsAmount: { type: "money-empty", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } },
|
|
842
|
+
tipsAmount: { type: "money-empty", columnKey: "tips", footerCalculation: { type: "sum" } },
|
|
843
|
+
totalSales: { type: "money-empty", columnKey: "paymentsTotal", footerCalculation: { type: "sum" } }
|
|
844
844
|
};
|
|
845
845
|
var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
|
|
846
846
|
"paymentTypeName",
|
|
@@ -1783,7 +1783,7 @@ function getColumnAlignment(type) {
|
|
|
1783
1783
|
return "right";
|
|
1784
1784
|
}
|
|
1785
1785
|
function isNumericType(type) {
|
|
1786
|
-
return type === "money" || type === "number" || type === "percent" || type === "fixedNumber";
|
|
1786
|
+
return type === "money" || type === "money-empty" || type === "number" || type === "number-empty" || type === "percent" || type === "fixedNumber";
|
|
1787
1787
|
}
|
|
1788
1788
|
|
|
1789
1789
|
// src/totals.ts
|
|
@@ -1997,7 +1997,27 @@ var buildDailySalesRevClassFooter = (inputs) => {
|
|
|
1997
1997
|
];
|
|
1998
1998
|
};
|
|
1999
1999
|
var buildPaymentsSectionData = (payments) => {
|
|
2000
|
-
|
|
2000
|
+
const filtered = payments.filter((payment) => payment.paymentTypeName !== TENDER_TYPE.HOUSE_ACCOUNT);
|
|
2001
|
+
const seenParentCategories = /* @__PURE__ */ new Set();
|
|
2002
|
+
const result = [];
|
|
2003
|
+
for (const payment of filtered) {
|
|
2004
|
+
if (payment.parentCategory !== null && !seenParentCategories.has(payment.parentCategory)) {
|
|
2005
|
+
seenParentCategories.add(payment.parentCategory);
|
|
2006
|
+
const headerRow = {
|
|
2007
|
+
...payment,
|
|
2008
|
+
paymentTypeName: payment.parentCategory,
|
|
2009
|
+
parentCategory: "",
|
|
2010
|
+
paymentsCount: null,
|
|
2011
|
+
paymentsAmount: null,
|
|
2012
|
+
tipsAmount: null,
|
|
2013
|
+
totalSales: null
|
|
2014
|
+
};
|
|
2015
|
+
result.push(headerRow);
|
|
2016
|
+
}
|
|
2017
|
+
const child = payment.parentCategory !== null ? { ...payment, paymentTypeName: ` ${payment.paymentTypeName}` } : payment;
|
|
2018
|
+
result.push(child);
|
|
2019
|
+
}
|
|
2020
|
+
return result;
|
|
2001
2021
|
};
|
|
2002
2022
|
|
|
2003
2023
|
// src/translations/crowdin/skytab-analytics-report-utils/en-GB.ts
|
|
@@ -3605,6 +3625,8 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
3605
3625
|
return formatString(value, localeOptions);
|
|
3606
3626
|
case "money":
|
|
3607
3627
|
return formatMoney(getNumberToFormat(value), { currency, locale });
|
|
3628
|
+
case "money-empty":
|
|
3629
|
+
return value != null ? formatMoney(getNumberToFormat(value), { currency, locale }) : "";
|
|
3608
3630
|
case "percent":
|
|
3609
3631
|
return formatPercent(getNumberToFormat(value) * 100);
|
|
3610
3632
|
case "fixedNumber":
|
|
@@ -3617,6 +3639,8 @@ var formatFieldValue = (value, type, localeOptions, fullRecord, fieldConfig = DE
|
|
|
3617
3639
|
const d = getDateToFormat(value);
|
|
3618
3640
|
return d ? formatTime(d, { locale, format: "00:00:00" }) : "";
|
|
3619
3641
|
}
|
|
3642
|
+
case "number-empty":
|
|
3643
|
+
return value != null ? String(getNumberToFormat(value)) : "";
|
|
3620
3644
|
case "number":
|
|
3621
3645
|
default:
|
|
3622
3646
|
return String(getNumberToFormat(value));
|
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-
|
|
2
|
-
export { 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 getReportConfig, n as getReportExportFileName } from './report-
|
|
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-D_tOANVX.cjs';
|
|
2
|
+
export { 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 getReportConfig, n as getReportExportFileName } from './report-D_tOANVX.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
|
|
|
@@ -143,6 +143,11 @@ declare const buildDailySalesRevClassFooter: (inputs: {
|
|
|
143
143
|
})[];
|
|
144
144
|
declare const buildPaymentsSectionData: <T extends {
|
|
145
145
|
paymentTypeName: string;
|
|
146
|
+
paymentsCount: number | null;
|
|
147
|
+
paymentsAmount: number | null;
|
|
148
|
+
tipsAmount: number | null;
|
|
149
|
+
totalSales: number | null;
|
|
150
|
+
parentCategory: null | string;
|
|
146
151
|
}>(payments: T[]) => T[];
|
|
147
152
|
|
|
148
153
|
type DailySalesRefundsVoidsField = 'description' | 'count' | 'amount' | 'pctSales';
|
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-
|
|
2
|
-
export { 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 getReportConfig, n as getReportExportFileName } from './report-
|
|
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-D_tOANVX.js';
|
|
2
|
+
export { 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 getReportConfig, n as getReportExportFileName } from './report-D_tOANVX.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
|
|
|
@@ -143,6 +143,11 @@ declare const buildDailySalesRevClassFooter: (inputs: {
|
|
|
143
143
|
})[];
|
|
144
144
|
declare const buildPaymentsSectionData: <T extends {
|
|
145
145
|
paymentTypeName: string;
|
|
146
|
+
paymentsCount: number | null;
|
|
147
|
+
paymentsAmount: number | null;
|
|
148
|
+
tipsAmount: number | null;
|
|
149
|
+
totalSales: number | null;
|
|
150
|
+
parentCategory: null | string;
|
|
146
151
|
}>(payments: T[]) => T[];
|
|
147
152
|
|
|
148
153
|
type DailySalesRefundsVoidsField = 'description' | 'count' | 'amount' | 'pctSales';
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
salesSummaryConfig,
|
|
38
38
|
ticketLiveConfig,
|
|
39
39
|
ticketSummaryConfig
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-OJQZXKA5.js";
|
|
41
41
|
|
|
42
42
|
// src/utils/alignment.ts
|
|
43
43
|
function getColumnAlignment(type) {
|
|
@@ -47,7 +47,7 @@ function getColumnAlignment(type) {
|
|
|
47
47
|
return "right";
|
|
48
48
|
}
|
|
49
49
|
function isNumericType(type) {
|
|
50
|
-
return type === "money" || type === "number" || type === "percent" || type === "fixedNumber";
|
|
50
|
+
return type === "money" || type === "money-empty" || type === "number" || type === "number-empty" || type === "percent" || type === "fixedNumber";
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// src/reports/reportSection.ts
|
|
@@ -204,7 +204,27 @@ var buildDailySalesRevClassFooter = (inputs) => {
|
|
|
204
204
|
];
|
|
205
205
|
};
|
|
206
206
|
var buildPaymentsSectionData = (payments) => {
|
|
207
|
-
|
|
207
|
+
const filtered = payments.filter((payment) => payment.paymentTypeName !== TENDER_TYPE.HOUSE_ACCOUNT);
|
|
208
|
+
const seenParentCategories = /* @__PURE__ */ new Set();
|
|
209
|
+
const result = [];
|
|
210
|
+
for (const payment of filtered) {
|
|
211
|
+
if (payment.parentCategory !== null && !seenParentCategories.has(payment.parentCategory)) {
|
|
212
|
+
seenParentCategories.add(payment.parentCategory);
|
|
213
|
+
const headerRow = {
|
|
214
|
+
...payment,
|
|
215
|
+
paymentTypeName: payment.parentCategory,
|
|
216
|
+
parentCategory: "",
|
|
217
|
+
paymentsCount: null,
|
|
218
|
+
paymentsAmount: null,
|
|
219
|
+
tipsAmount: null,
|
|
220
|
+
totalSales: null
|
|
221
|
+
};
|
|
222
|
+
result.push(headerRow);
|
|
223
|
+
}
|
|
224
|
+
const child = payment.parentCategory !== null ? { ...payment, paymentTypeName: ` ${payment.paymentTypeName}` } : payment;
|
|
225
|
+
result.push(child);
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
208
228
|
};
|
|
209
229
|
export {
|
|
210
230
|
COLUMN_REGISTRY,
|
|
@@ -1217,7 +1217,7 @@ declare const enUS: {
|
|
|
1217
1217
|
};
|
|
1218
1218
|
type MessageKey = keyof typeof enUS;
|
|
1219
1219
|
|
|
1220
|
-
type FieldType = 'string' | 'money' | 'percent' | 'number' | 'fixedNumber' | 'date' | 'time' | 'boolean' | 'conditional';
|
|
1220
|
+
type FieldType = 'string' | 'money' | 'percent' | 'number' | 'fixedNumber' | 'date' | 'time' | 'boolean' | 'number-empty' | 'money-empty' | 'conditional';
|
|
1221
1221
|
type ColumnAlignment = 'left' | 'right';
|
|
1222
1222
|
type FooterCalculationType = 'sum' | 'percentChange' | 'variancePercent' | 'average' | 'quotientOfDifferences' | 'count' | 'label' | 'none';
|
|
1223
1223
|
type FooterCalculation<TField = string> = {
|
|
@@ -1217,7 +1217,7 @@ declare const enUS: {
|
|
|
1217
1217
|
};
|
|
1218
1218
|
type MessageKey = keyof typeof enUS;
|
|
1219
1219
|
|
|
1220
|
-
type FieldType = 'string' | 'money' | 'percent' | 'number' | 'fixedNumber' | 'date' | 'time' | 'boolean' | 'conditional';
|
|
1220
|
+
type FieldType = 'string' | 'money' | 'percent' | 'number' | 'fixedNumber' | 'date' | 'time' | 'boolean' | 'number-empty' | 'money-empty' | 'conditional';
|
|
1221
1221
|
type ColumnAlignment = 'left' | 'right';
|
|
1222
1222
|
type FooterCalculationType = 'sum' | 'percentChange' | 'variancePercent' | 'average' | 'quotientOfDifferences' | 'count' | 'label' | 'none';
|
|
1223
1223
|
type FooterCalculation<TField = string> = {
|