shareneus 1.5.99 → 1.6.1

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.
@@ -4,7 +4,9 @@ export declare function buildInvoicePartyDetailsSection(PDFInvoiceData: any, cus
4
4
  }[] | {
5
5
  columns: {
6
6
  width: string;
7
- stack: any[];
7
+ stack: any[] | {
8
+ svg: any;
9
+ };
8
10
  }[];
9
11
  columnGap: number;
10
12
  margin: number[];
@@ -15,7 +17,9 @@ export declare function buildSalesPartyDetailsSection(PDFInvoiceData: any, custo
15
17
  }[] | {
16
18
  columns: {
17
19
  width: string;
18
- stack: any[];
20
+ stack: any[] | {
21
+ svg: any;
22
+ };
19
23
  }[];
20
24
  columnGap: number;
21
25
  margin: number[];
@@ -26,7 +30,9 @@ export declare function buildPurchasePartyDetailsSection(PDFInvoiceData: any, cu
26
30
  }[] | {
27
31
  columns: {
28
32
  width: string;
29
- stack: any[];
33
+ stack: any[] | {
34
+ svg: any;
35
+ };
30
36
  }[];
31
37
  columnGap: number;
32
38
  margin: number[];
@@ -60,7 +60,7 @@ function buildPartyDetailsSectionLayout(config) {
60
60
  : [{ text: '' }];
61
61
  const secondaryStack = ((_b = config === null || config === void 0 ? void 0 : config.secondaryParty) === null || _b === void 0 ? void 0 : _b.hasData)
62
62
  ? buildPartyStack(config.secondaryTitle, config.secondaryParty, config.customerLayout)
63
- : ((config === null || config === void 0 ? void 0 : config.shouldShowSecondaryBarcode) ? buildBarcodeStack(config === null || config === void 0 ? void 0 : config.secondaryBarcodeCode) : [{ text: '' }]);
63
+ : ((config === null || config === void 0 ? void 0 : config.shouldShowSecondaryBarcode) ? GetBarCode(config === null || config === void 0 ? void 0 : config.secondaryBarcodeCode) : [{ text: '' }]);
64
64
  const otherDetailsStack = ((_c = config === null || config === void 0 ? void 0 : config.otherDetails) === null || _c === void 0 ? void 0 : _c.hasData) ? buildOtherDetailsStack(config.otherDetails) : [{ text: '' }];
65
65
  const hasAnyData = ((_d = config === null || config === void 0 ? void 0 : config.primaryParty) === null || _d === void 0 ? void 0 : _d.hasData)
66
66
  || ((_e = config === null || config === void 0 ? void 0 : config.secondaryParty) === null || _e === void 0 ? void 0 : _e.hasData)
@@ -312,6 +312,21 @@ function buildOtherDetailsStack(otherDetails) {
312
312
  }
313
313
  return stack;
314
314
  }
315
+ function GetBarCode(code) {
316
+ // if (!TrUtils.IsNull(code)) {
317
+ return { svg: textToSvgBarcode(code).svg };
318
+ // } else {
319
+ // return {};
320
+ // }
321
+ }
322
+ function textToSvgBarcode(text) {
323
+ const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
324
+ (0, jsbarcode_1.default)(svgElement, text, {
325
+ format: "CODE128", width: 1.25, height: 20, margin: 0, marginTop: 8,
326
+ displayValue: true, fontSize: 7, textMargin: 0, fontOptions: 'bold'
327
+ });
328
+ return { svg: svgElement.outerHTML };
329
+ }
315
330
  function buildBarcodeStack(code) {
316
331
  const svg = textToSvgBarcode(code);
317
332
  if (!svg) {
@@ -321,6 +336,7 @@ function buildBarcodeStack(code) {
321
336
  {
322
337
  svg,
323
338
  width: 92,
339
+ fontSize: 8,
324
340
  alignment: 'center',
325
341
  margin: [0, 0, 0, 0]
326
342
  }
@@ -440,24 +456,24 @@ function isTruthy(value) {
440
456
  }
441
457
  return false;
442
458
  }
443
- function textToSvgBarcode(text) {
444
- if (!text || typeof document === 'undefined') {
445
- return '';
446
- }
447
- const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
448
- (0, jsbarcode_1.default)(svgElement, text, {
449
- format: "CODE128",
450
- width: 1,
451
- height: 18,
452
- margin: 0,
453
- marginTop: 0,
454
- displayValue: true,
455
- fontSize: 8,
456
- textMargin: 1,
457
- fontOptions: 'bold'
458
- });
459
- return svgElement.outerHTML;
460
- }
459
+ // function textToSvgBarcode(text: string) {
460
+ // if (!text || typeof document === 'undefined') {
461
+ // return '';
462
+ // }
463
+ // const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
464
+ // JsBarcode(svgElement, text, {
465
+ // format: "CODE128",
466
+ // width: 1,
467
+ // height: 18,
468
+ // margin: 0,
469
+ // marginTop: 0,
470
+ // displayValue: true,
471
+ // fontSize: 8,
472
+ // textMargin: 1,
473
+ // fontOptions: 'bold'
474
+ // });
475
+ // return svgElement.outerHTML;
476
+ // }
461
477
  function resolvePhoneFromContacts(contacts) {
462
478
  if (!Array.isArray(contacts)) {
463
479
  return { type: '', number: '' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.99",
3
+ "version": "1.6.01",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",