@harbortouch/skytab-analytics-report-utils 0.27.0 → 0.29.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.
@@ -62,6 +62,9 @@ var enUS = {
62
62
  "common.report-col.batch-number": "Batch Number",
63
63
  "common.report-col.batch-number.short": "Batch No",
64
64
  "common.report-col.batch-number.info": "The system-generated number used to track this batch of transactions",
65
+ "common.report-col.cash-collected": "Cash Collected",
66
+ "common.report-col.cash-collected.short": "Cash Collected",
67
+ "common.report-col.cash-collected.info": "Total cash collected by the employee",
65
68
  "common.report-col.clock-in-time": "Clock-In Time",
66
69
  "common.report-col.clock-in-time.short": "In Time",
67
70
  "common.report-col.clock-in-time.info": "Actual time the employee clocked in",
@@ -371,6 +374,9 @@ var enUS = {
371
374
  "common.report-col.tip-share": "Tip Share",
372
375
  "common.report-col.tip-share.short": "Tip Share",
373
376
  "common.report-col.tip-share.info": "Tips distributed to other employees",
377
+ "common.report-col.tip-share-contributed": "Tip Share Contributed",
378
+ "common.report-col.tip-share-contributed.short": "Tip Share Contrib",
379
+ "common.report-col.tip-share-contributed.info": "Tips contributed by this employee to the tip share pool",
374
380
  "common.report-col.tips": "Tips",
375
381
  "common.report-col.tips.short": "Tips",
376
382
  "common.report-col.tips.info": "Total tips received for the ticket",
@@ -461,11 +467,11 @@ var enUS = {
461
467
  "common.report-col.type": "Type",
462
468
  "common.report-col.type.short": "Type",
463
469
  "common.report-col.type.info": " ",
464
- "common.report-section.revenue-class": "Revenue Class",
470
+ "common.report-section.revenue-class": "Sales by Revenue Class",
465
471
  "common.report-section.payments": "Payments",
466
472
  "common.report-section.cash": "Expected Closeout Cash",
467
473
  "common.report-section.taxes": "Taxes",
468
- "common.report-section.refunds-voids": "Refunds & Voids",
474
+ "common.report-section.refunds-voids": "Refunds/Voids",
469
475
  "common.report-section.discounts": "Discounts",
470
476
  "common.report-section.sales-by-day-part": "Sales by Day Part",
471
477
  "common.report-section.sales-by-order-type": "Sales by Order Type",
@@ -549,6 +555,9 @@ var enUS2 = {
549
555
  "common.report-col.batch-number": false,
550
556
  "common.report-col.batch-number.short": false,
551
557
  "common.report-col.batch-number.info": false,
558
+ "common.report-col.cash-collected": false,
559
+ "common.report-col.cash-collected.short": false,
560
+ "common.report-col.cash-collected.info": false,
552
561
  "common.report-col.clock-in-time": false,
553
562
  "common.report-col.clock-in-time.short": false,
554
563
  "common.report-col.clock-in-time.info": false,
@@ -858,6 +867,9 @@ var enUS2 = {
858
867
  "common.report-col.tip-share": false,
859
868
  "common.report-col.tip-share.short": false,
860
869
  "common.report-col.tip-share.info": false,
870
+ "common.report-col.tip-share-contributed": false,
871
+ "common.report-col.tip-share-contributed.short": false,
872
+ "common.report-col.tip-share-contributed.info": false,
861
873
  "common.report-col.tips": false,
862
874
  "common.report-col.tips.short": false,
863
875
  "common.report-col.tips.info": false,
@@ -1036,6 +1048,9 @@ var enUS3 = {
1036
1048
  "common.report-col.batch-number": false,
1037
1049
  "common.report-col.batch-number.short": false,
1038
1050
  "common.report-col.batch-number.info": false,
1051
+ "common.report-col.cash-collected": false,
1052
+ "common.report-col.cash-collected.short": false,
1053
+ "common.report-col.cash-collected.info": false,
1039
1054
  "common.report-col.clock-in-time": false,
1040
1055
  "common.report-col.clock-in-time.short": false,
1041
1056
  "common.report-col.clock-in-time.info": false,
@@ -1345,6 +1360,9 @@ var enUS3 = {
1345
1360
  "common.report-col.tip-share": false,
1346
1361
  "common.report-col.tip-share.short": false,
1347
1362
  "common.report-col.tip-share.info": false,
1363
+ "common.report-col.tip-share-contributed": false,
1364
+ "common.report-col.tip-share-contributed.short": false,
1365
+ "common.report-col.tip-share-contributed.info": false,
1348
1366
  "common.report-col.tips": false,
1349
1367
  "common.report-col.tips.short": false,
1350
1368
  "common.report-col.tips.info": false,
@@ -2319,10 +2337,56 @@ var employeeTipConfig = {
2319
2337
  hasFooter: true
2320
2338
  };
2321
2339
 
2322
- // src/reports/dailySales/dailySales.ts
2340
+ // src/reports/tipCashoutReconciliation.ts
2323
2341
  var FIELDS10 = {
2324
2342
  groupById: { type: "string" },
2325
- groupByName: { type: "string", size: FIRST_COLUMN_WIDTH, footerCalculation: { type: "label", label: "table.total" } },
2343
+ groupByName: {
2344
+ type: "string",
2345
+ size: FIRST_COLUMN_WIDTH,
2346
+ footerCalculation: { type: "label", label: "table.total" }
2347
+ },
2348
+ locationName: { type: "string", size: 220, columnKey: "locationName" },
2349
+ employeeName: { type: "string", size: 220, columnKey: "employeeName" },
2350
+ empId: { type: "string", size: 160, columnKey: "employeeId" },
2351
+ payrollId: { type: "string", size: 160, columnKey: "payrollId" },
2352
+ netSales: { type: "money", columnKey: "netSales", footerCalculation: { type: "sum" } },
2353
+ cashCollected: { type: "money", columnKey: "cashCollected", footerCalculation: { type: "sum" } },
2354
+ grossTips: { type: "money", columnKey: "grossTips", footerCalculation: { type: "sum" } },
2355
+ autoGratuity: { type: "money", columnKey: "autoGratuity", footerCalculation: { type: "sum" } },
2356
+ tipReduction: { type: "money", columnKey: "tipReduction", footerCalculation: { type: "sum" } },
2357
+ tipShareContributed: { type: "money", columnKey: "tipShareContributed", footerCalculation: { type: "sum" } },
2358
+ declaredTips: { type: "money", columnKey: "declaredTips", footerCalculation: { type: "sum" } }
2359
+ };
2360
+ var VISIBLE_COLUMNS2 = [
2361
+ "groupByName",
2362
+ "locationName",
2363
+ "employeeName",
2364
+ "payrollId",
2365
+ "netSales",
2366
+ "cashCollected",
2367
+ "grossTips",
2368
+ "autoGratuity",
2369
+ "tipReduction",
2370
+ "tipShareContributed",
2371
+ "declaredTips"
2372
+ ];
2373
+ var AVAILABLE_COLUMNS2 = ["groupById", "empId", ...VISIBLE_COLUMNS2];
2374
+ var tipCashoutReconciliationConfig = {
2375
+ fields: FIELDS10,
2376
+ availableColumns: AVAILABLE_COLUMNS2,
2377
+ defaultVisibleColumns: VISIBLE_COLUMNS2,
2378
+ hasFooter: true
2379
+ };
2380
+
2381
+ // src/reports/dailySales/dailySales.ts
2382
+ var FIELDS11 = {
2383
+ groupById: { type: "string" },
2384
+ groupByName: {
2385
+ type: "string",
2386
+ size: FIRST_COLUMN_WIDTH,
2387
+ columnKey: "revenueClass",
2388
+ footerCalculation: { type: "label", label: "table.total" }
2389
+ },
2326
2390
  itemsQuantity: { type: "number", columnKey: "quantity" },
2327
2391
  salesAmountGross: { type: "money", columnKey: "grossSales" },
2328
2392
  discountsAmount: { type: "money", columnKey: "discountAmount" },
@@ -2340,7 +2404,7 @@ var DAILY_SALES_AVAILABLE_COLUMNS = [
2340
2404
  "salesMixPct"
2341
2405
  ];
2342
2406
  var dailySalesConfig = {
2343
- fields: FIELDS10,
2407
+ fields: FIELDS11,
2344
2408
  availableColumns: DAILY_SALES_AVAILABLE_COLUMNS,
2345
2409
  defaultVisibleColumns: DAILY_SALES_AVAILABLE_COLUMNS,
2346
2410
  hasFooter: true,
@@ -2350,7 +2414,7 @@ var dailySalesConfig = {
2350
2414
  };
2351
2415
 
2352
2416
  // src/reports/dailySales/dailySalesCache.ts
2353
- var FIELDS11 = {
2417
+ var FIELDS12 = {
2354
2418
  name: {
2355
2419
  type: "string",
2356
2420
  columnKey: "type",
@@ -2360,7 +2424,7 @@ var FIELDS11 = {
2360
2424
  amount: { type: "money", columnKey: "paymentsAmount", footerCalculation: { type: "sum" } }
2361
2425
  };
2362
2426
  var dailySalesCacheConfig = {
2363
- fields: FIELDS11,
2427
+ fields: FIELDS12,
2364
2428
  availableColumns: ["name", "amount"],
2365
2429
  defaultVisibleColumns: ["name", "amount"],
2366
2430
  hasFooter: true,
@@ -2369,7 +2433,7 @@ var dailySalesCacheConfig = {
2369
2433
  };
2370
2434
 
2371
2435
  // src/reports/dailySales/dailySalesDiscounts.ts
2372
- var FIELDS12 = {
2436
+ var FIELDS13 = {
2373
2437
  discountName: {
2374
2438
  type: "string",
2375
2439
  columnKey: "discountName",
@@ -2387,7 +2451,7 @@ var DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS = [
2387
2451
  "discountsAmount"
2388
2452
  ];
2389
2453
  var dailySalesDiscountsConfig = {
2390
- fields: FIELDS12,
2454
+ fields: FIELDS13,
2391
2455
  availableColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
2392
2456
  defaultVisibleColumns: DAILY_SALES_DISCOUNTS_AVAILABLE_COLUMNS,
2393
2457
  hasFooter: true,
@@ -2396,7 +2460,7 @@ var dailySalesDiscountsConfig = {
2396
2460
  };
2397
2461
 
2398
2462
  // src/reports/dailySales/dailySalesPayments.ts
2399
- var FIELDS13 = {
2463
+ var FIELDS14 = {
2400
2464
  paymentTypeName: {
2401
2465
  type: "string",
2402
2466
  size: FIRST_COLUMN_WIDTH,
@@ -2416,7 +2480,7 @@ var DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS = [
2416
2480
  "totalSales"
2417
2481
  ];
2418
2482
  var dailySalesPaymentsConfig = {
2419
- fields: FIELDS13,
2483
+ fields: FIELDS14,
2420
2484
  availableColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
2421
2485
  defaultVisibleColumns: DAILY_SALES_PAYMENTS_AVAILABLE_COLUMNS,
2422
2486
  hasFooter: true,
@@ -2425,7 +2489,7 @@ var dailySalesPaymentsConfig = {
2425
2489
  };
2426
2490
 
2427
2491
  // src/reports/dailySales/dailySalesRefundsVoids.ts
2428
- var FIELDS14 = {
2492
+ var FIELDS15 = {
2429
2493
  description: {
2430
2494
  type: "string",
2431
2495
  columnKey: "refundVoidDescription",
@@ -2443,7 +2507,7 @@ var DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS = [
2443
2507
  "pctSales"
2444
2508
  ];
2445
2509
  var dailySalesRefundsVoidsConfig = {
2446
- fields: FIELDS14,
2510
+ fields: FIELDS15,
2447
2511
  availableColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
2448
2512
  defaultVisibleColumns: DAILY_SALES_REFUNDS_VOIDS_AVAILABLE_COLUMNS,
2449
2513
  hasFooter: true,
@@ -2452,7 +2516,7 @@ var dailySalesRefundsVoidsConfig = {
2452
2516
  };
2453
2517
 
2454
2518
  // src/reports/dailySales/dailySalesTaxes.ts
2455
- var FIELDS15 = {
2519
+ var FIELDS16 = {
2456
2520
  taxName: {
2457
2521
  type: "string",
2458
2522
  columnKey: "taxName",
@@ -2470,7 +2534,7 @@ var DAILY_SALES_TAXES_AVAILABLE_COLUMNS = [
2470
2534
  "exemptSales"
2471
2535
  ];
2472
2536
  var dailySalesTaxesConfig = {
2473
- fields: FIELDS15,
2537
+ fields: FIELDS16,
2474
2538
  availableColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
2475
2539
  defaultVisibleColumns: DAILY_SALES_TAXES_AVAILABLE_COLUMNS,
2476
2540
  hasFooter: true,
@@ -2478,11 +2542,12 @@ var dailySalesTaxesConfig = {
2478
2542
  sectionName: "common.report-section.taxes"
2479
2543
  };
2480
2544
 
2481
- // src/reports/dailySales/dailySalesTrends.ts
2482
- var FIELDS16 = {
2545
+ // src/reports/dailySales/dailySalesTrendsDayPart.ts
2546
+ var FIELDS17 = {
2483
2547
  groupById: { type: "string" },
2484
2548
  groupByName: {
2485
2549
  type: "string",
2550
+ columnKey: "daypart",
2486
2551
  size: FIRST_COLUMN_WIDTH,
2487
2552
  footerCalculation: { type: "label", label: "common.report-section.trends-footer.total-sales" }
2488
2553
  },
@@ -2516,8 +2581,8 @@ var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS = [
2516
2581
  "guestAvg",
2517
2582
  "salesAmountNet"
2518
2583
  ];
2519
- var dailySalesTrendsConfig = {
2520
- fields: FIELDS16,
2584
+ var dailySalesTrendsDayPartConfig = {
2585
+ fields: FIELDS17,
2521
2586
  availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
2522
2587
  defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
2523
2588
  hasFooter: true,
@@ -2525,10 +2590,50 @@ var dailySalesTrendsConfig = {
2525
2590
  sectionName: "common.report-section.sales-by-day-part",
2526
2591
  extraFooterFields: ["salesAmountNet"]
2527
2592
  };
2593
+
2594
+ // src/reports/dailySales/dailySalesTrendsOrderType.ts
2595
+ var FIELDS18 = {
2596
+ groupById: { type: "string" },
2597
+ groupByName: {
2598
+ columnKey: "orderType",
2599
+ type: "string",
2600
+ size: FIRST_COLUMN_WIDTH,
2601
+ footerCalculation: { type: "label", label: "common.report-section.trends-footer.total-sales" }
2602
+ },
2603
+ salesAmountNet: { type: "money", columnKey: "netSales" },
2604
+ ticketsCount: { type: "number", columnKey: "tickets" },
2605
+ guestsCount: { type: "number", columnKey: "guests" },
2606
+ ticketAvg: {
2607
+ type: "money",
2608
+ columnKey: "ticketAverage",
2609
+ footerCalculation: {
2610
+ type: "average",
2611
+ numeratorField: "salesAmountNet",
2612
+ denominatorField: "ticketsCount"
2613
+ }
2614
+ },
2615
+ guestAvg: {
2616
+ type: "money",
2617
+ columnKey: "guestAverage",
2618
+ footerCalculation: {
2619
+ type: "average",
2620
+ numeratorField: "salesAmountNet",
2621
+ denominatorField: "guestsCount"
2622
+ }
2623
+ }
2624
+ };
2625
+ var DAILY_SALES_TRENDS_AVAILABLE_COLUMNS2 = [
2626
+ "groupByName",
2627
+ "ticketsCount",
2628
+ "guestsCount",
2629
+ "ticketAvg",
2630
+ "guestAvg",
2631
+ "salesAmountNet"
2632
+ ];
2528
2633
  var dailySalesTrendsOrderTypeConfig = {
2529
- fields: FIELDS16,
2530
- availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
2531
- defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS,
2634
+ fields: FIELDS18,
2635
+ availableColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS2,
2636
+ defaultVisibleColumns: DAILY_SALES_TRENDS_AVAILABLE_COLUMNS2,
2532
2637
  hasFooter: true,
2533
2638
  dataAccessKey: "trendsByOrderType",
2534
2639
  sectionName: "common.report-section.sales-by-order-type",
@@ -2543,7 +2648,7 @@ var DAILY_SALES_SECTION_CONFIGS = [
2543
2648
  dailySalesTaxesConfig,
2544
2649
  dailySalesRefundsVoidsConfig,
2545
2650
  dailySalesDiscountsConfig,
2546
- dailySalesTrendsConfig,
2651
+ dailySalesTrendsDayPartConfig,
2547
2652
  dailySalesTrendsOrderTypeConfig
2548
2653
  ];
2549
2654
  var REPORT_CONFIG_MAP = {
@@ -2555,6 +2660,7 @@ var REPORT_CONFIG_MAP = {
2555
2660
  "item-tax": itemTaxConfig,
2556
2661
  "employee-timecard": employeeTimecardConfig,
2557
2662
  "employee-tip": employeeTipConfig,
2663
+ "tip-cashout-reconciliation": tipCashoutReconciliationConfig,
2558
2664
  "sales-by-item": salesByItemDetailConfig,
2559
2665
  "daily-sales": DAILY_SALES_SECTION_CONFIGS,
2560
2666
  "daily-sales-live": DAILY_SALES_SECTION_CONFIGS
@@ -2623,6 +2729,11 @@ var COLUMN_REGISTRY = {
2623
2729
  shortTitleKey: "common.report-col.batch-number.short",
2624
2730
  infoTextKey: "common.report-col.batch-number.info"
2625
2731
  },
2732
+ cashCollected: {
2733
+ titleKey: "common.report-col.cash-collected",
2734
+ shortTitleKey: "common.report-col.cash-collected.short",
2735
+ infoTextKey: "common.report-col.cash-collected.info"
2736
+ },
2626
2737
  clockInTime: {
2627
2738
  titleKey: "common.report-col.clock-in-time",
2628
2739
  shortTitleKey: "common.report-col.clock-in-time.short",
@@ -3103,6 +3214,11 @@ var COLUMN_REGISTRY = {
3103
3214
  shortTitleKey: "common.report-col.tip-share.short",
3104
3215
  infoTextKey: "common.report-col.tip-share.info"
3105
3216
  },
3217
+ tipShareContributed: {
3218
+ titleKey: "common.report-col.tip-share-contributed",
3219
+ shortTitleKey: "common.report-col.tip-share-contributed.short",
3220
+ infoTextKey: "common.report-col.tip-share-contributed.info"
3221
+ },
3106
3222
  tips: {
3107
3223
  titleKey: "common.report-col.tips",
3108
3224
  shortTitleKey: "common.report-col.tips.short",
@@ -3544,7 +3660,7 @@ var ExportBuilder = class {
3544
3660
  const sectionParameters = { ...parameters, cols: void 0 };
3545
3661
  sections = rawConfig.map((config) => {
3546
3662
  return {
3547
- sheetName: this.getConfigSectionName(config),
3663
+ title: this.getConfigSectionName(config),
3548
3664
  ...this.renderTableContent(config, reportData, sectionParameters)
3549
3665
  };
3550
3666
  });
@@ -3552,7 +3668,7 @@ var ExportBuilder = class {
3552
3668
  const metadata = this.buildMetadata(parameters);
3553
3669
  sections = [
3554
3670
  {
3555
- sheetName: name,
3671
+ title: name,
3556
3672
  filters: metadata.map(([label, value]) => ({ label, value })),
3557
3673
  ...this.renderTableContent(rawConfig, reportData, parameters)
3558
3674
  }
@@ -1,11 +1,7 @@
1
- import { R as ReportType, A as AnalyticsField } from '../report-D_tOANVX.cjs';
2
- import { E as ExportTable, a as ExportFilter } from '../types-BzLsgnfc.cjs';
1
+ import { R as ReportType, A as AnalyticsField } from '../report-BOV9OtaL.cjs';
2
+ import { E as ExportSection } from '../types-BPT5hjCR.cjs';
3
3
 
4
- interface ReportDocumentSection {
5
- sheetName: string;
6
- table?: ExportTable;
7
- filters?: ExportFilter[];
8
- }
4
+ type ReportDocumentSection = ExportSection;
9
5
  interface ReportLocation {
10
6
  id: number;
11
7
  name: string;
@@ -49,7 +45,7 @@ declare class ExportBuilder {
49
45
  private getDataForConfig;
50
46
  private formatMaybeDate;
51
47
  private buildMetadata;
52
- getContent(reportData: ReportData, parameters: ReportParameters, name: string): ReportDocumentSection[];
48
+ getContent(reportData: ReportData, parameters: ReportParameters, name: string): ExportSection[];
53
49
  }
54
50
 
55
51
  export { ExportBuilder, type ReportData, type ReportDocumentSection, type ReportLocation, type ReportParameters, type SingleReportData };
@@ -1,11 +1,7 @@
1
- import { R as ReportType, A as AnalyticsField } from '../report-D_tOANVX.js';
2
- import { E as ExportTable, a as ExportFilter } from '../types-BzLsgnfc.js';
1
+ import { R as ReportType, A as AnalyticsField } from '../report-BOV9OtaL.js';
2
+ import { E as ExportSection } from '../types-BPT5hjCR.js';
3
3
 
4
- interface ReportDocumentSection {
5
- sheetName: string;
6
- table?: ExportTable;
7
- filters?: ExportFilter[];
8
- }
4
+ type ReportDocumentSection = ExportSection;
9
5
  interface ReportLocation {
10
6
  id: number;
11
7
  name: string;
@@ -49,7 +45,7 @@ declare class ExportBuilder {
49
45
  private getDataForConfig;
50
46
  private formatMaybeDate;
51
47
  private buildMetadata;
52
- getContent(reportData: ReportData, parameters: ReportParameters, name: string): ReportDocumentSection[];
48
+ getContent(reportData: ReportData, parameters: ReportParameters, name: string): ExportSection[];
53
49
  }
54
50
 
55
51
  export { ExportBuilder, type ReportData, type ReportDocumentSection, type ReportLocation, type ReportParameters, type SingleReportData };
@@ -6,7 +6,7 @@ import {
6
6
  getReportConfig,
7
7
  getReportFormattingLocaleOptions,
8
8
  resolveTranslate
9
- } from "../chunk-OJQZXKA5.js";
9
+ } from "../chunk-GZPEIIJK.js";
10
10
 
11
11
  // src/exporters/exportBuilder.ts
12
12
  import { format, isValid, parseISO } from "date-fns";
@@ -196,7 +196,7 @@ var ExportBuilder = class {
196
196
  const sectionParameters = { ...parameters, cols: void 0 };
197
197
  sections = rawConfig.map((config) => {
198
198
  return {
199
- sheetName: this.getConfigSectionName(config),
199
+ title: this.getConfigSectionName(config),
200
200
  ...this.renderTableContent(config, reportData, sectionParameters)
201
201
  };
202
202
  });
@@ -204,7 +204,7 @@ var ExportBuilder = class {
204
204
  const metadata = this.buildMetadata(parameters);
205
205
  sections = [
206
206
  {
207
- sheetName: name,
207
+ title: name,
208
208
  filters: metadata.map(([label, value]) => ({ label, value })),
209
209
  ...this.renderTableContent(rawConfig, reportData, parameters)
210
210
  }
@@ -36,14 +36,15 @@ module.exports = __toCommonJS(pdf_exports);
36
36
  var import_pdfkit = __toESM(require("pdfkit"), 1);
37
37
 
38
38
  // src/exporters/pdf/pdf.utils.ts
39
- var stripEmojis = (text) => {
40
- if (!text) {
41
- return text;
39
+ var sanitizePdfText = (text) => {
40
+ if (!text?.trim()) {
41
+ return "";
42
42
  }
43
- return text.replace(
43
+ const leadingSpaces = /^ */.exec(text)?.[0] ?? "";
44
+ return leadingSpaces + text.trimStart().replace(/€/g, "EUR ").replace(
44
45
  /[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]|[\u{1F900}-\u{1F9FF}]|[\u{1FA00}-\u{1FA6F}]|[\u{1FA70}-\u{1FAFF}]|[\u{FE00}-\u{FE0F}]|[\u{1F004}]|[\u{1F0CF}]|[\u{1F18E}]|[\u{1F191}-\u{1F19A}]|[\u{1F1E6}-\u{1F1FF}]|[\u{1F201}-\u{1F251}]/gu,
45
46
  ""
46
- ).replace(/\s+/g, " ").trim();
47
+ ).replace(/[\x00-\x1F\x7F]/g, " ").replace(/[^ -ÿ]/g, "").replace(/\s+/g, " ").trim();
47
48
  };
48
49
 
49
50
  // src/exporters/pdf/index.ts
@@ -67,6 +68,9 @@ var PdfExporter = class {
67
68
  doc.addPage();
68
69
  }
69
70
  let currentY = doc.y;
71
+ if (sanitizedSections.title) {
72
+ currentY = this.drawSectionTitle(doc, sanitizedSections.title);
73
+ }
70
74
  if (sanitizedSections.filters && sanitizedSections.filters.length > 0) {
71
75
  currentY = this.drawFilters(doc, sanitizedSections.filters);
72
76
  }
@@ -81,23 +85,23 @@ var PdfExporter = class {
81
85
  });
82
86
  }
83
87
  sanitizeSections(sections) {
84
- const sanitized = {};
88
+ const sanitized = { title: sanitizePdfText(sections.title) };
85
89
  if (sections.filters) {
86
90
  sanitized.filters = sections.filters.map((filter) => ({
87
- label: stripEmojis(filter.label),
88
- value: stripEmojis(filter.value)
91
+ label: sanitizePdfText(filter.label),
92
+ value: sanitizePdfText(filter.value)
89
93
  }));
90
94
  }
91
95
  if (sections.table) {
92
96
  sanitized.table = {
93
97
  columns: sections.table.columns.map((col) => ({
94
98
  ...col,
95
- header: stripEmojis(col.header)
99
+ header: sanitizePdfText(col.header)
96
100
  })),
97
101
  rows: sections.table.rows.map((row) => {
98
102
  const sanitizedRow = {};
99
103
  for (const [key, value] of Object.entries(row)) {
100
- sanitizedRow[key] = typeof value === "string" ? stripEmojis(value) : value;
104
+ sanitizedRow[key] = typeof value === "string" ? sanitizePdfText(value) : value;
101
105
  }
102
106
  return sanitizedRow;
103
107
  })
@@ -105,6 +109,11 @@ var PdfExporter = class {
105
109
  }
106
110
  return sanitized;
107
111
  }
112
+ drawSectionTitle(doc, title) {
113
+ doc.fillColor(COLOR_BLACK).font(FONT_BOLD).fontSize(13).text(title, { align: "left" });
114
+ doc.moveDown(0.5);
115
+ return doc.y;
116
+ }
108
117
  drawFilters(doc, filters) {
109
118
  doc.fillColor(COLOR_BLACK).font(FONT_BOLD).fontSize(11).text("Applied Filters", { align: "left" });
110
119
  doc.moveDown(0.5);
@@ -123,26 +132,33 @@ var PdfExporter = class {
123
132
  const columnCount = columns.length;
124
133
  const headerFontSize = columnCount > 13 ? 8 : columnCount > 10 ? 9 : columnCount > 7 ? 10 : 11;
125
134
  const dataFontSize = columnCount > 13 ? 7 : columnCount > 10 ? 8 : columnCount > 7 ? 9 : 10;
135
+ const headerWidthSlack = 2;
136
+ const headerMinWidths = /* @__PURE__ */ new Map();
126
137
  columns.forEach((col) => {
127
138
  doc.font(FONT_BOLD).fontSize(headerFontSize);
128
- let maxWidth = doc.widthOfString(col.header);
139
+ const headerTextWidth = doc.widthOfString(col.header);
140
+ const headerMinWidth = Math.max(...col.header.split(" ").map((w) => doc.widthOfString(w)));
129
141
  doc.font(FONT_REGULAR).fontSize(dataFontSize);
142
+ let maxDataWidth = 0;
130
143
  rows.forEach((row) => {
131
144
  const rv = row[col.key];
132
145
  const cellValue = typeof rv === "string" || typeof rv === "number" || typeof rv === "boolean" ? String(rv) : "";
133
146
  const textWidth = doc.widthOfString(cellValue);
134
- if (textWidth > maxWidth) {
135
- maxWidth = textWidth;
147
+ if (textWidth > maxDataWidth) {
148
+ maxDataWidth = textWidth;
136
149
  }
137
150
  });
138
- col.width = Math.max(maxWidth + baseCellPadding * 2, minColumnWidth);
151
+ const contentWidth = Math.max(headerTextWidth, maxDataWidth);
152
+ col.width = Math.max(contentWidth + baseCellPadding * 2 + headerWidthSlack, minColumnWidth);
153
+ headerMinWidths.set(col, headerMinWidth + baseCellPadding * 2 + headerWidthSlack);
139
154
  });
140
155
  const usableWidth = doc.page.width - doc.page.margins.left - doc.page.margins.right;
141
156
  const totalColumnWidth = columns.reduce((sum, c) => sum + (c.width ?? minColumnWidth), 0);
142
157
  if (totalColumnWidth > usableWidth) {
143
158
  const scale = usableWidth / totalColumnWidth;
144
159
  columns.forEach((c) => {
145
- c.width = Math.max(Math.floor((c.width ?? minColumnWidth) * scale), minColumnWidth);
160
+ const headerMin = headerMinWidths.get(c) ?? minColumnWidth;
161
+ c.width = Math.max(Math.floor((c.width ?? minColumnWidth) * scale), headerMin, minColumnWidth);
146
162
  });
147
163
  }
148
164
  const tableWidth = columns.reduce((sum, c) => sum + (c.width ?? minColumnWidth), 0);
@@ -1,18 +1,15 @@
1
- import { E as ExportTable, a as ExportFilter, b as ExportTableColumn } from '../../types-BzLsgnfc.cjs';
1
+ import { E as ExportSection, a as ExportFilter, b as ExportTable, c as ExportTableColumn } from '../../types-BPT5hjCR.cjs';
2
2
 
3
- interface PdfSection {
4
- table?: ExportTable;
5
- filters?: ExportFilter[];
6
- }
7
3
  declare class PdfExporter {
8
4
  generate(content: {
9
- sections: PdfSection[];
5
+ sections: ExportSection[];
10
6
  }): Promise<Buffer>;
11
7
  private sanitizeSections;
8
+ drawSectionTitle(doc: PDFKit.PDFDocument, title: string): number;
12
9
  drawFilters(doc: PDFKit.PDFDocument, filters: ExportFilter[]): number;
13
10
  drawTable(doc: PDFKit.PDFDocument, table: ExportTable, startY?: number): void;
14
11
  drawHeader(doc: PDFKit.PDFDocument, columns: ExportTableColumn[], startY: number, tableWidth: number, headerHeight: number, cellPadding: number, headerFontSize: number, minColumnWidth: number): number;
15
12
  drawRow(doc: PDFKit.PDFDocument, row: Record<string, unknown>, rowIndex: number, columns: ExportTableColumn[], currentY: number, tableWidth: number, rowHeight: number, cellPadding: number, dataFontSize: number, minColumnWidth: number): number;
16
13
  }
17
14
 
18
- export { PdfExporter, ExportFilter as PdfFilter, type PdfSection, ExportTable as PdfTable, ExportTableColumn as PdfTableColumn };
15
+ export { PdfExporter, ExportFilter as PdfFilter, ExportSection as PdfSection, ExportTable as PdfTable, ExportTableColumn as PdfTableColumn };
@@ -1,18 +1,15 @@
1
- import { E as ExportTable, a as ExportFilter, b as ExportTableColumn } from '../../types-BzLsgnfc.js';
1
+ import { E as ExportSection, a as ExportFilter, b as ExportTable, c as ExportTableColumn } from '../../types-BPT5hjCR.js';
2
2
 
3
- interface PdfSection {
4
- table?: ExportTable;
5
- filters?: ExportFilter[];
6
- }
7
3
  declare class PdfExporter {
8
4
  generate(content: {
9
- sections: PdfSection[];
5
+ sections: ExportSection[];
10
6
  }): Promise<Buffer>;
11
7
  private sanitizeSections;
8
+ drawSectionTitle(doc: PDFKit.PDFDocument, title: string): number;
12
9
  drawFilters(doc: PDFKit.PDFDocument, filters: ExportFilter[]): number;
13
10
  drawTable(doc: PDFKit.PDFDocument, table: ExportTable, startY?: number): void;
14
11
  drawHeader(doc: PDFKit.PDFDocument, columns: ExportTableColumn[], startY: number, tableWidth: number, headerHeight: number, cellPadding: number, headerFontSize: number, minColumnWidth: number): number;
15
12
  drawRow(doc: PDFKit.PDFDocument, row: Record<string, unknown>, rowIndex: number, columns: ExportTableColumn[], currentY: number, tableWidth: number, rowHeight: number, cellPadding: number, dataFontSize: number, minColumnWidth: number): number;
16
13
  }
17
14
 
18
- export { PdfExporter, ExportFilter as PdfFilter, type PdfSection, ExportTable as PdfTable, ExportTableColumn as PdfTableColumn };
15
+ export { PdfExporter, ExportFilter as PdfFilter, ExportSection as PdfSection, ExportTable as PdfTable, ExportTableColumn as PdfTableColumn };