shareneus 1.6.12 → 1.6.14

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.
@@ -17,17 +17,19 @@ function buildSalesPartyDetailsSection(PDFInvoiceData, customerLayout, printConf
17
17
  const shipTo = resolveSalesShipToDetails(transactionData);
18
18
  const insurance = resolveInsuranceDetails(transactionData);
19
19
  const useInsurance = !!insurance.name;
20
+ const shouldShowBillTo = resolvePartyVisibility(printConfig, 'ShowBillTo');
21
+ const shouldShowShipTo = useInsurance ? true : resolvePartyVisibility(printConfig, 'ShowShipTo');
20
22
  const secondaryParty = useInsurance ? insurance : shipTo;
21
23
  const showBarCode = resolveShowBarCode(transactionData, printConfig);
22
24
  const billToCode = resolveBillToCode(transactionData);
23
25
  const otherDetails = resolveOtherDetails(transactionData, printConfig);
24
- const shouldShowSecondaryBarcode = !secondaryParty.hasData && showBarCode && !!billToCode;
26
+ const shouldShowSecondaryBarcode = shouldShowShipTo && !secondaryParty.hasData && showBarCode && !!billToCode;
25
27
  const secondaryTitle = useInsurance ? 'Insurance' : 'Ship To';
26
28
  return buildPartyDetailsSectionLayout({
27
29
  primaryTitle: 'Bill To',
28
- primaryParty: billTo,
30
+ primaryParty: shouldShowBillTo ? billTo : { hasData: false },
29
31
  secondaryTitle,
30
- secondaryParty,
32
+ secondaryParty: shouldShowShipTo ? secondaryParty : { hasData: false },
31
33
  customerLayout,
32
34
  otherDetails,
33
35
  shouldShowSecondaryBarcode,
@@ -323,7 +325,7 @@ function buildBarcodeStack(code) {
323
325
  return [
324
326
  {
325
327
  svg,
326
- width: 72,
328
+ width: 80,
327
329
  alignment: 'center',
328
330
  margin: [0, 0, 0, 0]
329
331
  }
@@ -430,6 +432,12 @@ function resolveShowBarCode(transactionData, printConfig = {}) {
430
432
  || isTruthy((_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Entity) === null || _b === void 0 ? void 0 : _b.PrCustBar)
431
433
  || isTruthy(transactionData === null || transactionData === void 0 ? void 0 : transactionData.PrCustBar);
432
434
  }
435
+ function resolvePartyVisibility(printConfig, key) {
436
+ if (Object.prototype.hasOwnProperty.call(printConfig || {}, key)) {
437
+ return isTruthy(printConfig === null || printConfig === void 0 ? void 0 : printConfig[key]);
438
+ }
439
+ return true;
440
+ }
433
441
  function resolveBillToCode(transactionData) {
434
442
  var _a, _b, _c;
435
443
  return (0, pdf_shared_utils_1.firstValue)((_a = transactionData === null || transactionData === void 0 ? void 0 : transactionData.BillTo) === null || _a === void 0 ? void 0 : _a.Code, (_b = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Customer) === null || _b === void 0 ? void 0 : _b.Code, (_c = transactionData === null || transactionData === void 0 ? void 0 : transactionData.Cust) === null || _c === void 0 ? void 0 : _c.Code);
@@ -467,12 +475,12 @@ function textToSvgBarcode(text) {
467
475
  const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
468
476
  (0, jsbarcode_1.default)(svgElement, text, {
469
477
  format: "CODE128",
470
- width: 0.48,
471
- height: 9.6,
478
+ width: 1.2,
479
+ height: 18,
472
480
  margin: 0,
473
481
  marginTop: 0,
474
482
  displayValue: true,
475
- fontSize: 4,
483
+ fontSize: 6,
476
484
  textMargin: 0,
477
485
  fontOptions: 'bold'
478
486
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.12",
3
+ "version": "1.6.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",