shareneus 1.5.88 → 1.5.90

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.
@@ -26,17 +26,17 @@ export declare function CreateInvoicePDFService(PDFInvoiceData?: any, PrintConfi
26
26
  alignment: string;
27
27
  margin: number[];
28
28
  }) | undefined;
29
- pageSize: "A4" | "LETTER" | "LEGAL" | {
30
- width: number;
31
- height: number;
32
- };
33
- pageOrientation: "portrait" | "landscape";
34
29
  pageMargins: [number, number, number, number];
35
30
  content: any[];
36
31
  info: {
37
32
  title: string;
38
33
  subject: string;
39
34
  };
35
+ pageOrientation?: "portrait" | "landscape" | undefined;
36
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
37
+ width: number;
38
+ height: number;
39
+ };
40
40
  };
41
41
  export declare function DownloadInvoicePDFService(filename?: string, PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
42
42
  footer?: (() => {
@@ -66,17 +66,17 @@ export declare function DownloadInvoicePDFService(filename?: string, PDFInvoiceD
66
66
  alignment: string;
67
67
  margin: number[];
68
68
  }) | undefined;
69
- pageSize: "A4" | "LETTER" | "LEGAL" | {
70
- width: number;
71
- height: number;
72
- };
73
- pageOrientation: "portrait" | "landscape";
74
69
  pageMargins: [number, number, number, number];
75
70
  content: any[];
76
71
  info: {
77
72
  title: string;
78
73
  subject: string;
79
74
  };
75
+ pageOrientation?: "portrait" | "landscape" | undefined;
76
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
77
+ width: number;
78
+ height: number;
79
+ };
80
80
  };
81
81
  export declare function GetInvoicePdfDataUrl(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
82
82
  footer?: (() => {
@@ -106,15 +106,15 @@ export declare function GetInvoicePdfDataUrl(PDFInvoiceData?: any, PrintConfigDa
106
106
  alignment: string;
107
107
  margin: number[];
108
108
  }) | undefined;
109
- pageSize: "A4" | "LETTER" | "LEGAL" | {
110
- width: number;
111
- height: number;
112
- };
113
- pageOrientation: "portrait" | "landscape";
114
109
  pageMargins: [number, number, number, number];
115
110
  content: any[];
116
111
  info: {
117
112
  title: string;
118
113
  subject: string;
119
114
  };
115
+ pageOrientation?: "portrait" | "landscape" | undefined;
116
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
117
+ width: number;
118
+ height: number;
119
+ };
120
120
  };
@@ -63,15 +63,18 @@ function GetInvoicePdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCo
63
63
  }
64
64
  function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
65
65
  const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
66
- const pageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation);
67
- const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, pageOrientation);
68
- const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
69
- const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, pageOrientation, pageMargins);
66
+ const requestedPageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation);
67
+ const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, requestedPageOrientation);
68
+ const basePageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
70
69
  const copyLabels = normalizeCopyLabels(printCopies);
71
70
  const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig);
72
71
  const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
73
72
  const pageHeader = (0, pdf_header_footer_section_1.buildPageNumberHeader)(PrintConfig);
74
73
  const pageFooter = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
74
+ const pageMargins = pageHeader !== null
75
+ ? [basePageMargins[0], Math.max(basePageMargins[1], 18), basePageMargins[2], basePageMargins[3]]
76
+ : basePageMargins;
77
+ const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, requestedPageOrientation, pageMargins);
75
78
  const content = [];
76
79
  copyLabels.forEach((copyLabel, index) => {
77
80
  const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
@@ -109,10 +112,10 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
109
112
  }
110
113
  }, ...invoiceTotalsAndNotesContent, ...signatureContent);
111
114
  });
112
- const dd = Object.assign(Object.assign(Object.assign(Object.assign({ pageSize: pageSize, pageOrientation: pageOrientation, pageMargins: pageMargins, content: content, info: {
115
+ const dd = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ pageSize: pageSize }, (typeof pageSize === 'string' ? { pageOrientation: requestedPageOrientation } : {})), { pageMargins: pageMargins, content: content, info: {
113
116
  title: 'invoice',
114
117
  subject: Array.isArray(printCopies) ? printCopies.join(', ') : ''
115
- } }, (background ? { background } : {})), (watermark ? { watermark } : {})), (pageHeader !== null ? { header: pageHeader } : {})), (pageFooter !== null ? { footer: pageFooter } : {}));
118
+ } }), (background ? { background } : {})), (watermark ? { watermark } : {})), (pageHeader !== null ? { header: pageHeader } : {})), (pageFooter !== null ? { footer: pageFooter } : {}));
116
119
  return dd;
117
120
  }
118
121
  function normalizeCopyLabels(printCopies = []) {
@@ -26,17 +26,17 @@ export declare function CreateBillPDFService(PDFInvoiceData?: any, PrintConfigDa
26
26
  alignment: string;
27
27
  margin: number[];
28
28
  }) | undefined;
29
- pageSize: "A4" | "LETTER" | "LEGAL" | {
30
- width: number;
31
- height: number;
32
- };
33
- pageOrientation: "portrait" | "landscape";
34
29
  pageMargins: [number, number, number, number];
