shareneus 1.6.73 → 1.6.74

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,39 +62,33 @@ function GetInvoicePdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCo
62
62
  // });
63
63
  }
64
64
  function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
65
+ var _a;
65
66
  const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
66
- const compactLayout = (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize);
67
67
  const requestedPageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Orientation) || (PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation));
68
68
  const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, requestedPageOrientation);
69
69
  const basePageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
70
- const resolvedPrintConfig = compactLayout ? Object.assign(Object.assign({}, PrintConfig), { compactLayout: true }) : PrintConfig;
71
70
  const copyLabels = normalizeCopyLabels(printCopies);
72
- const watermark = (0, pdf_header_footer_section_1.buildWatermark)(resolvedPrintConfig, PDFInvoiceData);
73
- const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(resolvedPrintConfig, PDFInvoiceData);
74
- const pageHeader = (0, pdf_header_footer_section_1.buildPageNumberHeader)(resolvedPrintConfig);
75
- const pageFooter = (0, pdf_header_footer_section_1.buildFooter)(resolvedPrintConfig);
76
- const pageMargins = pageHeader !== null
77
- ? [
78
- compactLayout ? Math.min(basePageMargins[0], 12) : basePageMargins[0],
79
- compactLayout ? Math.max(Math.min(basePageMargins[1], 12), 12) : Math.max(basePageMargins[1], 18),
80
- compactLayout ? Math.min(basePageMargins[2], 12) : basePageMargins[2],
81
- compactLayout ? Math.min(basePageMargins[3], 12) : basePageMargins[3]
82
- ]
83
- : [
84
- compactLayout ? Math.min(basePageMargins[0], 12) : basePageMargins[0],
85
- compactLayout ? Math.min(basePageMargins[1], 12) : basePageMargins[1],
86
- compactLayout ? Math.min(basePageMargins[2], 12) : basePageMargins[2],
87
- compactLayout ? Math.min(basePageMargins[3], 12) : basePageMargins[3]
88
- ];
71
+ const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig, PDFInvoiceData);
72
+ const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
73
+ const pageHeader = (0, pdf_header_footer_section_1.buildPageNumberHeader)(PrintConfig);
74
+ const pageFooter = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
75
+ let pageMargins = pageHeader !== null
76
+ ? [basePageMargins[0], Math.max(basePageMargins[1], 18), basePageMargins[2], basePageMargins[3]]
77
+ : basePageMargins;
78
+ const raw = String((_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize) !== null && _a !== void 0 ? _a : '').trim().toLowerCase();
79
+ const normalized = raw.replace(/[\s_-]/g, '');
80
+ if (normalized === 'halfa4') {
81
+ pageMargins = [25, 15, 25, 435.945];
82
+ }
89
83
  const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, requestedPageOrientation, pageMargins);
90
84
  const content = [];
91
85
  copyLabels.forEach((copyLabel, index) => {
92
- const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(resolvedPrintConfig, PDFInvoiceData);
93
- const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, resolvedPrintConfig, availableWidth);
94
- const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, resolvedPrintConfig === null || resolvedPrintConfig === void 0 ? void 0 : resolvedPrintConfig.Customer, resolvedPrintConfig);
95
- const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, resolvedPrintConfig);
96
- const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(resolvedPrintConfig, PDFInvoiceData, availableWidth);
97
- const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, resolvedPrintConfig, availableWidth);
86
+ const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
87
+ const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
88
+ const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer, PrintConfig);
89
+ const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, PrintConfigData);
90
+ const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(PrintConfig, PDFInvoiceData, availableWidth);
91
+ const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, PrintConfig, availableWidth);
98
92
  if (index > 0) {
99
93
  content.push({ text: '', pageBreak: 'before' });
100
94
  }
@@ -3,7 +3,6 @@ export declare function resolvePageSize(value: any, orientation?: 'portrait' | '
3
3
  width: number;
4
4
  height: number;
5
5
  };
