@aibrains/pdf-renderer 0.4.0 → 0.6.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 +11 -5
- package/dist/core/i18n.js.map +1 -1
- 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/receipt.d.ts +24 -0
- package/dist/descriptors/receipt.d.ts.map +1 -0
- package/dist/descriptors/receipt.js +181 -0
- package/dist/descriptors/receipt.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/documents/ReceiptPdf.d.ts +116 -0
- package/dist/documents/ReceiptPdf.d.ts.map +1 -0
- package/dist/documents/ReceiptPdf.js +221 -0
- package/dist/documents/ReceiptPdf.js.map +1 -0
- package/dist/i18n/en/invoice.json +31 -0
- package/dist/i18n/en/receipt.json +36 -0
- package/dist/i18n/ne/invoice.json +31 -0
- package/dist/i18n/ne/receipt.json +36 -0
- package/dist/index.d.ts +17 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -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' | 'receipt';
|
|
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;AASH,0CAA0C;AAC1C,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/B;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAazD;;;;;;;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,13 @@ 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"));
|
|
34
|
+
const receipt_json_1 = __importDefault(require("../i18n/en/receipt.json"));
|
|
35
|
+
const receipt_json_2 = __importDefault(require("../i18n/ne/receipt.json"));
|
|
30
36
|
const BUNDLES = {
|
|
31
|
-
en: { common: common_json_1.default },
|
|
32
|
-
ne: { common: common_json_2.default },
|
|
37
|
+
en: { common: common_json_1.default, invoice: invoice_json_1.default, receipt: receipt_json_1.default },
|
|
38
|
+
ne: { common: common_json_2.default, invoice: invoice_json_2.default, receipt: receipt_json_2.default },
|
|
33
39
|
};
|
|
34
40
|
/** Default fallback language when target language is missing a key. */
|
|
35
41
|
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;;;;;AAqCH,cAiBC;AASD,sBAUC;AAvED,yEAA8C;AAC9C,yEAA8C;AAC9C,2EAAgD;AAChD,2EAAgD;AAChD,2EAAgD;AAChD,2EAAgD;AAchD,MAAM,OAAO,GAA8B;IACzC,EAAE,EAAE,EAAE,MAAM,EAAE,qBAAQ,EAAE,OAAO,EAAE,sBAAS,EAAE,OAAO,EAAE,sBAAS,EAAE;IAChE,EAAE,EAAE,EAAE,MAAM,EAAE,qBAAQ,EAAE,OAAO,EAAE,sBAAS,EAAE,OAAO,EAAE,sBAAS,EAAE;CACjE,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,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;AAC3G,yCAAgD;AAOhD;;;;;GAKG;AACH,SAAS,eAAe,CAAC,SAAoB,EAAE,OAAe;IAC5D,MAAM,QAAQ,GAAG,SAAS,KAAK,QAAQ,CAAC;IACxC,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,UAAU;QACvB,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACrD,MAAM,EAAE;YACN,QAAQ,EAAE,IAAI;YACd,cAAc,EAAE,IAAI;YACpB,iBAAiB,EAAE,IAAI;YACvB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS;SACpD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,eAA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|
4
|
+
* Second concrete `TemplateDescriptor` registered with the library; same
|
|
5
|
+
* registration + defaults pattern as the invoice descriptor that shipped in
|
|
6
|
+
* Sprint C.1.1. Importing this file is sufficient to make
|
|
7
|
+
* `getDescriptor('RECEIPT')` work via the top-level `registerDescriptor(...)`
|
|
8
|
+
* side effect at the bottom of the file.
|
|
9
|
+
*
|
|
10
|
+
* Defaults mirror the invoice descriptor's PABSON / GENERIC split:
|
|
11
|
+
* - PABSON ⇒ BS+AD dual dates, EN+NE labels, south-asian numbers, NPR
|
|
12
|
+
* symbol, PAN/VAT compliance disclosures on.
|
|
13
|
+
* - GENERIC ⇒ gregorian, EN-only, western, ISO-code currency, tax-
|
|
14
|
+
* breakdown disclosures off (still operator-toggleable).
|
|
15
|
+
*
|
|
16
|
+
* `configurableFields[]` is the operator-facing customization surface for
|
|
17
|
+
* the C.2.4 generic editor. 17 fields for V1 — slightly more than invoice
|
|
18
|
+
* (13) because receipts add payment-channel + tax-breakdown sub-sections
|
|
19
|
+
* that invoices don't have.
|
|
20
|
+
*/
|
|
21
|
+
import { type ReceiptTemplateConfig, type ReceiptDocumentData } from '../documents/ReceiptPdf';
|
|
22
|
+
import type { TemplateDescriptor } from './types';
|
|
23
|
+
export declare const receiptDescriptor: TemplateDescriptor<ReceiptDocumentData, ReceiptTemplateConfig>;
|
|
24
|
+
//# sourceMappingURL=receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../../src/descriptors/receipt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAoJjB,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,mBAAmB,EAAE,qBAAqB,CAO5F,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Receipt descriptor — Sprint C.1.2.
|
|
4
|
+
*
|
|
5
|
+
* Second concrete `TemplateDescriptor` registered with the library; same
|
|
6
|
+
* registration + defaults pattern as the invoice descriptor that shipped in
|
|
7
|
+
* Sprint C.1.1. Importing this file is sufficient to make
|
|
8
|
+
* `getDescriptor('RECEIPT')` work via the top-level `registerDescriptor(...)`
|
|
9
|
+
* side effect at the bottom of the file.
|
|
10
|
+
*
|
|
11
|
+
* Defaults mirror the invoice descriptor's PABSON / GENERIC split:
|
|
12
|
+
* - PABSON ⇒ BS+AD dual dates, EN+NE labels, south-asian numbers, NPR
|
|
13
|
+
* symbol, PAN/VAT compliance disclosures on.
|
|
14
|
+
* - GENERIC ⇒ gregorian, EN-only, western, ISO-code currency, tax-
|
|
15
|
+
* breakdown disclosures off (still operator-toggleable).
|
|
16
|
+
*
|
|
17
|
+
* `configurableFields[]` is the operator-facing customization surface for
|
|
18
|
+
* the C.2.4 generic editor. 17 fields for V1 — slightly more than invoice
|
|
19
|
+
* (13) because receipts add payment-channel + tax-breakdown sub-sections
|
|
20
|
+
* that invoices don't have.
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.receiptDescriptor = void 0;
|
|
24
|
+
const ReceiptPdf_1 = require("../documents/ReceiptPdf");
|
|
25
|
+
const registry_1 = require("./registry");
|
|
26
|
+
/**
|
|
27
|
+
* Default `ReceiptTemplateConfig` for a freshly-seeded template. PABSON
|
|
28
|
+
* gets the dual-language + tax-compliance bundle; GENERIC + reserved
|
|
29
|
+
* archetypes (`CBSE_IN`, `NAIS_US`, `GEMS_UAE`) fall through to a slim
|
|
30
|
+
* Western default.
|
|
31
|
+
*/
|
|
32
|
+
function receiptDefaults(archetype, _locale) {
|
|
33
|
+
const isPabson = archetype === 'PABSON';
|
|
34
|
+
return {
|
|
35
|
+
pageSize: 'A4',
|
|
36
|
+
orientation: 'portrait',
|
|
37
|
+
margins: { top: 15, right: 15, bottom: 15, left: 15 },
|
|
38
|
+
header: {
|
|
39
|
+
showLogo: true,
|
|
40
|
+
showSchoolName: true,
|
|
41
|
+
showSchoolAddress: true,
|
|
42
|
+
showContact: true,
|
|
43
|
+
tagline: isPabson ? 'Education for All' : undefined,
|
|
44
|
+
},
|
|
45
|
+
footer: {
|
|
46
|
+
text: undefined,
|
|
47
|
+
showPageNumbers: true,
|
|
48
|
+
showSignatureLine: false, // receipts traditionally don't need a signature line
|
|
49
|
+
showThankYou: true,
|
|
50
|
+
},
|
|
51
|
+
dateFormat: isPabson ? 'dual' : 'gregorian',
|
|
52
|
+
numberFormat: isPabson ? 'south-asian' : 'western',
|
|
53
|
+
currencyDisplay: 'iso-code',
|
|
54
|
+
labelLanguages: isPabson ? ['en', 'ne'] : ['en'],
|
|
55
|
+
lineItemColumns: {
|
|
56
|
+
description: true,
|
|
57
|
+
amount: true,
|
|
58
|
+
taxAmount: isPabson, // PABSON typically shows VAT per line; GENERIC schools can opt in.
|
|
59
|
+
total: true,
|
|
60
|
+
},
|
|
61
|
+
totalsSection: {
|
|
62
|
+
showSubtotal: true,
|
|
63
|
+
showTaxTotal: true,
|
|
64
|
+
showDiscountTotal: true,
|
|
65
|
+
},
|
|
66
|
+
paymentDetails: {
|
|
67
|
+
showPaymentMethod: true,
|
|
68
|
+
showTransactionId: true,
|
|
69
|
+
showPaidBy: true,
|
|
70
|
+
},
|
|
71
|
+
taxBreakdownSection: {
|
|
72
|
+
// PABSON tenants register PAN/VAT for VAT compliance — defaults on so
|
|
73
|
+
// the compliance block renders without operator config. GENERIC schools
|
|
74
|
+
// usually don't carry PAN/VAT and can leave these off; the block also
|
|
75
|
+
// gracefully omits at render time when the underlying branding fields
|
|
76
|
+
// are absent (see ReceiptPdf taxEntries).
|
|
77
|
+
showPanNumber: isPabson,
|
|
78
|
+
showVatNumber: isPabson,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Sample data for the C.2.4 editor preview path. Mirrors a realistic Saraswati
|
|
84
|
+
* receipt for the same invoice the C.1.1 invoiceSampleData uses (so a side-
|
|
85
|
+
* by-side editor preview lines up cleanly between Invoice and Receipt).
|
|
86
|
+
*/
|
|
87
|
+
function receiptSampleData(archetype, _locale) {
|
|
88
|
+
const isPabson = archetype === 'PABSON';
|
|
89
|
+
return {
|
|
90
|
+
receiptNumber: 'RCT-2026-001234',
|
|
91
|
+
paidDate: '2026-03-20',
|
|
92
|
+
invoiceNumber: 'INV-2026-001234',
|
|
93
|
+
transactionId: isPabson ? 'TXN-ESWA-987654321' : 'TXN-STRP-pi_3PqXyz',
|
|
94
|
+
paymentMethod: isPabson ? 'eSewa' : 'Card',
|
|
95
|
+
paidBy: isPabson ? 'सरस्वती शर्मा' : 'Saraswati Sharma',
|
|
96
|
+
studentName: isPabson ? 'सरस्वती शर्मा' : 'Saraswati Sharma',
|
|
97
|
+
studentId: 'STU-2025-0042',
|
|
98
|
+
gradeLevel: '8',
|
|
99
|
+
academicYear: '2025-2026',
|
|
100
|
+
billingPeriod: isPabson ? 'चैत 2082' : 'Q1 2026',
|
|
101
|
+
lineItems: [
|
|
102
|
+
{
|
|
103
|
+
description: isPabson ? 'ट्यूशन शुल्क — कक्षा ८' : 'Tuition Fee — Grade 8',
|
|
104
|
+
amount: 10000,
|
|
105
|
+
taxAmount: 1235,
|
|
106
|
+
total: 10735,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
description: isPabson ? 'पुस्तकालय शुल्क' : 'Library Fee',
|
|
110
|
+
amount: 500,
|
|
111
|
+
taxAmount: 0,
|
|
112
|
+
total: 500,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
subtotal: 10500,
|
|
116
|
+
taxTotal: 1235,
|
|
117
|
+
discountTotal: 500,
|
|
118
|
+
grandTotal: 11235,
|
|
119
|
+
paidAmount: 11235,
|
|
120
|
+
currency: isPabson ? 'NPR' : 'USD',
|
|
121
|
+
taxableAmount: 10500,
|
|
122
|
+
taxAmount: 1235,
|
|
123
|
+
notes: isPabson
|
|
124
|
+
? 'कृपया यो रसिद आफ्नो रेकर्डका लागि सुरक्षित राख्नुहोस्।'
|
|
125
|
+
: 'Please keep this receipt for your records.',
|
|
126
|
+
status: 'paid',
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* 17 configurable fields surfaced in the C.2.4 editor. Field count is
|
|
131
|
+
* deliberately a tad larger than invoice's 13 because receipts expose
|
|
132
|
+
* payment-channel + tax-breakdown sub-sections that invoices don't have.
|
|
133
|
+
*
|
|
134
|
+
* Field IDs are dot-paths into `ReceiptTemplateConfig`. Editor RHF
|
|
135
|
+
* Controllers register at exactly these paths — see invoice descriptor's
|
|
136
|
+
* configurableFields[] for the matching convention.
|
|
137
|
+
*/
|
|
138
|
+
const receiptConfigurableFields = [
|
|
139
|
+
// Header (5)
|
|
140
|
+
{ path: 'header.showLogo', type: 'toggle', labelKey: 'field.header.showLogo' },
|
|
141
|
+
{ path: 'header.showSchoolName', type: 'toggle', labelKey: 'field.header.showSchoolName' },
|
|
142
|
+
{ path: 'header.showSchoolAddress', type: 'toggle', labelKey: 'field.header.showSchoolAddress' },
|
|
143
|
+
{ path: 'header.showContact', type: 'toggle', labelKey: 'field.header.showContact' },
|
|
144
|
+
{ path: 'header.tagline', type: 'text', labelKey: 'field.header.tagline' },
|
|
145
|
+
// Line items — only taxAmount toggleable (description/amount/total always-on)
|
|
146
|
+
{ path: 'lineItemColumns.taxAmount', type: 'toggle', labelKey: 'field.lineItems.taxAmount' },
|
|
147
|
+
// Totals (3 toggleable)
|
|
148
|
+
{ path: 'totalsSection.showSubtotal', type: 'toggle', labelKey: 'field.totals.showSubtotal' },
|
|
149
|
+
{ path: 'totalsSection.showTaxTotal', type: 'toggle', labelKey: 'field.totals.showTaxTotal' },
|
|
150
|
+
{ path: 'totalsSection.showDiscountTotal', type: 'toggle', labelKey: 'field.totals.showDiscountTotal' },
|
|
151
|
+
// Payment details (3 toggleable)
|
|
152
|
+
{ path: 'paymentDetails.showPaymentMethod', type: 'toggle', labelKey: 'field.payment.showPaymentMethod' },
|
|
153
|
+
{ path: 'paymentDetails.showTransactionId', type: 'toggle', labelKey: 'field.payment.showTransactionId' },
|
|
154
|
+
{ path: 'paymentDetails.showPaidBy', type: 'toggle', labelKey: 'field.payment.showPaidBy' },
|
|
155
|
+
// Tax breakdown (2 toggleable)
|
|
156
|
+
{ path: 'taxBreakdownSection.showPanNumber', type: 'toggle', labelKey: 'field.tax.showPanNumber' },
|
|
157
|
+
{ path: 'taxBreakdownSection.showVatNumber', type: 'toggle', labelKey: 'field.tax.showVatNumber' },
|
|
158
|
+
// Footer (2 toggleable)
|
|
159
|
+
{ path: 'footer.showThankYou', type: 'toggle', labelKey: 'field.footer.showThankYou' },
|
|
160
|
+
{ path: 'footer.showSignatureLine', type: 'toggle', labelKey: 'field.footer.showSignatureLine' },
|
|
161
|
+
// Localization (1)
|
|
162
|
+
{
|
|
163
|
+
path: 'dateFormat',
|
|
164
|
+
type: 'select',
|
|
165
|
+
labelKey: 'field.dateFormat',
|
|
166
|
+
options: ['gregorian', 'bikram_sambat', 'dual'],
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
exports.receiptDescriptor = {
|
|
170
|
+
docType: 'RECEIPT',
|
|
171
|
+
i18nNamespace: 'receipt',
|
|
172
|
+
Component: ReceiptPdf_1.ReceiptPdf,
|
|
173
|
+
defaults: receiptDefaults,
|
|
174
|
+
sampleData: receiptSampleData,
|
|
175
|
+
configurableFields: receiptConfigurableFields,
|
|
176
|
+
};
|
|
177
|
+
// Self-register at module load — consumers only need
|
|
178
|
+
// `import '@aibrains/pdf-renderer/descriptors/receipt'` (or transitive via
|
|
179
|
+
// the package index) for `getDescriptor('RECEIPT')` to resolve.
|
|
180
|
+
(0, registry_1.registerDescriptor)(exports.receiptDescriptor);
|
|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B;CAC9C,CAAC;AAEF,qDAAqD;AACrD,2EAA2E;AAC3E,gEAAgE;AAChE,IAAA,6BAAkB,EAAC,yBAAiB,CAAC,CAAC"}
|
|
@@ -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;;;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