35
30
  content: any[];
36
31
  info: {
37
32
  title: string;
38
33
  subject: string;
39
34
  };
35
+ pageOrientation?: "portrait" | "landscape" | undefined;
36
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
37
+ width: number;
38
+ height: number;
39
+ };
40
40
  };
41
41
  export declare function DownloadBillPDFService(filename?: string, PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
42
42
  footer?: (() => {
@@ -66,17 +66,17 @@ export declare function DownloadBillPDFService(filename?: string, PDFInvoiceData
66
66
  alignment: string;
67
67
  margin: number[];
68
68
  }) | undefined;
69
- pageSize: "A4" | "LETTER" | "LEGAL" | {
70
- width: number;
71
- height: number;
72
- };
73
- pageOrientation: "portrait" | "landscape";
74
69
  pageMargins: [number, number, number, number];
75
70
  content: any[];
76
71
  info: {
77
72
  title: string;
78
73
  subject: string;
79
74
  };
75
+ pageOrientation?: "portrait" | "landscape" | undefined;
76
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
77
+ width: number;
78
+ height: number;
79
+ };
80
80
  };
81
81
  export declare function GetBillPdfDataUrl(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
82
82
  footer?: (() => {
@@ -106,15 +106,15 @@ export declare function GetBillPdfDataUrl(PDFInvoiceData?: any, PrintConfigData?
106
106
  alignment: string;
107
107
  margin: number[];
108
108
  }) | undefined;
109
- pageSize: "A4" | "LETTER" | "LEGAL" | {
110
- width: number;
111
- height: number;
112
- };
113
- pageOrientation: "portrait" | "landscape";
114
109
  pageMargins: [number, number, number, number];
115
110
  content: any[];
116
111
  info: {
117
112
  title: string;
118
113
  subject: string;
119
114
  };
115
+ pageOrientation?: "portrait" | "landscape" | undefined;
116
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
117
+ width: number;
118
+ height: number;
119
+ };
120
120
  };
@@ -63,15 +63,18 @@ function GetBillPdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCopie
63
63
  }
64
64
  function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
65
65
  const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
66
- const pageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation);
67
- const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, pageOrientation);
68
- const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
69
- const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, pageOrientation, pageMargins);
66
+ const requestedPageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation);
67
+ const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, requestedPageOrientation);
68
+ const basePageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
70
69
  const copyLabels = normalizeCopyLabels(printCopies);
71
70
  const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig);
72
71
  const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
73
72
  const pageHeader = (0, pdf_header_footer_section_1.buildPageNumberHeader)(PrintConfig);
74
73
  const pageFooter = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
74
+ const pageMargins = pageHeader !== null
75
+ ? [basePageMargins[0], Math.max(basePageMargins[1], 18), basePageMargins[2], basePageMargins[3]]
76
+ : basePageMargins;
77
+ const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, requestedPageOrientation, pageMargins);
75
78
  const content = [];
76
79
  copyLabels.forEach((copyLabel, index) => {
77
80
  const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(PrintConfig, PDFInvoiceData);
@@ -109,10 +112,10 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
109
112
  }
110
113
  }, ...invoiceTotalsAndNotesContent, ...signatureContent);
111
114
  });
112
- const dd = Object.assign(Object.assign(Object.assign(Object.assign({ pageSize: pageSize, pageOrientation: pageOrientation, pageMargins: pageMargins, content: content, info: {
115
+ const dd = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ pageSize: pageSize }, (typeof pageSize === 'string' ? { pageOrientation: requestedPageOrientation } : {})), { pageMargins: pageMargins, content: content, info: {
113
116
  title: 'invoice',
114
117
  subject: Array.isArray(printCopies) ? printCopies.join(', ') : ''
115
- } }, (background ? { background } : {})), (watermark ? { watermark } : {})), (pageHeader !== null ? { header: pageHeader } : {})), (pageFooter !== null ? { footer: pageFooter } : {}));
118
+ } }), (background ? { background } : {})), (watermark ? { watermark } : {})), (pageHeader !== null ? { header: pageHeader } : {})), (pageFooter !== null ? { footer: pageFooter } : {}));
116
119
  return dd;
117
120
  }
118
121
  function normalizeCopyLabels(printCopies = []) {
@@ -29,13 +29,14 @@ function resolvePageOrientation(value) {
29
29
  }
30
30
  function resolvePageSize(value, orientation = DEFAULT_PAGE_ORIENTATION) {
31
31
  const raw = String(value !== null && value !== void 0 ? value : '').trim().toLowerCase();
32
- if (raw === 'halfa4') {
32
+ const normalized = raw.replace(/[\s_-]/g, '');
33
+ if (normalized === 'halfa4') {
33
34
  return { width: A4_WIDTH, height: HALF_A4_HEIGHT };
34
35
  }
35
- if (raw === 'letter') {
36
+ if (normalized === 'letter') {
36
37
  return 'LETTER';
37
38
  }
38
- if (raw === 'legal') {
39
+ if (normalized === 'legal') {
39
40
  return 'LEGAL';
40
41
  }
41
42
  return 'A4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.88",
3
+ "version": "1.5.90",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",