6
- export declare function isHalfA4PageSize(value: any): boolean;
7
6
  export declare function deriveHeaderDataFromInvoice(PDFInvoiceData: any): {
8
7
  invoiceHeading: string;
9
8
  organization: {
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolvePageOrientation = resolvePageOrientation;
4
4
  exports.resolvePageSize = resolvePageSize;
5
- exports.isHalfA4PageSize = isHalfA4PageSize;
6
5
  exports.deriveHeaderDataFromInvoice = deriveHeaderDataFromInvoice;
7
6
  exports.normalizeHeaderData = normalizeHeaderData;
8
7
  exports.normalizeHeaderStyle = normalizeHeaderStyle;
@@ -32,7 +31,8 @@ function resolvePageSize(value, orientation = DEFAULT_PAGE_ORIENTATION) {
32
31
  const raw = String(value !== null && value !== void 0 ? value : '').trim().toLowerCase();
33
32
  const normalized = raw.replace(/[\s_-]/g, '');
34
33
  if (normalized === 'halfa4') {
35
- return { width: A4_WIDTH, height: HALF_A4_HEIGHT };
34
+ // return { width: A4_WIDTH, height: HALF_A4_HEIGHT };
35
+ return 'A4';
36
36
  }
37
37
  if (normalized === 'letter') {
38
38
  return 'LETTER';
@@ -42,11 +42,6 @@ function resolvePageSize(value, orientation = DEFAULT_PAGE_ORIENTATION) {
42
42
  }
43
43
  return 'A4';
44
44
  }
45
- function isHalfA4PageSize(value) {
46
- const raw = String(value !== null && value !== void 0 ? value : '').trim().toLowerCase();
47
- const normalized = raw.replace(/[\s_-]/g, '');
48
- return normalized === 'halfa4';
49
- }
50
45
  function deriveHeaderDataFromInvoice(PDFInvoiceData) {
51
46
  const entity = (PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Entity) || {};
52
47
  return {
@@ -23,7 +23,6 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
23
23
  const terms = (0, pdf_shared_utils_1.firstValue)(normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TermsAndConditions, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TermsCondition, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Terms, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TC);
24
24
  const dueInfo = resolveDueInfo(normalizedInvoice, totals);
25
25
  const qrPayload = resolveQrPayload(normalizedInvoice, PrintConfigData);
26
- const compactLayout = !!(PrintConfigData === null || PrintConfigData === void 0 ? void 0 : PrintConfigData.compactLayout) || (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfigData === null || PrintConfigData === void 0 ? void 0 : PrintConfigData.PSize);
27
26
  const hasTopSection = !hideTopSection && (taxSummary.hasData || bankDetails.hasData || totals.hasData);
28
27
  const hasBottomSection = !!(notes || terms || totalInWords || (showDueSection && dueInfo.hasData) || qrPayload);
29
28
  if (!hasTopSection && !hasBottomSection) {
@@ -33,12 +32,12 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
33
32
  canvas: [
34
33
  { type: 'line', x1: 0, y1: 0, x2: Math.max(1, availableWidth), y2: 0, lineWidth: 1, lineColor: '#1f2937' }
35
34
  ],
36
- margin: compactLayout ? [0, 6, 0, 6] : [0, 10, 0, 10]
35
+ margin: [0, 10, 0, 10]
37
36
  };
38
37
  const topColumns = {
39
38
  columns: buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals),
40
39
  columnGap: 20,
41
- margin: compactLayout ? [0, 0, 0, 4] : [0, 0, 0, 8]
40
+ margin: [0, 0, 0, 8]
42
41
  };
43
42
  const bottomColumns = buildPostTotalsInfoSection({
44
43
  totalInWords,
@@ -160,18 +159,17 @@ function buildSignatureSection(PrintConfig, invoiceData, availableWidth) {
160
159
  const headerData = (0, pdf_header_footer_section_1.normalizeHeaderData)((_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _a !== void 0 ? _a : {});
161
160
  const companyName = (0, pdf_shared_utils_1.firstValue)((_b = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _b === void 0 ? void 0 : _b.cName, (_c = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _c === void 0 ? void 0 : _c.CName, (_d = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _d === void 0 ? void 0 : _d.Name, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.CName);
162
161
  const withPass = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.withPass) || (invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.withPass) || (invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.WithPass));
163
- const compactLayout = !!(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.compactLayout) || (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize);
164
162
  const signatureRows = [
165
163
  {
166
164
  columns: [
167
165
  { width: '*', text: '' },
168
166
  { width: '*', text: `For ${companyName || ''}`.trim(), fontSize: 9, bold: true, color: '#111827', alignment: 'right' }
169
167
  ],
170
- margin: compactLayout ? [0, 6, 0, 0] : [0, 12, 0, 0]
168
+ margin: [0, 12, 0, 0]
171
169
  },
172
170
  {
173
171
  text: '',
174
- margin: compactLayout ? [0, 10, 0, 0] : [0, 18, 0, 0]
172
+ margin: [0, 18, 0, 0]
175
173
  },
176
174
  {
177
175
  columns: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.73",
3
+ "version": "1.6.74",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",