@aibrains/pdf-renderer 0.3.0 → 0.5.0
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.
- package/dist/core/i18n.d.ts +10 -5
- package/dist/core/i18n.d.ts.map +1 -1
- package/dist/core/i18n.js +9 -5
- package/dist/core/i18n.js.map +1 -1
- package/dist/descriptors/index.d.ts +14 -0
- package/dist/descriptors/index.d.ts.map +1 -0
- package/dist/descriptors/index.js +20 -0
- package/dist/descriptors/index.js.map +1 -0
- package/dist/descriptors/invoice.d.ts +19 -0
- package/dist/descriptors/invoice.d.ts.map +1 -0
- package/dist/descriptors/invoice.js +160 -0
- package/dist/descriptors/invoice.js.map +1 -0
- package/dist/descriptors/registry.d.ts +52 -0
- package/dist/descriptors/registry.d.ts.map +1 -0
- package/dist/descriptors/registry.js +85 -0
- package/dist/descriptors/registry.js.map +1 -0
- package/dist/descriptors/types.d.ts +207 -0
- package/dist/descriptors/types.d.ts.map +1 -0
- package/dist/descriptors/types.js +15 -0
- package/dist/descriptors/types.js.map +1 -0
- package/dist/documents/InvoicePdf.d.ts +74 -0
- package/dist/documents/InvoicePdf.d.ts.map +1 -0
- package/dist/documents/InvoicePdf.js +172 -0
- package/dist/documents/InvoicePdf.js.map +1 -0
- package/dist/i18n/en/invoice.json +31 -0
- package/dist/i18n/ne/invoice.json +31 -0
- package/dist/index.d.ts +12 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -9
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/dist/core/i18n.d.ts
CHANGED
|
@@ -14,14 +14,19 @@
|
|
|
14
14
|
* Interpolation: simple `{var}` placeholders. Non-string values are coerced
|
|
15
15
|
* via String(value); undefined/null become empty string.
|
|
16
16
|
*
|
|
17
|
-
* V1
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* V1 languages: `'en'` + `'ne'`. Namespaces are added per-doc-type as their
|
|
18
|
+
* descriptors land:
|
|
19
|
+
* - `'common'` (Sprint C.0.2)
|
|
20
|
+
* - `'invoice'` (Sprint C.1.1)
|
|
21
|
+
* - future: `'receipt'` (C.1.2), `'report-card'` (C.3.1), `'admit-card'` (C.5.1)
|
|
20
22
|
*/
|
|
21
23
|
/** Supported document languages in V1. */
|
|
22
24
|
export type Lang = 'en' | 'ne';
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Supported translation namespaces in V1. New doc types append here AND
|
|
27
|
+
* add a bundle entry to BUNDLES below; the loader is otherwise additive.
|
|
28
|
+
*/
|
|
29
|
+
export type Namespace = 'common' | 'invoice';
|
|
25
30
|
/**
|
|
26
31
|
* Translate a key.
|
|
27
32
|
*
|
package/dist/core/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/core/i18n.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/core/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,0CAA0C;AAC1C,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/B;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAa7C;;;;;;;GAOG;AACH,wBAAgB,CAAC,CACf,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,IAAI,EACV,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,GACxD,MAAM,CAYR;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,GACxD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAKxC"}
|
package/dist/core/i18n.js
CHANGED
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
* Interpolation: simple `{var}` placeholders. Non-string values are coerced
|
|
16
16
|
* via String(value); undefined/null become empty string.
|
|
17
17
|
*
|
|
18
|
-
* V1
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* V1 languages: `'en'` + `'ne'`. Namespaces are added per-doc-type as their
|
|
19
|
+
* descriptors land:
|
|
20
|
+
* - `'common'` (Sprint C.0.2)
|
|
21
|
+
* - `'invoice'` (Sprint C.1.1)
|
|
22
|
+
* - future: `'receipt'` (C.1.2), `'report-card'` (C.3.1), `'admit-card'` (C.5.1)
|
|
21
23
|
*/
|
|
22
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -27,9 +29,11 @@ exports.t = t;
|
|
|
27
29
|
exports.tDual = tDual;
|
|
28
30
|
const common_json_1 = __importDefault(require("../i18n/en/common.json"));
|
|
29
31
|
const common_json_2 = __importDefault(require("../i18n/ne/common.json"));
|
|
32
|
+
const invoice_json_1 = __importDefault(require("../i18n/en/invoice.json"));
|
|
33
|
+
const invoice_json_2 = __importDefault(require("../i18n/ne/invoice.json"));
|
|
30
34
|
const BUNDLES = {
|
|
31
|
-
en: { common: common_json_1.default },
|
|
32
|
-
ne: { common: common_json_2.default },
|
|
35
|
+
en: { common: common_json_1.default, invoice: invoice_json_1.default },
|
|
36
|
+
ne: { common: common_json_2.default, invoice: invoice_json_2.default },
|
|
33
37
|
};
|
|
34
38
|
/** Default fallback language when target language is missing a key. */
|
|
35
39
|
const FALLBACK_LANG = 'en';
|
package/dist/core/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/core/i18n.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/core/i18n.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;AAmCH,cAiBC;AASD,sBAUC;AArED,yEAA8C;AAC9C,yEAA8C;AAC9C,2EAAgD;AAChD,2EAAgD;AAchD,MAAM,OAAO,GAA8B;IACzC,EAAE,EAAE,EAAE,MAAM,EAAE,qBAAQ,EAAE,OAAO,EAAE,sBAAS,EAAE;IAC5C,EAAE,EAAE,EAAE,MAAM,EAAE,qBAAQ,EAAE,OAAO,EAAE,sBAAS,EAAE;CAC7C,CAAC;AAEF,uEAAuE;AACvE,MAAM,aAAa,GAAS,IAAI,CAAC;AAEjC;;;;;;;GAOG;AACH,SAAgB,CAAC,CACf,SAAoB,EACpB,GAAW,EACX,IAAU,EACV,IAAyD;;IAEzD,MAAM,GAAG,GACP,MAAA,MAAA,MAAA,MAAA,OAAO,CAAC,IAAI,CAAC,0CAAG,SAAS,CAAC,0CAAG,GAAG,CAAC,mCACjC,MAAA,MAAA,OAAO,CAAC,aAAa,CAAC,0CAAG,SAAS,CAAC,0CAAG,GAAG,CAAC,mCAC1C,GAAG,CAAC;IAEN,IAAI,CAAC,IAAI;QAAE,OAAO,GAAG,CAAC;IAEtB,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,OAAe,EAAE,EAAE;QAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,KAAK,CACnB,SAAoB,EACpB,GAAW,EACX,KAAmB,EACnB,IAAyD;IAEzD,OAAO;QACL,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;QAC1C,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the descriptor system.
|
|
3
|
+
*
|
|
4
|
+
* Sprint C.0.4 ships the registry + the contract. Concrete descriptors land
|
|
5
|
+
* with their document components in subsequent sprints:
|
|
6
|
+
* - C.1.1 — invoice descriptor
|
|
7
|
+
* - C.1.2 — receipt descriptor
|
|
8
|
+
* - C.3.1 — report-card descriptor
|
|
9
|
+
* - C.5.1 — admit-card descriptor
|
|
10
|
+
* - (and so on for the V1.5 doc types)
|
|
11
|
+
*/
|
|
12
|
+
export { registerDescriptor, getDescriptor, getRegisteredDocTypes, hasDescriptor, } from './registry';
|
|
13
|
+
export type { DocType, Archetype, PdfBranding, PdfLocaleSettings, PdfTemplateConfig, ConfigurableField, DocumentComponentProps, TemplateDescriptor, } from './types';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,aAAa,GACd,MAAM,YAAY,CAAC;AAKpB,YAAY,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Public surface of the descriptor system.
|
|
4
|
+
*
|
|
5
|
+
* Sprint C.0.4 ships the registry + the contract. Concrete descriptors land
|
|
6
|
+
* with their document components in subsequent sprints:
|
|
7
|
+
* - C.1.1 — invoice descriptor
|
|
8
|
+
* - C.1.2 — receipt descriptor
|
|
9
|
+
* - C.3.1 — report-card descriptor
|
|
10
|
+
* - C.5.1 — admit-card descriptor
|
|
11
|
+
* - (and so on for the V1.5 doc types)
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.hasDescriptor = exports.getRegisteredDocTypes = exports.getDescriptor = exports.registerDescriptor = void 0;
|
|
15
|
+
var registry_1 = require("./registry");
|
|
16
|
+
Object.defineProperty(exports, "registerDescriptor", { enumerable: true, get: function () { return registry_1.registerDescriptor; } });
|
|
17
|
+
Object.defineProperty(exports, "getDescriptor", { enumerable: true, get: function () { return registry_1.getDescriptor; } });
|
|
18
|
+
Object.defineProperty(exports, "getRegisteredDocTypes", { enumerable: true, get: function () { return registry_1.getRegisteredDocTypes; } });
|
|
19
|
+
Object.defineProperty(exports, "hasDescriptor", { enumerable: true, get: function () { return registry_1.hasDescriptor; } });
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,uCAKoB;AAJlB,8GAAA,kBAAkB,OAAA;AAClB,yGAAA,aAAa,OAAA;AACb,iHAAA,qBAAqB,OAAA;AACrB,yGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invoice descriptor — Sprint C.1.1.
|
|
3
|
+
*
|
|
4
|
+
* The first concrete `TemplateDescriptor` registered with the library.
|
|
5
|
+
* Registers itself at module load via the top-level `registerDescriptor(...)`
|
|
6
|
+
* call below — importing this file is sufficient to make
|
|
7
|
+
* `getDescriptor('INVOICE')` work.
|
|
8
|
+
*
|
|
9
|
+
* Defaults are split between PABSON and GENERIC archetypes per the design
|
|
10
|
+
* doc §1: PABSON ⇒ BS+AD dual dates + EN+NE labels + south-asian numbers +
|
|
11
|
+
* NPR symbol; GENERIC ⇒ gregorian + EN-only + western + ISO-code currency.
|
|
12
|
+
*
|
|
13
|
+
* `configurableFields[]` is the operator-facing customization surface that
|
|
14
|
+
* the C.2.4 generic editor renders form sections from. 13 fields for V1.
|
|
15
|
+
*/
|
|
16
|
+
import { type InvoiceTemplateConfig, type InvoiceDocumentData } from '../documents/InvoicePdf';
|
|
17
|
+
import type { TemplateDescriptor } from './types';
|
|
18
|
+
export declare const invoiceDescriptor: TemplateDescriptor<InvoiceDocumentData, InvoiceTemplateConfig>;
|
|
19
|
+
//# sourceMappingURL=invoice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice.d.ts","sourceRoot":"","sources":["../../src/descriptors/invoice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAc,KAAK,qBAAqB,EAAE,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE3G,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAoIjB,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,mBAAmB,EAAE,qBAAqB,CAO5F,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Invoice descriptor — Sprint C.1.1.
|
|
4
|
+
*
|
|
5
|
+
* The first concrete `TemplateDescriptor` registered with the library.
|
|
6
|
+
* Registers itself at module load via the top-level `registerDescriptor(...)`
|
|
7
|
+
* call below — importing this file is sufficient to make
|
|
8
|
+
* `getDescriptor('INVOICE')` work.
|
|
9
|
+
*
|
|
10
|
+
* Defaults are split between PABSON and GENERIC archetypes per the design
|
|
11
|
+
* doc §1: PABSON ⇒ BS+AD dual dates + EN+NE labels + south-asian numbers +
|
|
12
|
+
* NPR symbol; GENERIC ⇒ gregorian + EN-only + western + ISO-code currency.
|
|
13
|
+
*
|
|
14
|
+
* `configurableFields[]` is the operator-facing customization surface that
|
|
15
|
+
* the C.2.4 generic editor renders form sections from. 13 fields for V1.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.invoiceDescriptor = void 0;
|
|
19
|
+
const InvoicePdf_1 = require("../documents/InvoicePdf");
|
|
20
|
+
const registry_1 = require("./registry");
|
|
21
|
+
/**
|
|
22
|
+
* The default `InvoiceTemplateConfig` for a freshly-seeded template.
|
|
23
|
+
* Returns PABSON-flavor when the tenant archetype is `'PABSON'`, GENERIC
|
|
24
|
+
* for everything else. Reserved archetypes (`CBSE_IN`, `NAIS_US`,
|
|
25
|
+
* `GEMS_UAE`) fall through to GENERIC per the design doc § 1.
|
|
26
|
+
*/
|
|
27
|
+
function invoiceDefaults(archetype, _locale) {
|
|
28
|
+
const isPabson = archetype === 'PABSON';
|
|
29
|
+
return {
|
|
30
|
+
pageSize: 'A4',
|
|
31
|
+
orientation: 'portrait',
|
|
32
|
+
margins: { top: 15, right: 15, bottom: 15, left: 15 },
|
|
33
|
+
header: {
|
|
34
|
+
showLogo: true,
|
|
35
|
+
showSchoolName: true,
|
|
36
|
+
showSchoolAddress: true,
|
|
37
|
+
showContact: true,
|
|
38
|
+
tagline: isPabson ? 'Education for All' : undefined,
|
|
39
|
+
},
|
|
40
|
+
footer: {
|
|
41
|
+
text: undefined,
|
|
42
|
+
showPageNumbers: true,
|
|
43
|
+
showSignatureLine: true,
|
|
44
|
+
},
|
|
45
|
+
dateFormat: isPabson ? 'dual' : 'gregorian',
|
|
46
|
+
numberFormat: isPabson ? 'south-asian' : 'western',
|
|
47
|
+
currencyDisplay: 'iso-code',
|
|
48
|
+
labelLanguages: isPabson ? ['en', 'ne'] : ['en'],
|
|
49
|
+
lineItemColumns: {
|
|
50
|
+
description: true,
|
|
51
|
+
quantity: true,
|
|
52
|
+
amount: true,
|
|
53
|
+
discount: true,
|
|
54
|
+
taxRate: true,
|
|
55
|
+
taxAmount: true,
|
|
56
|
+
total: true,
|
|
57
|
+
},
|
|
58
|
+
totalsSection: {
|
|
59
|
+
showSubtotal: true,
|
|
60
|
+
showTaxTotal: true,
|
|
61
|
+
showDiscountTotal: true,
|
|
62
|
+
showAmountPaid: true,
|
|
63
|
+
showAmountDue: true,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Sample data for the C.2.4 editor's "default mock" preview path. The shape
|
|
69
|
+
* mirrors a realistic Saraswati Q1 invoice — one tuition fee + one library fee,
|
|
70
|
+
* with a discount + VAT row to exercise every line-item column.
|
|
71
|
+
*/
|
|
72
|
+
function invoiceSampleData(archetype, _locale) {
|
|
73
|
+
const isPabson = archetype === 'PABSON';
|
|
74
|
+
return {
|
|
75
|
+
invoiceNumber: 'INV-2026-001234',
|
|
76
|
+
issuedDate: '2026-03-15',
|
|
77
|
+
dueDate: '2026-04-28',
|
|
78
|
+
academicYear: '2025-2026',
|
|
79
|
+
billingPeriod: isPabson ? 'चैत 2082' : 'Q1 2026',
|
|
80
|
+
studentName: isPabson ? 'सरस्वती शर्मा' : 'Saraswati Sharma',
|
|
81
|
+
studentId: 'STU-2025-0042',
|
|
82
|
+
gradeLevel: '8',
|
|
83
|
+
lineItems: [
|
|
84
|
+
{
|
|
85
|
+
description: isPabson ? 'ट्यूशन शुल्क — कक्षा ८' : 'Tuition Fee — Grade 8',
|
|
86
|
+
quantity: 1,
|
|
87
|
+
amount: 10000,
|
|
88
|
+
discount: 500,
|
|
89
|
+
taxRate: 13,
|
|
90
|
+
taxAmount: 1235,
|
|
91
|
+
total: 10735,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
description: isPabson ? 'पुस्तकालय शुल्क' : 'Library Fee',
|
|
95
|
+
quantity: 1,
|
|
96
|
+
amount: 500,
|
|
97
|
+
discount: 0,
|
|
98
|
+
taxRate: 0,
|
|
99
|
+
taxAmount: 0,
|
|
100
|
+
total: 500,
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
subtotal: 10500,
|
|
104
|
+
taxTotal: 1235,
|
|
105
|
+
discountTotal: 500,
|
|
106
|
+
grandTotal: 11235,
|
|
107
|
+
amountPaid: 0,
|
|
108
|
+
amountDue: 11235,
|
|
109
|
+
currency: isPabson ? 'NPR' : 'USD',
|
|
110
|
+
status: 'issued',
|
|
111
|
+
notes: isPabson
|
|
112
|
+
? 'कृपया भुक्तानी मिति भित्र भुक्तानी गर्नुहोला।'
|
|
113
|
+
: 'Please pay by the due date to avoid late fees.',
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 13 configurable fields surfaced in the C.2.4 editor. Adding a field here =
|
|
118
|
+
* one more form section appears in the editor, no editor code change required.
|
|
119
|
+
*
|
|
120
|
+
* Field IDs are dot-paths into `InvoiceTemplateConfig`. Editor RHF Controllers
|
|
121
|
+
* register at exactly these paths so the form state shape matches the config
|
|
122
|
+
* shape — `Object.assign(template, formState)` is a one-line apply on save.
|
|
123
|
+
*/
|
|
124
|
+
const invoiceConfigurableFields = [
|
|
125
|
+
// Header (5 fields)
|
|
126
|
+
{ path: 'header.showLogo', type: 'toggle', labelKey: 'field.header.showLogo' },
|
|
127
|
+
{ path: 'header.showSchoolName', type: 'toggle', labelKey: 'field.header.showSchoolName' },
|
|
128
|
+
{ path: 'header.showSchoolAddress', type: 'toggle', labelKey: 'field.header.showSchoolAddress' },
|
|
129
|
+
{ path: 'header.showContact', type: 'toggle', labelKey: 'field.header.showContact' },
|
|
130
|
+
{ path: 'header.tagline', type: 'text', labelKey: 'field.header.tagline' },
|
|
131
|
+
// Line item columns (3 toggleable; description/amount/total always-on)
|
|
132
|
+
{ path: 'lineItemColumns.quantity', type: 'toggle', labelKey: 'field.lineItems.quantity' },
|
|
133
|
+
{ path: 'lineItemColumns.discount', type: 'toggle', labelKey: 'field.lineItems.discount' },
|
|
134
|
+
{ path: 'lineItemColumns.taxRate', type: 'toggle', labelKey: 'field.lineItems.taxRate' },
|
|
135
|
+
{ path: 'lineItemColumns.taxAmount', type: 'toggle', labelKey: 'field.lineItems.taxAmount' },
|
|
136
|
+
// Totals (3 toggleable)
|
|
137
|
+
{ path: 'totalsSection.showSubtotal', type: 'toggle', labelKey: 'field.totals.showSubtotal' },
|
|
138
|
+
{ path: 'totalsSection.showTaxTotal', type: 'toggle', labelKey: 'field.totals.showTaxTotal' },
|
|
139
|
+
{ path: 'totalsSection.showDiscountTotal', type: 'toggle', labelKey: 'field.totals.showDiscountTotal' },
|
|
140
|
+
// Localization (2)
|
|
141
|
+
{
|
|
142
|
+
path: 'dateFormat',
|
|
143
|
+
type: 'select',
|
|
144
|
+
labelKey: 'field.dateFormat',
|
|
145
|
+
options: ['gregorian', 'bikram_sambat', 'dual'],
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
exports.invoiceDescriptor = {
|
|
149
|
+
docType: 'INVOICE',
|
|
150
|
+
i18nNamespace: 'invoice',
|
|
151
|
+
Component: InvoicePdf_1.InvoicePdf,
|
|
152
|
+
defaults: invoiceDefaults,
|
|
153
|
+
sampleData: invoiceSampleData,
|
|
154
|
+
configurableFields: invoiceConfigurableFields,
|
|
155
|
+
};
|
|
156
|
+
// Self-register at module load. Consumers only need
|
|
157
|
+
// `import '@aibrains/pdf-renderer/descriptors/invoice'` (or transitive via
|
|
158
|
+
// the package index) for `getDescriptor('INVOICE')` to resolve.
|
|
159
|
+
(0, registry_1.registerDescriptor)(exports.invoiceDescriptor);
|
|
160
|
+
//# sourceMappingURL=invoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice.js","sourceRoot":"","sources":["../../src/descriptors/invoice.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,wDAA2G;AA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mB;IACnB;QACE,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,kBAAkB;QAC5B,OAAO,EAAE,CAAC,WAAW,EAAE,eAAe,EAAE,MAAM,CAAU;KACzD;CACF,CAAC;AAEW,QAAA,iBAAiB,GAAmE;IAC/F,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,SAAS;IACxB,SAAS,EAAE,uBAAU;IACrB,QAAQ,EAAE,eAAe;IACzB,UAAU,EAAE,iBAAiB;IAC7B,kBAAkB,EAAE,yBAAyB;CAC9C,CAAC;AAEF,oDAAoD;AACpD,2EAA2E;AAC3E,gEAAgE;AAChE,IAAA,6BAAkB,EAAC,yBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Singleton registry of template descriptors, keyed by `DocType`.
|
|
3
|
+
*
|
|
4
|
+
* Each `descriptors/{doc-type}.ts` file performs a side-effect at module load:
|
|
5
|
+
*
|
|
6
|
+
* import { registerDescriptor } from '../descriptors/registry';
|
|
7
|
+
* registerDescriptor(myDescriptor);
|
|
8
|
+
*
|
|
9
|
+
* The editor UI and render endpoints look up descriptors by `getDescriptor`.
|
|
10
|
+
* Adding a new doc type = adding a new file that calls `registerDescriptor`;
|
|
11
|
+
* NO change to the editor, the registry, or any consumer is needed.
|
|
12
|
+
*
|
|
13
|
+
* The registry deliberately uses module-singleton state. Tests can reset it
|
|
14
|
+
* via `_clearRegistryForTest`.
|
|
15
|
+
*/
|
|
16
|
+
import type { DocType, PdfTemplateConfig, TemplateDescriptor } from './types';
|
|
17
|
+
/**
|
|
18
|
+
* Register a descriptor. Throws on duplicate `docType` — each doc type
|
|
19
|
+
* registers exactly once. Catching the duplicate at registration time
|
|
20
|
+
* surfaces accidental double-imports (e.g., two paths both importing
|
|
21
|
+
* `descriptors/invoice.ts`) as a loud error rather than silent override.
|
|
22
|
+
*/
|
|
23
|
+
export declare function registerDescriptor<TData, TConfig extends PdfTemplateConfig>(descriptor: TemplateDescriptor<TData, TConfig>): void;
|
|
24
|
+
/**
|
|
25
|
+
* Look up a descriptor by `docType`. Throws with a helpful message listing
|
|
26
|
+
* the known docTypes if the requested one isn't registered — guards against
|
|
27
|
+
* typos at endpoint wire-up time.
|
|
28
|
+
*
|
|
29
|
+
* Generics: callers that know the concrete `TData` + `TConfig` for the docType
|
|
30
|
+
* can supply them to get a typed descriptor back. Callers that don't (e.g.,
|
|
31
|
+
* the editor UI iterating over all doc types) get the default
|
|
32
|
+
* `unknown / PdfTemplateConfig` shape and access only the descriptor-level
|
|
33
|
+
* metadata (configurableFields, defaults, sampleData).
|
|
34
|
+
*/
|
|
35
|
+
export declare function getDescriptor<TData = unknown, TConfig extends PdfTemplateConfig = PdfTemplateConfig>(docType: DocType): TemplateDescriptor<TData, TConfig>;
|
|
36
|
+
/**
|
|
37
|
+
* Return the list of currently-registered doc types. Used by the editor's
|
|
38
|
+
* settings page to enumerate template cards.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getRegisteredDocTypes(): readonly DocType[];
|
|
41
|
+
/**
|
|
42
|
+
* Check whether a descriptor is registered without throwing. Useful for the
|
|
43
|
+
* editor when it wants to render disabled cards for not-yet-shipped doc
|
|
44
|
+
* types.
|
|
45
|
+
*/
|
|
46
|
+
export declare function hasDescriptor(docType: DocType): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Test-only escape hatch. Clears the registry so each spec file starts
|
|
49
|
+
* clean. Not exported from the public package surface.
|
|
50
|
+
*/
|
|
51
|
+
export declare function _clearRegistryForTest(): void;
|
|
52
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/descriptors/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAUjB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,SAAS,iBAAiB,EACzE,UAAU,EAAE,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,GAC7C,IAAI,CAaN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,KAAK,GAAG,OAAO,EACf,OAAO,SAAS,iBAAiB,GAAG,iBAAiB,EACrD,OAAO,EAAE,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAWtD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,SAAS,OAAO,EAAE,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Singleton registry of template descriptors, keyed by `DocType`.
|
|
4
|
+
*
|
|
5
|
+
* Each `descriptors/{doc-type}.ts` file performs a side-effect at module load:
|
|
6
|
+
*
|
|
7
|
+
* import { registerDescriptor } from '../descriptors/registry';
|
|
8
|
+
* registerDescriptor(myDescriptor);
|
|
9
|
+
*
|
|
10
|
+
* The editor UI and render endpoints look up descriptors by `getDescriptor`.
|
|
11
|
+
* Adding a new doc type = adding a new file that calls `registerDescriptor`;
|
|
12
|
+
* NO change to the editor, the registry, or any consumer is needed.
|
|
13
|
+
*
|
|
14
|
+
* The registry deliberately uses module-singleton state. Tests can reset it
|
|
15
|
+
* via `_clearRegistryForTest`.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.registerDescriptor = registerDescriptor;
|
|
19
|
+
exports.getDescriptor = getDescriptor;
|
|
20
|
+
exports.getRegisteredDocTypes = getRegisteredDocTypes;
|
|
21
|
+
exports.hasDescriptor = hasDescriptor;
|
|
22
|
+
exports._clearRegistryForTest = _clearRegistryForTest;
|
|
23
|
+
const REGISTRY = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* Register a descriptor. Throws on duplicate `docType` — each doc type
|
|
26
|
+
* registers exactly once. Catching the duplicate at registration time
|
|
27
|
+
* surfaces accidental double-imports (e.g., two paths both importing
|
|
28
|
+
* `descriptors/invoice.ts`) as a loud error rather than silent override.
|
|
29
|
+
*/
|
|
30
|
+
function registerDescriptor(descriptor) {
|
|
31
|
+
if (REGISTRY.has(descriptor.docType)) {
|
|
32
|
+
throw new Error(`[pdf-renderer] Duplicate descriptor registration for docType '${descriptor.docType}'. ` +
|
|
33
|
+
`Each docType must register exactly once. Check for duplicate imports of the same descriptor file.`);
|
|
34
|
+
}
|
|
35
|
+
// Double-cast through `unknown` is required because TS can't directly relate
|
|
36
|
+
// `TemplateDescriptor<TData, TConfig>` to `TemplateDescriptor<unknown, PdfTemplateConfig>`
|
|
37
|
+
// — the generic param positions are invariant. The store-as-unknown /
|
|
38
|
+
// cast-back-at-retrieval pattern is intentional; getDescriptor does the
|
|
39
|
+
// matching reverse cast.
|
|
40
|
+
REGISTRY.set(descriptor.docType, descriptor);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Look up a descriptor by `docType`. Throws with a helpful message listing
|
|
44
|
+
* the known docTypes if the requested one isn't registered — guards against
|
|
45
|
+
* typos at endpoint wire-up time.
|
|
46
|
+
*
|
|
47
|
+
* Generics: callers that know the concrete `TData` + `TConfig` for the docType
|
|
48
|
+
* can supply them to get a typed descriptor back. Callers that don't (e.g.,
|
|
49
|
+
* the editor UI iterating over all doc types) get the default
|
|
50
|
+
* `unknown / PdfTemplateConfig` shape and access only the descriptor-level
|
|
51
|
+
* metadata (configurableFields, defaults, sampleData).
|
|
52
|
+
*/
|
|
53
|
+
function getDescriptor(docType) {
|
|
54
|
+
const descriptor = REGISTRY.get(docType);
|
|
55
|
+
if (!descriptor) {
|
|
56
|
+
const known = [...REGISTRY.keys()];
|
|
57
|
+
throw new Error(`[pdf-renderer] No descriptor registered for docType '${docType}'. ` +
|
|
58
|
+
`Known: ${known.length > 0 ? known.join(', ') : '(none)'}.`);
|
|
59
|
+
}
|
|
60
|
+
// See registerDescriptor — this is the matching cast on the retrieval side.
|
|
61
|
+
return descriptor;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Return the list of currently-registered doc types. Used by the editor's
|
|
65
|
+
* settings page to enumerate template cards.
|
|
66
|
+
*/
|
|
67
|
+
function getRegisteredDocTypes() {
|
|
68
|
+
return [...REGISTRY.keys()];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Check whether a descriptor is registered without throwing. Useful for the
|
|
72
|
+
* editor when it wants to render disabled cards for not-yet-shipped doc
|
|
73
|
+
* types.
|
|
74
|
+
*/
|
|
75
|
+
function hasDescriptor(docType) {
|
|
76
|
+
return REGISTRY.has(docType);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Test-only escape hatch. Clears the registry so each spec file starts
|
|
80
|
+
* clean. Not exported from the public package surface.
|
|
81
|
+
*/
|
|
82
|
+
function _clearRegistryForTest() {
|
|
83
|
+
REGISTRY.clear();
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/descriptors/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAsBH,gDAeC;AAaD,sCAcC;AAMD,sDAEC;AAOD,sCAEC;AAMD,sDAEC;AA3ED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA8B,CAAC;AAEvD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAChC,UAA8C;IAE9C,IAAI,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,iEAAiE,UAAU,CAAC,OAAO,KAAK;YACtF,mGAAmG,CACtG,CAAC;IACJ,CAAC;IACD,6EAA6E;IAC7E,2FAA2F;IAC3F,sEAAsE;IACtE,wEAAwE;IACxE,yBAAyB;IACzB,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,UAA0C,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,aAAa,CAG3B,OAAgB;IAChB,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,KAAK;YAClE,UAAU,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,CAC9D,CAAC;IACJ,CAAC;IACD,4EAA4E;IAC5E,OAAO,UAA2D,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,SAAgB,qBAAqB;IACnC,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAgB;IAC5C,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,SAAgB,qBAAqB;IACnC,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type contracts for the TemplateDescriptor registry.
|
|
3
|
+
*
|
|
4
|
+
* A `TemplateDescriptor<TData, TConfig>` is the unit of extensibility in this
|
|
5
|
+
* library. Each future doc type (invoice, receipt, report card, admit card,
|
|
6
|
+
* ID card, certificate, …) ships exactly one descriptor file that registers
|
|
7
|
+
* itself at module load. The editor UI and per-domain render endpoints both
|
|
8
|
+
* look up descriptors by `docType` — neither needs to import the document
|
|
9
|
+
* components directly.
|
|
10
|
+
*
|
|
11
|
+
* Design source of truth: docs/pilot-greenlight/c-epic-pdf-generation-design.md §5.2.
|
|
12
|
+
*/
|
|
13
|
+
import type * as React from 'react';
|
|
14
|
+
import type { ImageSource } from '../core/fonts';
|
|
15
|
+
import type { Lang } from '../core/i18n';
|
|
16
|
+
/**
|
|
17
|
+
* Document types known to the renderer. Each value corresponds to exactly
|
|
18
|
+
* one descriptor registration. Extend this union when adding a new doc type.
|
|
19
|
+
*/
|
|
20
|
+
export type DocType = 'INVOICE' | 'RECEIPT' | 'REPORT_CARD' | 'ADMIT_CARD' | 'TRANSCRIPT' | 'STUDENT_ID_CARD' | 'BONAFIDE_CERTIFICATE' | 'TRANSFER_CERTIFICATE' | 'HALL_TICKET' | 'FEE_STATEMENT' | 'ATTENDANCE_SHEET' | 'MARK_LIST';
|
|
21
|
+
/**
|
|
22
|
+
* Tenant archetype the renderer recognizes when computing defaults.
|
|
23
|
+
* Locked here to match `@aibrains/shared-types` Archetype enum. Reserved
|
|
24
|
+
* archetypes (`CBSE_IN`, `NAIS_US`, `GEMS_UAE`) are accepted in the type
|
|
25
|
+
* but a descriptor's `defaults(archetype, …)` SHOULD fall back to the
|
|
26
|
+
* GENERIC profile for any value it doesn't explicitly handle — V1 only
|
|
27
|
+
* exercises `'PABSON'` and `'GENERIC'`.
|
|
28
|
+
*/
|
|
29
|
+
export type Archetype = 'PABSON' | 'GENERIC' | 'CBSE_IN' | 'NAIS_US' | 'GEMS_UAE';
|
|
30
|
+
/**
|
|
31
|
+
* Minimal branding shape consumed by document Components.
|
|
32
|
+
*
|
|
33
|
+
* Templates accept this as `branding` and forward selected fields to the
|
|
34
|
+
* `BrandedHeader` / `SignatureLine` / `Watermark` primitives. Local to the
|
|
35
|
+
* renderer; consumers map `@aibrains/shared-types`'s `SchoolBranding` to
|
|
36
|
+
* this shape at the endpoint boundary (Sprint C.0.5 + C.1).
|
|
37
|
+
*
|
|
38
|
+
* Property order is alphabetical to keep the type readable as it grows.
|
|
39
|
+
*/
|
|
40
|
+
export interface PdfBranding {
|
|
41
|
+
accentColor?: string;
|
|
42
|
+
addressLines?: string[];
|
|
43
|
+
email?: string;
|
|
44
|
+
formalName?: string;
|
|
45
|
+
letterheadBackgroundSrc?: ImageSource;
|
|
46
|
+
logoSrc?: ImageSource;
|
|
47
|
+
panNumber?: string;
|
|
48
|
+
phone?: string;
|
|
49
|
+
primaryColor?: string;
|
|
50
|
+
principalSignatureSrc?: ImageSource;
|
|
51
|
+
schoolName?: string;
|
|
52
|
+
tagline?: string;
|
|
53
|
+
vatNumber?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Minimal locale + regional settings consumed by document Components.
|
|
57
|
+
* Sourced from `WorkspaceSettings` + `SchoolConfiguration` in production;
|
|
58
|
+
* the descriptor doesn't care which layer of the precedence chain produced
|
|
59
|
+
* each value.
|
|
60
|
+
*/
|
|
61
|
+
export interface PdfLocaleSettings {
|
|
62
|
+
/** BCP 47 — e.g., 'en-US', 'ne-NP'. */
|
|
63
|
+
defaultLocale: string;
|
|
64
|
+
/** ISO 4217 — e.g., 'NPR', 'USD', 'INR'. */
|
|
65
|
+
defaultCurrency: string;
|
|
66
|
+
defaultCalendarSystem: 'gregorian' | 'bikram_sambat';
|
|
67
|
+
/** IANA timezone string. */
|
|
68
|
+
defaultTimeZone?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The shared base config every PDF template has. Per-doc-type config (the
|
|
72
|
+
* `TConfig` generic on `TemplateDescriptor`) extends this with
|
|
73
|
+
* domain-specific options — e.g., an `InvoiceTemplateConfig` adds
|
|
74
|
+
* `lineItemColumns` + `totalsSection`.
|
|
75
|
+
*/
|
|
76
|
+
export interface PdfTemplateConfig {
|
|
77
|
+
pageSize: 'A4' | 'A5' | 'LETTER';
|
|
78
|
+
orientation: 'portrait' | 'landscape';
|
|
79
|
+
margins: {
|
|
80
|
+
top: number;
|
|
81
|
+
right: number;
|
|
82
|
+
bottom: number;
|
|
83
|
+
left: number;
|
|
84
|
+
};
|
|
85
|
+
header: {
|
|
86
|
+
showLogo: boolean;
|
|
87
|
+
showSchoolName: boolean;
|
|
88
|
+
showSchoolAddress: boolean;
|
|
89
|
+
showContact: boolean;
|
|
90
|
+
tagline?: string;
|
|
91
|
+
};
|
|
92
|
+
footer: {
|
|
93
|
+
text?: string;
|
|
94
|
+
showPageNumbers: boolean;
|
|
95
|
+
};
|
|
96
|
+
dateFormat: 'gregorian' | 'bikram_sambat' | 'dual';
|
|
97
|
+
numberFormat: 'south-asian' | 'western' | 'auto-from-workspace';
|
|
98
|
+
currencyDisplay: 'symbol' | 'iso-code' | 'name';
|
|
99
|
+
/**
|
|
100
|
+
* At minimum one entry; two entries enables dual-language label rendering
|
|
101
|
+
* (e.g., `['en', 'ne']` → "Subtotal" + "उप-योग" stacked or inline).
|
|
102
|
+
*
|
|
103
|
+
* Encoded as a **non-empty tuple type** so the compiler rejects empty
|
|
104
|
+
* arrays at the call site — the runtime invariant "every template must
|
|
105
|
+
* have at least one label language" is enforced by the type itself, not
|
|
106
|
+
* by a runtime check buried in the renderer.
|
|
107
|
+
*/
|
|
108
|
+
labelLanguages: readonly [Lang, ...Lang[]];
|
|
109
|
+
/** Per-template branding overrides — rare; most templates inherit school branding. */
|
|
110
|
+
brandingOverrides?: Partial<PdfBranding>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A single configurable form field surfaced in the template editor UI.
|
|
114
|
+
*
|
|
115
|
+
* The editor reads each descriptor's `configurableFields[]` and generates
|
|
116
|
+
* form sections automatically. **Adding a new editable field = appending one
|
|
117
|
+
* entry here; the editor needs no code change.** This is the property that
|
|
118
|
+
* makes the editor work uniformly across all 12+ planned doc types.
|
|
119
|
+
*/
|
|
120
|
+
export interface ConfigurableField {
|
|
121
|
+
/**
|
|
122
|
+
* Dot path into `TConfig` for this field's value.
|
|
123
|
+
* Example: `'lineItemColumns.discount'`, `'header.tagline'`, `'pageSize'`.
|
|
124
|
+
*/
|
|
125
|
+
path: string;
|
|
126
|
+
/** Form-input type. The editor maps each to a primitive from `@edforge/forms`. */
|
|
127
|
+
type: 'text' | 'textarea' | 'toggle' | 'select' | 'multiselect' | 'color' | 'file' | 'number';
|
|
128
|
+
/** i18n key for the field label. Resolved per current editor locale. */
|
|
129
|
+
labelKey: string;
|
|
130
|
+
/** i18n key for an optional help/description tooltip. */
|
|
131
|
+
descriptionKey?: string;
|
|
132
|
+
/** Choices for `select` / `multiselect`. */
|
|
133
|
+
options?: readonly string[];
|
|
134
|
+
/** File `accept` attribute for `file` type. Example: `'.png,.jpg,.svg'`. */
|
|
135
|
+
accept?: string;
|
|
136
|
+
/** Max file size in bytes for `file` type. */
|
|
137
|
+
maxSizeBytes?: number;
|
|
138
|
+
/** Minimum items for `multiselect`. */
|
|
139
|
+
minItems?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Conditional display: only render this field when another field's value
|
|
142
|
+
* equals the given value. Useful for toggling sub-sections on/off.
|
|
143
|
+
*/
|
|
144
|
+
visibleIf?: {
|
|
145
|
+
path: string;
|
|
146
|
+
equals: unknown;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Props every document Component accepts. Stable across all doc types so the
|
|
151
|
+
* editor and render endpoints don't need per-doc-type adapter code.
|
|
152
|
+
*/
|
|
153
|
+
export interface DocumentComponentProps<TData, TConfig extends PdfTemplateConfig> {
|
|
154
|
+
data: TData;
|
|
155
|
+
template: TConfig;
|
|
156
|
+
branding: PdfBranding;
|
|
157
|
+
settings: PdfLocaleSettings;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The contract every doc-type descriptor satisfies.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* import { registerDescriptor, type TemplateDescriptor } from '@aibrains/pdf-renderer';
|
|
164
|
+
*
|
|
165
|
+
* const invoiceDescriptor: TemplateDescriptor<Invoice, InvoiceTemplateConfig> = {
|
|
166
|
+
* docType: 'INVOICE',
|
|
167
|
+
* i18nNamespace: 'invoice',
|
|
168
|
+
* Component: InvoicePdf,
|
|
169
|
+
* defaults: (archetype, locale) => ({ ... }),
|
|
170
|
+
* sampleData: (archetype, locale) => ({ ... }),
|
|
171
|
+
* configurableFields: [ ... ],
|
|
172
|
+
* };
|
|
173
|
+
*
|
|
174
|
+
* registerDescriptor(invoiceDescriptor);
|
|
175
|
+
*/
|
|
176
|
+
export interface TemplateDescriptor<TData, TConfig extends PdfTemplateConfig> {
|
|
177
|
+
/** Globally unique discriminator (e.g., `'INVOICE'`, `'REPORT_CARD'`). */
|
|
178
|
+
docType: DocType;
|
|
179
|
+
/**
|
|
180
|
+
* i18n namespace this descriptor's labels live under. Translations are
|
|
181
|
+
* bundled in `src/i18n/{lang}/{namespace}.json` and loaded by the editor
|
|
182
|
+
* + the document component.
|
|
183
|
+
*/
|
|
184
|
+
i18nNamespace: string;
|
|
185
|
+
/**
|
|
186
|
+
* The React component that renders the document. Both
|
|
187
|
+
* `renderToBuffer` (Node) and `<PDFViewer>` (browser) invoke this with
|
|
188
|
+
* the standard four props.
|
|
189
|
+
*/
|
|
190
|
+
Component: React.ComponentType<DocumentComponentProps<TData, TConfig>>;
|
|
191
|
+
/**
|
|
192
|
+
* Returns the default config for a fresh template, parameterized by
|
|
193
|
+
* archetype + locale. For PABSON tenants this should produce
|
|
194
|
+
* BS+AD dual dates, EN+NE labels, ne-NP locale, NPR, south-asian numbers
|
|
195
|
+
* — sensible defaults so the lazy-seed path produces a usable PDF
|
|
196
|
+
* without any operator action.
|
|
197
|
+
*/
|
|
198
|
+
defaults(archetype: Archetype, locale: string): TConfig;
|
|
199
|
+
/**
|
|
200
|
+
* Returns mock data for the editor's live preview when the operator
|
|
201
|
+
* hasn't yet selected a real document to preview against.
|
|
202
|
+
*/
|
|
203
|
+
sampleData(archetype: Archetype, locale: string): TData;
|
|
204
|
+
/** Editor-form-rendering metadata. The order is the field order in the UI. */
|
|
205
|
+
configurableFields: readonly ConfigurableField[];
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/descriptors/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,OAAO,GACf,SAAS,GACT,SAAS,GACT,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,sBAAsB,GACtB,sBAAsB,GACtB,aAAa,GACb,eAAe,GACf,kBAAkB,GAClB,WAAW,CAAC;AAEhB;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAOlF;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB,CAAC,EAAE,WAAW,CAAC;IACtC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,WAAW,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,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AE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACxD,8EAA8E;IAC9E,kBAAkB,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type contracts for the TemplateDescriptor registry.
|
|
4
|
+
*
|
|
5
|
+
* A `TemplateDescriptor<TData, TConfig>` is the unit of extensibility in this
|
|
6
|
+
* library. Each future doc type (invoice, receipt, report card, admit card,
|
|
7
|
+
* ID card, certificate, …) ships exactly one descriptor file that registers
|
|
8
|
+
* itself at module load. The editor UI and per-domain render endpoints both
|
|
9
|
+
* look up descriptors by `docType` — neither needs to import the document
|
|
10
|
+
* components directly.
|
|
11
|
+
*
|
|
12
|
+
* Design source of truth: docs/pilot-greenlight/c-epic-pdf-generation-design.md §5.2.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/descriptors/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<InvoicePdf>` — Sprint C.1.1 first document component for the renderer.
|
|
3
|
+
*
|
|
4
|
+
* Composes the C.0 primitives (Document + Page + BrandedHeader + BrandedFooter
|
|
5
|
+
* + Watermark) with the C.0 components (KeyValueTable + LineItemTable +
|
|
6
|
+
* TotalsBlock + SignatureLine). Zero new primitives — this whole document is
|
|
7
|
+
* a composition exercise.
|
|
8
|
+
*
|
|
9
|
+
* Dual-language label rendering: when `template.labelLanguages.length === 2`,
|
|
10
|
+
* each label renders STACKED VERTICALLY (primary in regular size, secondary
|
|
11
|
+
* at 80% size below). PABSON V1 default is `['en', 'ne']`. For single-language
|
|
12
|
+
* templates the secondary line is omitted entirely.
|
|
13
|
+
*
|
|
14
|
+
* Devanagari font selection is automatic via `pickFontFamily(text)` inside the
|
|
15
|
+
* primitive components — no work required by this document.
|
|
16
|
+
*/
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
import { type LineItem } from '../components/LineItemTable';
|
|
19
|
+
import type { DocumentComponentProps, PdfTemplateConfig } from '../descriptors/types';
|
|
20
|
+
/**
|
|
21
|
+
* Per-doc-type config for invoices. Extends the shared `PdfTemplateConfig`
|
|
22
|
+
* with line-item column visibility + totals-block visibility — both editor-
|
|
23
|
+
* configurable via `invoiceDescriptor.configurableFields`.
|
|
24
|
+
*/
|
|
25
|
+
export interface InvoiceTemplateConfig extends PdfTemplateConfig {
|
|
26
|
+
lineItemColumns: {
|
|
27
|
+
description: boolean;
|
|
28
|
+
quantity: boolean;
|
|
29
|
+
amount: boolean;
|
|
30
|
+
discount: boolean;
|
|
31
|
+
taxRate: boolean;
|
|
32
|
+
taxAmount: boolean;
|
|
33
|
+
total: boolean;
|
|
34
|
+
};
|
|
35
|
+
totalsSection: {
|
|
36
|
+
showSubtotal: boolean;
|
|
37
|
+
showTaxTotal: boolean;
|
|
38
|
+
showDiscountTotal: boolean;
|
|
39
|
+
showAmountPaid: boolean;
|
|
40
|
+
showAmountDue: boolean;
|
|
41
|
+
};
|
|
42
|
+
footer: PdfTemplateConfig['footer'] & {
|
|
43
|
+
showSignatureLine: boolean;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Invoice data shape the document component renders. This is the minimum
|
|
48
|
+
* surface the renderer needs — the actual @aibrains/shared-types Invoice
|
|
49
|
+
* has more fields (taxSummary, statusHistory, etc.) that the renderer
|
|
50
|
+
* ignores. Endpoint callers can pass the full Invoice; structural typing
|
|
51
|
+
* lets the extra fields through harmlessly.
|
|
52
|
+
*/
|
|
53
|
+
export interface InvoiceDocumentData {
|
|
54
|
+
invoiceNumber: string;
|
|
55
|
+
issuedDate: string;
|
|
56
|
+
dueDate: string;
|
|
57
|
+
academicYear?: string;
|
|
58
|
+
billingPeriod?: string;
|
|
59
|
+
studentName: string;
|
|
60
|
+
studentId?: string;
|
|
61
|
+
gradeLevel?: string;
|
|
62
|
+
lineItems: LineItem[];
|
|
63
|
+
subtotal: number;
|
|
64
|
+
taxTotal: number;
|
|
65
|
+
discountTotal: number;
|
|
66
|
+
grandTotal: number;
|
|
67
|
+
amountPaid: number;
|
|
68
|
+
amountDue: number;
|
|
69
|
+
currency: string;
|
|
70
|
+
status: 'draft' | 'issued' | 'partially_paid' | 'paid' | 'overdue' | 'cancelled' | 'written_off';
|
|
71
|
+
notes?: string;
|
|
72
|
+
}
|
|
73
|
+
export declare const InvoicePdf: React.FC<DocumentComponentProps<InvoiceDocumentData, InvoiceTemplateConfig>>;
|
|
74
|
+
//# sourceMappingURL=InvoicePdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoicePdf.d.ts","sourceRoot":"","sources":["../../src/documents/InvoicePdf.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAO3E,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,eAAe,EAAE;QACf,WAAW,EAAE,OAAO,CAAC;QACrB,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,EAAE,OAAO,CAAC;QAChB,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;IACF,aAAa,EAAE;QACb,YAAY,EAAE,OAAO,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;QACtB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,cAAc,EAAE,OAAO,CAAC;QACxB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAAG;QACpC,iBAAiB,EAAE,OAAO,CAAC;KAC5B,CAAC;CACH;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,CAAC;IACjG,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAkFD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAsKnG,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvoicePdf = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const renderer_1 = require("@react-pdf/renderer");
|
|
6
|
+
const Document_1 = require("../primitives/Document");
|
|
7
|
+
const Page_1 = require("../primitives/Page");
|
|
8
|
+
const BrandedHeader_1 = require("../primitives/BrandedHeader");
|
|
9
|
+
const BrandedFooter_1 = require("../primitives/BrandedFooter");
|
|
10
|
+
const Watermark_1 = require("../primitives/Watermark");
|
|
11
|
+
const KeyValueTable_1 = require("../components/KeyValueTable");
|
|
12
|
+
const LineItemTable_1 = require("../components/LineItemTable");
|
|
13
|
+
const TotalsBlock_1 = require("../components/TotalsBlock");
|
|
14
|
+
const SignatureLine_1 = require("../components/SignatureLine");
|
|
15
|
+
const i18n_1 = require("../core/i18n");
|
|
16
|
+
const format_1 = require("../core/format");
|
|
17
|
+
const fonts_1 = require("../core/fonts");
|
|
18
|
+
const theme_1 = require("../core/theme");
|
|
19
|
+
const styles = renderer_1.StyleSheet.create({
|
|
20
|
+
metaBlock: {
|
|
21
|
+
marginTop: theme_1.DEFAULT_SPACING.md,
|
|
22
|
+
marginBottom: theme_1.DEFAULT_SPACING.md,
|
|
23
|
+
},
|
|
24
|
+
sectionTitle: {
|
|
25
|
+
fontSize: theme_1.DEFAULT_FONT_SIZE.md,
|
|
26
|
+
fontWeight: 700,
|
|
27
|
+
color: theme_1.DEFAULT_COLORS.text,
|
|
28
|
+
marginBottom: theme_1.DEFAULT_SPACING.xs,
|
|
29
|
+
},
|
|
30
|
+
sectionTitleSecondary: {
|
|
31
|
+
fontSize: theme_1.DEFAULT_FONT_SIZE.sm,
|
|
32
|
+
color: theme_1.DEFAULT_COLORS.textMuted,
|
|
33
|
+
marginBottom: theme_1.DEFAULT_SPACING.sm,
|
|
34
|
+
},
|
|
35
|
+
notesBlock: {
|
|
36
|
+
marginTop: theme_1.DEFAULT_SPACING.md,
|
|
37
|
+
padding: theme_1.DEFAULT_SPACING.sm,
|
|
38
|
+
backgroundColor: '#F8F9FA',
|
|
39
|
+
borderLeftWidth: 3,
|
|
40
|
+
borderLeftColor: theme_1.DEFAULT_COLORS.border,
|
|
41
|
+
},
|
|
42
|
+
notesLabel: {
|
|
43
|
+
fontSize: theme_1.DEFAULT_FONT_SIZE.sm,
|
|
44
|
+
fontWeight: 700,
|
|
45
|
+
color: theme_1.DEFAULT_COLORS.text,
|
|
46
|
+
marginBottom: theme_1.DEFAULT_SPACING.xs,
|
|
47
|
+
},
|
|
48
|
+
notesText: {
|
|
49
|
+
fontSize: theme_1.DEFAULT_FONT_SIZE.sm,
|
|
50
|
+
color: theme_1.DEFAULT_COLORS.text,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Build a one-line label per the template's labelLanguages. Returns the
|
|
55
|
+
* primary translation; the caller renders the secondary (if present)
|
|
56
|
+
* separately via `buildSecondary`.
|
|
57
|
+
*/
|
|
58
|
+
function buildPrimary(key, langs) {
|
|
59
|
+
return (0, i18n_1.t)('invoice', key, langs[0]);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns the secondary-language label when the template is dual-language,
|
|
63
|
+
* else undefined. The caller renders it stacked below the primary at 80%
|
|
64
|
+
* size with the same family.
|
|
65
|
+
*/
|
|
66
|
+
function buildSecondary(key, langs) {
|
|
67
|
+
return langs.length >= 2 ? (0, i18n_1.t)('invoice', key, langs[1]) : undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Dual-language label for free-form labels (not for the table headers which
|
|
71
|
+
* use a single string and are themselves bilingual via Devanagari font run).
|
|
72
|
+
*/
|
|
73
|
+
const dualLabelStyles = renderer_1.StyleSheet.create({
|
|
74
|
+
primary: {
|
|
75
|
+
fontSize: theme_1.DEFAULT_FONT_SIZE.sm,
|
|
76
|
+
color: theme_1.DEFAULT_COLORS.text,
|
|
77
|
+
},
|
|
78
|
+
secondary: {
|
|
79
|
+
fontSize: theme_1.DEFAULT_FONT_SIZE.sm * 0.8,
|
|
80
|
+
color: theme_1.DEFAULT_COLORS.textMuted,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
/** Stacked dual-language label primitive (small enough to inline here). */
|
|
84
|
+
const DualLabel = ({ primary, secondary }) => ((0, jsx_runtime_1.jsxs)(renderer_1.View, { children: [(0, jsx_runtime_1.jsx)(renderer_1.Text, { style: [dualLabelStyles.primary, { fontFamily: (0, fonts_1.pickFontFamily)(primary) }], children: primary }), secondary && ((0, jsx_runtime_1.jsx)(renderer_1.Text, { style: [dualLabelStyles.secondary, { fontFamily: (0, fonts_1.pickFontFamily)(secondary) }], children: secondary }))] }));
|
|
85
|
+
const InvoicePdf = ({ data, template, branding, settings, }) => {
|
|
86
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
87
|
+
const langs = template.labelLanguages;
|
|
88
|
+
const isDualLang = langs.length >= 2;
|
|
89
|
+
// Number + currency formatters bound once per render
|
|
90
|
+
const numberGrouping = template.numberFormat === 'auto-from-workspace'
|
|
91
|
+
? 'western'
|
|
92
|
+
: template.numberFormat;
|
|
93
|
+
const renderNumber = (v) => (0, format_1.formatNumber)(v !== null && v !== void 0 ? v : 0, numberGrouping);
|
|
94
|
+
// Currency display: shared-types `formatCurrency` exposes `showSymbol` only;
|
|
95
|
+
// map V1 `'symbol'` → showSymbol:true and `'iso-code'`/`'name'` → false (the
|
|
96
|
+
// ISO code prefix is added by the shared-types implementation as the
|
|
97
|
+
// fallback shape). When showSymbol is true the symbol/native symbol is used.
|
|
98
|
+
const renderCurrency = (v) => (0, format_1.formatCurrency)(v, data.currency, {
|
|
99
|
+
locale: settings.defaultLocale,
|
|
100
|
+
showSymbol: template.currencyDisplay === 'symbol',
|
|
101
|
+
});
|
|
102
|
+
// Header label resolution — uses BrandedHeader's own config shape
|
|
103
|
+
const headerConfig = {
|
|
104
|
+
showLogo: template.header.showLogo,
|
|
105
|
+
showSchoolName: template.header.showSchoolName,
|
|
106
|
+
showSchoolAddress: template.header.showSchoolAddress,
|
|
107
|
+
showContact: template.header.showContact,
|
|
108
|
+
tagline: template.header.tagline,
|
|
109
|
+
primaryColor: (_a = template.brandingOverrides) === null || _a === void 0 ? void 0 : _a.primaryColor,
|
|
110
|
+
};
|
|
111
|
+
const headerBranding = {
|
|
112
|
+
logoSrc: (_c = (_b = template.brandingOverrides) === null || _b === void 0 ? void 0 : _b.logoSrc) !== null && _c !== void 0 ? _c : branding.logoSrc,
|
|
113
|
+
schoolName: branding.schoolName,
|
|
114
|
+
addressLines: (_e = (_d = template.brandingOverrides) === null || _d === void 0 ? void 0 : _d.addressLines) !== null && _e !== void 0 ? _e : branding.addressLines,
|
|
115
|
+
phone: branding.phone,
|
|
116
|
+
email: branding.email,
|
|
117
|
+
};
|
|
118
|
+
// Watermark on draft / cancelled invoices
|
|
119
|
+
const watermarkLabel = data.status === 'draft'
|
|
120
|
+
? (0, i18n_1.t)('invoice', 'watermarkDraft', langs[0])
|
|
121
|
+
: data.status === 'cancelled'
|
|
122
|
+
? (0, i18n_1.t)('invoice', 'watermarkCancelled', langs[0])
|
|
123
|
+
: undefined;
|
|
124
|
+
// KeyValueTable expects pre-formatted strings; build them with dual-lang
|
|
125
|
+
// labels rendered ABOVE each value would require a custom row primitive,
|
|
126
|
+
// so V1 uses primary-language labels in the metadata table and emits
|
|
127
|
+
// a small bilingual title above it. Acceptable trade-off; the table
|
|
128
|
+
// itself stays in C.0's existing API.
|
|
129
|
+
const metadataEntries = [
|
|
130
|
+
{ label: buildPrimary('invoiceNumber', langs), value: data.invoiceNumber },
|
|
131
|
+
{ label: buildPrimary('issuedDate', langs), value: (0, format_1.formatDate)(data.issuedDate, template.dateFormat) },
|
|
132
|
+
{ label: buildPrimary('dueDate', langs), value: (0, format_1.formatDate)(data.dueDate, template.dateFormat) },
|
|
133
|
+
{ label: buildPrimary('studentName', langs), value: data.studentName },
|
|
134
|
+
{ label: buildPrimary('gradeLevel', langs), value: data.gradeLevel },
|
|
135
|
+
{ label: buildPrimary('academicYear', langs), value: data.academicYear },
|
|
136
|
+
{ label: buildPrimary('billingPeriod', langs), value: data.billingPeriod },
|
|
137
|
+
];
|
|
138
|
+
return ((0, jsx_runtime_1.jsx)(Document_1.Document, { title: `Invoice ${data.invoiceNumber}`, subject: "Invoice", children: (0, jsx_runtime_1.jsxs)(Page_1.Page, { size: template.pageSize, orientation: template.orientation, margins: template.margins, children: [watermarkLabel && (0, jsx_runtime_1.jsx)(Watermark_1.Watermark, { text: watermarkLabel }), (0, jsx_runtime_1.jsx)(BrandedHeader_1.BrandedHeader, { branding: headerBranding, config: headerConfig }), (0, jsx_runtime_1.jsxs)(renderer_1.View, { style: styles.metaBlock, children: [(0, jsx_runtime_1.jsx)(renderer_1.Text, { style: [styles.sectionTitle, { fontFamily: (0, fonts_1.pickFontFamily)(buildPrimary('title', langs)) }], children: buildPrimary('title', langs) }), isDualLang && ((0, jsx_runtime_1.jsx)(renderer_1.Text, { style: [
|
|
139
|
+
styles.sectionTitleSecondary,
|
|
140
|
+
{ fontFamily: (0, fonts_1.pickFontFamily)((_f = buildSecondary('title', langs)) !== null && _f !== void 0 ? _f : '') },
|
|
141
|
+
], children: buildSecondary('title', langs) })), (0, jsx_runtime_1.jsx)(KeyValueTable_1.KeyValueTable, { entries: metadataEntries })] }), (0, jsx_runtime_1.jsx)(LineItemTable_1.LineItemTable, { items: data.lineItems, columns: template.lineItemColumns, headers: {
|
|
142
|
+
description: buildPrimary('description', langs),
|
|
143
|
+
quantity: buildPrimary('quantity', langs),
|
|
144
|
+
amount: buildPrimary('amount', langs),
|
|
145
|
+
discount: buildPrimary('discount', langs),
|
|
146
|
+
taxRate: buildPrimary('taxRate', langs),
|
|
147
|
+
taxAmount: buildPrimary('taxAmount', langs),
|
|
148
|
+
total: buildPrimary('total', langs),
|
|
149
|
+
}, renderNumber: renderNumber }), (0, jsx_runtime_1.jsx)(TotalsBlock_1.TotalsBlock, { entries: {
|
|
150
|
+
subtotal: data.subtotal,
|
|
151
|
+
taxTotal: data.taxTotal,
|
|
152
|
+
discountTotal: data.discountTotal,
|
|
153
|
+
grandTotal: data.grandTotal,
|
|
154
|
+
amountPaid: data.amountPaid,
|
|
155
|
+
amountDue: data.amountDue,
|
|
156
|
+
}, visibility: {
|
|
157
|
+
showSubtotal: template.totalsSection.showSubtotal,
|
|
158
|
+
showTaxTotal: template.totalsSection.showTaxTotal,
|
|
159
|
+
showDiscountTotal: template.totalsSection.showDiscountTotal,
|
|
160
|
+
showAmountPaid: template.totalsSection.showAmountPaid,
|
|
161
|
+
showAmountDue: template.totalsSection.showAmountDue,
|
|
162
|
+
}, labels: {
|
|
163
|
+
subtotal: buildPrimary('subtotal', langs),
|
|
164
|
+
taxTotal: buildPrimary('totalTax', langs),
|
|
165
|
+
discountTotal: buildPrimary('totalDiscount', langs),
|
|
166
|
+
grandTotal: buildPrimary('grandTotal', langs),
|
|
167
|
+
amountPaid: buildPrimary('amountPaid', langs),
|
|
168
|
+
amountDue: buildPrimary('amountDue', langs),
|
|
169
|
+
}, renderCurrency: renderCurrency }), data.notes && ((0, jsx_runtime_1.jsxs)(renderer_1.View, { style: styles.notesBlock, children: [(0, jsx_runtime_1.jsx)(DualLabel, { primary: buildPrimary('notes', langs), secondary: buildSecondary('notes', langs) }), (0, jsx_runtime_1.jsx)(renderer_1.Text, { style: [styles.notesText, { fontFamily: (0, fonts_1.pickFontFamily)(data.notes) }], children: data.notes.length > 500 ? `${data.notes.slice(0, 500)}…` : data.notes })] })), template.footer.showSignatureLine && ((0, jsx_runtime_1.jsx)(SignatureLine_1.SignatureLine, { caption: (_h = (_g = branding.formalName) !== null && _g !== void 0 ? _g : branding.schoolName) !== null && _h !== void 0 ? _h : '', signatureSrc: branding.principalSignatureSrc, align: "right" })), (0, jsx_runtime_1.jsx)(BrandedFooter_1.BrandedFooter, { text: template.footer.text, showPageNumbers: template.footer.showPageNumbers, lang: langs[0] })] }) }));
|
|
170
|
+
};
|
|
171
|
+
exports.InvoicePdf = InvoicePdf;
|
|
172
|
+
//# sourceMappingURL=InvoicePdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvoicePdf.js","sourceRoot":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|
5
|
+
"dueDate": "Due",
|
|
6
|
+
"academicYear": "Academic Year",
|
|
7
|
+
"billingPeriod": "Billing Period",
|
|
8
|
+
"billedTo": "Billed to",
|
|
9
|
+
"studentName": "Student",
|
|
10
|
+
"studentId": "Student ID",
|
|
11
|
+
"gradeLevel": "Grade",
|
|
12
|
+
"lineItems": "Line items",
|
|
13
|
+
"description": "Description",
|
|
14
|
+
"quantity": "Qty",
|
|
15
|
+
"amount": "Amount",
|
|
16
|
+
"discount": "Discount",
|
|
17
|
+
"taxRate": "Tax %",
|
|
18
|
+
"taxAmount": "Tax",
|
|
19
|
+
"total": "Total",
|
|
20
|
+
"subtotal": "Subtotal",
|
|
21
|
+
"totalTax": "Total tax",
|
|
22
|
+
"totalDiscount": "Total discount",
|
|
23
|
+
"grandTotal": "Grand total",
|
|
24
|
+
"amountPaid": "Paid",
|
|
25
|
+
"amountDue": "Due",
|
|
26
|
+
"status": "Status",
|
|
27
|
+
"notes": "Notes",
|
|
28
|
+
"footerThankYou": "Thank you for your payment.",
|
|
29
|
+
"watermarkDraft": "DRAFT",
|
|
30
|
+
"watermarkCancelled": "CANCELLED"
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "बिल",
|
|
3
|
+
"invoiceNumber": "बिल नं.",
|
|
4
|
+
"issuedDate": "जारी मिति",
|
|
5
|
+
"dueDate": "भुक्तानी मिति",
|
|
6
|
+
"academicYear": "शैक्षिक वर्ष",
|
|
7
|
+
"billingPeriod": "बिलिंग अवधि",
|
|
8
|
+
"billedTo": "बिल प्राप्तकर्ता",
|
|
9
|
+
"studentName": "विद्यार्थीको नाम",
|
|
10
|
+
"studentId": "विद्यार्थी आईडी",
|
|
11
|
+
"gradeLevel": "कक्षा",
|
|
12
|
+
"lineItems": "विवरण",
|
|
13
|
+
"description": "विवरण",
|
|
14
|
+
"quantity": "संख्या",
|
|
15
|
+
"amount": "रकम",
|
|
16
|
+
"discount": "छुट",
|
|
17
|
+
"taxRate": "कर %",
|
|
18
|
+
"taxAmount": "कर",
|
|
19
|
+
"total": "जम्मा",
|
|
20
|
+
"subtotal": "उप-योग",
|
|
21
|
+
"totalTax": "जम्मा कर",
|
|
22
|
+
"totalDiscount": "जम्मा छुट",
|
|
23
|
+
"grandTotal": "जम्मा रकम",
|
|
24
|
+
"amountPaid": "भुक्तानी",
|
|
25
|
+
"amountDue": "बाँकी",
|
|
26
|
+
"status": "स्थिति",
|
|
27
|
+
"notes": "टिप्पणी",
|
|
28
|
+
"footerThankYou": "तपाईंको भुक्तानीको लागि धन्यवाद।",
|
|
29
|
+
"watermarkDraft": "मस्यौदा",
|
|
30
|
+
"watermarkCancelled": "रद्द"
|
|
31
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,18 +4,23 @@
|
|
|
4
4
|
* Sprint C.0.2 ships core utilities (theme tokens, i18n helper, date/currency
|
|
5
5
|
* /number format helpers). Bikram Sambat support comes via `@aibrains/shared-types`.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* - C.0.
|
|
9
|
-
*
|
|
10
|
-
* + reusable components (KeyValueTable, LineItemTable, TotalsBlock,
|
|
11
|
-
* SignatureLine) + Devanagari snapshot tests
|
|
7
|
+
* Shipped:
|
|
8
|
+
* - C.0.2: core utilities (fonts + theme + i18n + format)
|
|
9
|
+
* - C.0.3: layout primitives + reusable components + Devanagari R45 canary
|
|
12
10
|
* - C.0.4: TemplateDescriptor<T> generic + per-docType registry
|
|
13
|
-
*
|
|
11
|
+
* - C.1.1: <InvoicePdf> document + invoice descriptor + invoice i18n
|
|
12
|
+
*
|
|
13
|
+
* Sprint C.1.2+: <ReceiptPdf>, <ReportCardPdf>, …
|
|
14
14
|
*
|
|
15
15
|
* Design source of truth: docs/pilot-greenlight/c-epic-pdf-generation-design.md
|
|
16
16
|
*/
|
|
17
|
-
export declare const PDF_RENDERER_PACKAGE_VERSION = "0.
|
|
17
|
+
export declare const PDF_RENDERER_PACKAGE_VERSION = "0.5.0";
|
|
18
18
|
export * from './core';
|
|
19
19
|
export * from './primitives';
|
|
20
20
|
export * from './components';
|
|
21
|
+
export * from './descriptors';
|
|
22
|
+
import './descriptors/invoice';
|
|
23
|
+
export { InvoicePdf } from './documents/InvoicePdf';
|
|
24
|
+
export type { InvoiceTemplateConfig, InvoiceDocumentData } from './documents/InvoicePdf';
|
|
25
|
+
export { invoiceDescriptor } from './descriptors/invoice';
|
|
21
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,4BAA4B,UAAU,CAAC;AAGpD,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,4BAA4B,UAAU,CAAC;AAGpD,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAM9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* Sprint C.0.2 ships core utilities (theme tokens, i18n helper, date/currency
|
|
6
6
|
* /number format helpers). Bikram Sambat support comes via `@aibrains/shared-types`.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* - C.0.
|
|
10
|
-
*
|
|
11
|
-
* + reusable components (KeyValueTable, LineItemTable, TotalsBlock,
|
|
12
|
-
* SignatureLine) + Devanagari snapshot tests
|
|
8
|
+
* Shipped:
|
|
9
|
+
* - C.0.2: core utilities (fonts + theme + i18n + format)
|
|
10
|
+
* - C.0.3: layout primitives + reusable components + Devanagari R45 canary
|
|
13
11
|
* - C.0.4: TemplateDescriptor<T> generic + per-docType registry
|
|
14
|
-
*
|
|
12
|
+
* - C.1.1: <InvoicePdf> document + invoice descriptor + invoice i18n
|
|
13
|
+
*
|
|
14
|
+
* Sprint C.1.2+: <ReceiptPdf>, <ReportCardPdf>, …
|
|
15
15
|
*
|
|
16
16
|
* Design source of truth: docs/pilot-greenlight/c-epic-pdf-generation-design.md
|
|
17
17
|
*/
|
|
@@ -30,10 +30,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
30
30
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.PDF_RENDERER_PACKAGE_VERSION = void 0;
|
|
34
|
-
exports.PDF_RENDERER_PACKAGE_VERSION = '0.
|
|
35
|
-
//
|
|
33
|
+
exports.invoiceDescriptor = exports.InvoicePdf = exports.PDF_RENDERER_PACKAGE_VERSION = void 0;
|
|
34
|
+
exports.PDF_RENDERER_PACKAGE_VERSION = '0.5.0';
|
|
35
|
+
// Core + primitives + components + descriptor registry from Sprint C.0.
|
|
36
36
|
__exportStar(require("./core"), exports);
|
|
37
37
|
__exportStar(require("./primitives"), exports);
|
|
38
38
|
__exportStar(require("./components"), exports);
|
|
39
|
+
__exportStar(require("./descriptors"), exports);
|
|
40
|
+
// C.1.1 — first concrete document. Importing this module's descriptor file
|
|
41
|
+
// has the side-effect of self-registering it with the registry. Consumers
|
|
42
|
+
// that only `import '@aibrains/pdf-renderer'` (the package root) get
|
|
43
|
+
// `getDescriptor('INVOICE')` working transitively.
|
|
44
|
+
require("./descriptors/invoice");
|
|
45
|
+
var InvoicePdf_1 = require("./documents/InvoicePdf");
|
|
46
|
+
Object.defineProperty(exports, "InvoicePdf", { enumerable: true, get: function () { return InvoicePdf_1.InvoicePdf; } });
|
|
47
|
+
var invoice_1 = require("./descriptors/invoice");
|
|
48
|
+
Object.defineProperty(exports, "invoiceDescriptor", { enumerable: true, get: function () { return invoice_1.invoiceDescriptor; } });
|
|
39
49
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;AAEU,QAAA,4BAA4B,GAAG,OAAO,CAAC;AAEpD,wEAAwE;AACxE,yCAAuB;AACvB,+CAA6B;AAC7B,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;AAEU,QAAA,4BAA4B,GAAG,OAAO,CAAC;AAEpD,wEAAwE;AACxE,yCAAuB;AACvB,+CAA6B;AAC7B,+CAA6B;AAC7B,gDAA8B;AAE9B,2EAA2E;AAC3E,0EAA0E;AAC1E,qEAAqE;AACrE,mDAAmD;AACnD,iCAA+B;AAC/B,qDAAoD;AAA3C,wGAAA,UAAU,OAAA;AAEnB,iDAA0D;AAAjD,4GAAA,iBAAiB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aibrains/pdf-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "EdForge PDF rendering library. JSX-based document templates built on @react-pdf/renderer, with localization (EN + NE), Bikram Sambat date support, and a TemplateDescriptor registry for cross-domain doc types (invoice, receipt, report card, admit card, etc.).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"types": "./dist/components/index.d.ts",
|
|
25
25
|
"require": "./dist/components/index.js",
|
|
26
26
|
"default": "./dist/components/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./descriptors": {
|
|
29
|
+
"types": "./dist/descriptors/index.d.ts",
|
|
30
|
+
"require": "./dist/descriptors/index.js",
|
|
31
|
+
"default": "./dist/descriptors/index.js"
|
|
27
32
|
}
|
|
28
33
|
},
|
|
29
34
|
"files": [
|