shareneus 1.6.9 → 1.6.11
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.
|
@@ -121,7 +121,7 @@ function resolvePageMargins(value) {
|
|
|
121
121
|
function buildDocumentHeaderSection(PrintConfig, DocumentData = {}) {
|
|
122
122
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
123
123
|
const entity = (_a = DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.Entity) !== null && _a !== void 0 ? _a : {};
|
|
124
|
-
console.log('DocumentData
|
|
124
|
+
console.log('Building header with DocumentData entity:', entity);
|
|
125
125
|
const documentLogoDataUrl = resolveDocumentLogoDataUrl(DocumentData);
|
|
126
126
|
const headerData = normalizeHeaderData((_b = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _b !== void 0 ? _b : {});
|
|
127
127
|
const mergedHeaderData = normalizeHeaderData(Object.assign(Object.assign({}, headerData), { logoDataUrl: (0, pdf_shared_utils_1.firstValue)(documentLogoDataUrl, headerData === null || headerData === void 0 ? void 0 : headerData.logoDataUrl), organization: Object.assign(Object.assign({}, ((_c = headerData === null || headerData === void 0 ? void 0 : headerData.organization) !== null && _c !== void 0 ? _c : {})), { cName: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.CName, (_d = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _d === void 0 ? void 0 : _d.cName), address1: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs1, (_e = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _e === void 0 ? void 0 : _e.address1), address2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs2, (_f = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _f === void 0 ? void 0 : _f.address2), dlNo: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.DLNo, entity === null || entity === void 0 ? void 0 : entity.DLNO, (_g = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _g === void 0 ? void 0 : _g.dlNo), gstin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.GSTIN, (_h = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _h === void 0 ? void 0 : _h.gstin), pan: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PAN, (_j = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _j === void 0 ? void 0 : _j.pan), taxIds: Array.isArray(entity === null || entity === void 0 ? void 0 : entity.TaxIds) ? entity.TaxIds : (_k = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _k === void 0 ? void 0 : _k.taxIds, city: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.City, (_l = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _l === void 0 ? void 0 : _l.city), state: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.State, (_m = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _m === void 0 ? void 0 : _m.state), pin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PIN, entity === null || entity === void 0 ? void 0 : entity.Pin, (_o = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _o === void 0 ? void 0 : _o.pin), email: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Email, entity === null || entity === void 0 ? void 0 : entity.EMail, (_p = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _p === void 0 ? void 0 : _p.email), phone: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone, entity === null || entity === void 0 ? void 0 : entity.Ph, (_q = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _q === void 0 ? void 0 : _q.phone), phone2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone2, entity === null || entity === void 0 ? void 0 : entity.Ph2, (_r = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _r === void 0 ? void 0 : _r.phone2) }) }));
|
|
@@ -282,8 +282,9 @@ function buildOrganizationStack(organization, headerStyles, alignment) {
|
|
|
282
282
|
}
|
|
283
283
|
const hasTaxIdsConfig = Array.isArray(organization === null || organization === void 0 ? void 0 : organization.taxIds) && organization.taxIds.length > 0;
|
|
284
284
|
const printedTaxIdsText = buildPrintedTaxIdsText(organization === null || organization === void 0 ? void 0 : organization.taxIds);
|
|
285
|
+
console.log('Printed tax IDs text:', printedTaxIdsText, 'for tax IDs config:', organization === null || organization === void 0 ? void 0 : organization.taxIds);
|
|
285
286
|
if (hasTaxIdsConfig) {
|
|
286
|
-
console.log('printedTaxIdsText
|
|
287
|
+
console.log('inside printedTaxIdsText', printedTaxIdsText);
|
|
287
288
|
if (printedTaxIdsText) {
|
|
288
289
|
stack.push({ text: printedTaxIdsText, fontSize: orgAddressFontSize, color: orgAddressFontColor, lineHeight: 1.05, alignment });
|
|
289
290
|
}
|
|
@@ -337,6 +338,7 @@ function normalizeTaxIds(value) {
|
|
|
337
338
|
});
|
|
338
339
|
}
|
|
339
340
|
function buildPrintedTaxIdsText(value) {
|
|
341
|
+
console.log('Building printed tax IDs text with value:', value);
|
|
340
342
|
const taxIds = normalizeTaxIds(value);
|
|
341
343
|
const primary = [];
|
|
342
344
|
const secondary = [];
|
|
@@ -327,6 +327,10 @@ function buildBarcodeStack(code) {
|
|
|
327
327
|
];
|
|
328
328
|
}
|
|
329
329
|
function hasAddress(address) {
|
|
330
|
+
const lines = normalizeAddressLines(address);
|
|
331
|
+
if (lines.length > 0) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
330
334
|
const normalizedAddress = normalizeAddress(address);
|
|
331
335
|
if (!normalizedAddress) {
|
|
332
336
|
return false;
|
|
@@ -334,6 +338,10 @@ function hasAddress(address) {
|
|
|
334
338
|
return !!(0, pdf_shared_utils_1.firstValue)(getAddressFieldValue(normalizedAddress, ['A1', 'Addr1', 'Address1', 'Adrs1', 'Line1', 'Street1']), getAddressFieldValue(normalizedAddress, ['A2', 'Addr2', 'Address2', 'Adrs2', 'Line2', 'Street2']), getAddressFieldValue(normalizedAddress, ['Ct', 'City', 'Town', 'District']), getAddressFieldValue(normalizedAddress, ['St', 'State', 'StateName', 'Province']), getAddressFieldValue(normalizedAddress, ['Pin', 'PIN', 'Zip', 'ZipCode', 'PostalCode', 'Pincode']));
|
|
335
339
|
}
|
|
336
340
|
function buildAddressLines(address) {
|
|
341
|
+
const lines = normalizeAddressLines(address);
|
|
342
|
+
if (lines.length > 0) {
|
|
343
|
+
return lines;
|
|
344
|
+
}
|
|
337
345
|
const normalizedAddress = normalizeAddress(address);
|
|
338
346
|
if (!normalizedAddress) {
|
|
339
347
|
return [];
|
|
@@ -349,6 +357,15 @@ function buildAddressLines(address) {
|
|
|
349
357
|
.join(', ');
|
|
350
358
|
return [line1, line2, cityStatePin].filter((value) => !!value);
|
|
351
359
|
}
|
|
360
|
+
function normalizeAddressLines(address) {
|
|
361
|
+
if (!Array.isArray(address)) {
|
|
362
|
+
return [];
|
|
363
|
+
}
|
|
364
|
+
return address
|
|
365
|
+
.filter((line) => typeof line === 'string')
|
|
366
|
+
.map((line) => line.trim())
|
|
367
|
+
.filter((line) => !!line);
|
|
368
|
+
}
|
|
352
369
|
function normalizeAddress(address) {
|
|
353
370
|
if (!address) {
|
|
354
371
|
return null;
|
|
@@ -362,7 +379,7 @@ function normalizeAddress(address) {
|
|
|
362
379
|
return null;
|
|
363
380
|
}
|
|
364
381
|
const preferred = address.find((entry) => (entry === null || entry === void 0 ? void 0 : entry.DefBill) || (entry === null || entry === void 0 ? void 0 : entry.DefShip) || (entry === null || entry === void 0 ? void 0 : entry.Def));
|
|
365
|
-
return preferred || address
|
|
382
|
+
return preferred || address || null;
|
|
366
383
|
}
|
|
367
384
|
if (typeof address === 'object') {
|
|
368
385
|
if ((address === null || address === void 0 ? void 0 : address.Adrs) && typeof address.Adrs === 'object') {
|
|
@@ -61,10 +61,7 @@ class PrintSharedService {
|
|
|
61
61
|
else {
|
|
62
62
|
Entity.RegNo = tempEntity.Settings.Common.RegNo;
|
|
63
63
|
}
|
|
64
|
-
console.log('Entity RegNo:', !tr_utils_1.TrUtils.IsNull(tempEntity.Settings.Common.Tax));
|
|
65
64
|
if (!tr_utils_1.TrUtils.IsNull(tempEntity.Settings.Common.Tax)) {
|
|
66
|
-
console.log('Entity Tax Config:', tempEntity.Settings.Common.Tax);
|
|
67
|
-
console.log('Entity TaxIds:', tempEntity.Settings.Common.Tax.TaxIds);
|
|
68
65
|
Entity.TaxIds = tempEntity.Settings.Common.Tax.TaxIds;
|
|
69
66
|
}
|
|
70
67
|
if (tr_utils_1.TrUtils.IsNull(tempEntity.Settings.Common.Tax.GSTType)) {
|
|
@@ -175,7 +172,6 @@ class PrintSharedService {
|
|
|
175
172
|
else {
|
|
176
173
|
Entity.Terms = "";
|
|
177
174
|
}
|
|
178
|
-
console.log('Formatted Entity Data for Print:', Entity);
|
|
179
175
|
return Entity;
|
|
180
176
|
}
|
|
181
177
|
static GetEntityContactDetails(EntityInfo) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shareneus",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc"
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"build:watch": "tsc -w"
|
|
9
10
|
},
|
|
10
11
|
"keywords": [],
|
|
11
12
|
"author": "",
|