@aibrains/pdf-renderer 0.5.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.
@@ -26,7 +26,7 @@ export type Lang = 'en' | 'ne';
26
26
  * Supported translation namespaces in V1. New doc types append here AND
27
27
  * add a bundle entry to BUNDLES below; the loader is otherwise additive.
28
28
  */
29
- export type Namespace = 'common' | 'invoice';
29
+ export type Namespace = 'common' | 'invoice' | 'receipt';
30
30
  /**
31
31
  * Translate a key.
32
32
  *
@@ -1 +1 @@
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"}
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
@@ -31,9 +31,11 @@ const common_json_1 = __importDefault(require("../i18n/en/common.json"));
31
31
  const common_json_2 = __importDefault(require("../i18n/ne/common.json"));
32
32
  const invoice_json_1 = __importDefault(require("../i18n/en/invoice.json"));
33
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"));
34
36
  const BUNDLES = {
35
- en: { common: common_json_1.default, invoice: invoice_json_1.default },
36
- ne: { common: common_json_2.default, invoice: invoice_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 },
37
39
  };
38
40
  /** Default fallback language when target language is missing a key.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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,24 @@
1
+ /**
2
+ * Receipt descriptor — Sprint C.1.2.
3
+ *
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);
181
+ //# sourceMappingURL=receipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt.js","sourceRoot":"","sources":["../../src/descriptors/receipt.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,wDAIiC;AACjC,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,eAAe,EAAE,IAAI;YACrB,iBAAiB,EAAE,KAAK,EAAE,qDAAqD;YAC/E,YAAY,EAAE,IAAI;SACnB;QACD,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW;QAC3C,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;QA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C5B,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,qDAAqD;AACrD,2EAA2E;AAC3E,gEAAgE;AAChE,IAAA,6BAAkB,EAAC,yBAAiB,CAAC,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * `<ReceiptPdf>` — Sprint C.1.2 second document component.
3
+ *
4
+ * Composition exercise mirroring `<InvoicePdf>`: zero new primitives, all
5
+ * structure assembled from C.0.3 primitives (Document + Page + BrandedHeader
6
+ * + BrandedFooter + Watermark) and C.0.3 components (KeyValueTable +
7
+ * LineItemTable + TotalsBlock + SignatureLine).
8
+ *
9
+ * Receipts differ from invoices in three ways that shape this document:
10
+ * 1. Always issued AFTER a completed payment — no due-date concept; line
11
+ * items list what was charged, totals show what was paid.
12
+ * 2. Carry payment-channel metadata (gateway / transaction ID / paid-by)
13
+ * that invoices don't have. Rendered in a second `KeyValueTable` block.
14
+ * 3. PABSON tenants require PAN/VAT/taxable-amount/tax-amount disclosure
15
+ * for VAT compliance — surfaced as a third metadata block when both
16
+ * `taxBreakdownSection.show*` toggles are on and the values are present
17
+ * on `branding.panNumber` / `branding.vatNumber`.
18
+ *
19
+ * Watermark is applied for `status: 'voided' | 'refunded'`. The "happy path"
20
+ * status `'paid'` renders without a watermark (a paid receipt is the normal
21
+ * artifact).
22
+ */
23
+ import * as React from 'react';
24
+ import { type LineItem } from '../components/LineItemTable';
25
+ import type { DocumentComponentProps, PdfTemplateConfig } from '../descriptors/types';
26
+ /**
27
+ * Per-doc-type config for receipts. Extends the shared `PdfTemplateConfig`
28
+ * with receipt-specific toggles: a slimmer set of line-item columns (no
29
+ * quantity/discount/taxRate — receipts don't itemize those the way invoices
30
+ * do), payment-channel detail visibility, and a tax-breakdown section.
31
+ */
32
+ export interface ReceiptTemplateConfig extends PdfTemplateConfig {
33
+ /**
34
+ * Receipt line-item table only exposes the four columns relevant to a
35
+ * payment record. `description`, `amount`, and `total` are always shown
36
+ * (enforced at runtime by LineItemTable's REQUIRED_COLUMNS set); only
37
+ * `taxAmount` is operator-configurable.
38
+ */
39
+ lineItemColumns: {
40
+ description: boolean;
41
+ amount: boolean;
42
+ taxAmount: boolean;
43
+ total: boolean;
44
+ };
45
+ totalsSection: {
46
+ showSubtotal: boolean;
47
+ showTaxTotal: boolean;
48
+ showDiscountTotal: boolean;
49
+ };
50
+ paymentDetails: {
51
+ showPaymentMethod: boolean;
52
+ showTransactionId: boolean;
53
+ showPaidBy: boolean;
54
+ };
55
+ taxBreakdownSection: {
56
+ showPanNumber: boolean;
57
+ showVatNumber: boolean;
58
+ };
59
+ footer: PdfTemplateConfig['footer'] & {
60
+ showSignatureLine: boolean;
61
+ showThankYou: boolean;
62
+ };
63
+ }
64
+ /**
65
+ * Receipt data shape the document component renders.
66
+ *
67
+ * Mirrors the `Receipt` zod schema in `@aibrains/shared-types/finance` but
68
+ * declared locally because (a) the renderer is published as its own npm
69
+ * package and shouldn't take a peer-dep on the consumer's shared-types
70
+ * version, and (b) structural typing lets endpoints pass the full shared
71
+ * shape — extra fields fall through harmlessly.
72
+ */
73
+ export interface ReceiptDocumentData {
74
+ receiptNumber: string;
75
+ paidDate: string;
76
+ invoiceNumber: string;
77
+ /** Optional — typically the gateway-side ID for digital payments (eSewa, Khalti, gateway txn refs). */
78
+ transactionId?: string;
79
+ /** Display name for the gateway/method, e.g. 'eSewa', 'Cash', 'Bank transfer'. */
80
+ paymentMethod: string;
81
+ paidBy: string;
82
+ studentName: string;
83
+ studentId?: string;
84
+ gradeLevel?: string;
85
+ academicYear?: string;
86
+ billingPeriod?: string;
87
+ lineItems: LineItem[];
88
+ subtotal: number;
89
+ taxTotal: number;
90
+ discountTotal: number;
91
+ grandTotal: number;
92
+ /**
93
+ * Amount captured by this payment. For typical full-pay receipts this
94
+ * equals `grandTotal`; partial-payment flows can show a smaller value
95
+ * here while keeping `grandTotal` as the invoice's full amount.
96
+ */
97
+ paidAmount: number;
98
+ currency: string;
99
+ /**
100
+ * Tax-compliance block. PAN/VAT come from `branding` (school-level); the
101
+ * `taxableAmount` + `taxAmount` are receipt-level. All four are required
102
+ * for the rendered block to appear when the operator has both
103
+ * `taxBreakdownSection.showPanNumber` and `showVatNumber` toggled on.
104
+ */
105
+ taxableAmount?: number;
106
+ taxAmount?: number;
107
+ notes?: string;
108
+ /**
109
+ * V1 supports three lifecycle states. `'paid'` is the normal artifact (no
110
+ * watermark). `'voided'` + `'refunded'` get watermarks to clearly mark the
111
+ * document as no-longer-the-source-of-truth.
112
+ */
113
+ status: 'paid' | 'voided' | 'refunded';
114
+ }
115
+ export declare const ReceiptPdf: React.FC<DocumentComponentProps<ReceiptDocumentData, ReceiptTemplateConfig>>;
116
+ //# sourceMappingURL=ReceiptPdf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReceiptPdf.d.ts","sourceRoot":"","sources":["../../src/documents/ReceiptPdf.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;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;;;;;GAKG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D;;;;;OAKG;IACH,eAAe,EAAE;QACf,WAAW,EAAE,OAAO,CAAC;QACrB,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;IACF,aAA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AAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;CACxC;AAiFD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAqQnG,CAAC"}
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReceiptPdf = 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.sm,
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
+ subsectionTitle: {
36
+ fontSize: theme_1.DEFAULT_FONT_SIZE.sm,
37
+ fontWeight: 700,
38
+ color: theme_1.DEFAULT_COLORS.text,
39
+ marginTop: theme_1.DEFAULT_SPACING.sm,
40
+ marginBottom: theme_1.DEFAULT_SPACING.xs,
41
+ },
42
+ notesBlock: {
43
+ marginTop: theme_1.DEFAULT_SPACING.md,
44
+ padding: theme_1.DEFAULT_SPACING.sm,
45
+ backgroundColor: '#F8F9FA',
46
+ borderLeftWidth: 3,
47
+ borderLeftColor: theme_1.DEFAULT_COLORS.border,
48
+ },
49
+ notesText: {
50
+ fontSize: theme_1.DEFAULT_FONT_SIZE.sm,
51
+ color: theme_1.DEFAULT_COLORS.text,
52
+ },
53
+ thankYouBlock: {
54
+ marginTop: theme_1.DEFAULT_SPACING.lg,
55
+ textAlign: 'center',
56
+ },
57
+ thankYouText: {
58
+ fontSize: theme_1.DEFAULT_FONT_SIZE.sm,
59
+ fontWeight: 700,
60
+ color: theme_1.DEFAULT_COLORS.text,
61
+ },
62
+ });
63
+ function buildPrimary(key, langs) {
64
+ return (0, i18n_1.t)('receipt', key, langs[0]);
65
+ }
66
+ function buildSecondary(key, langs) {
67
+ return langs.length >= 2 ? (0, i18n_1.t)('receipt', key, langs[1]) : undefined;
68
+ }
69
+ const dualLabelStyles = renderer_1.StyleSheet.create({
70
+ primary: {
71
+ fontSize: theme_1.DEFAULT_FONT_SIZE.sm,
72
+ color: theme_1.DEFAULT_COLORS.text,
73
+ },
74
+ secondary: {
75
+ fontSize: theme_1.DEFAULT_FONT_SIZE.sm * 0.8,
76
+ color: theme_1.DEFAULT_COLORS.textMuted,
77
+ },
78
+ });
79
+ /**
80
+ * Stacked dual-language label primitive — same pattern InvoicePdf uses.
81
+ * Small enough to inline; not worth extracting to its own primitive yet.
82
+ */
83
+ 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 }))] }));
84
+ const ReceiptPdf = ({ data, template, branding, settings, }) => {
85
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
86
+ const langs = template.labelLanguages;
87
+ const isDualLang = langs.length >= 2;
88
+ const numberGrouping = template.numberFormat === 'auto-from-workspace'
89
+ ? 'western'
90
+ : template.numberFormat;
91
+ const renderNumber = (v) => (0, format_1.formatNumber)(v !== null && v !== void 0 ? v : 0, numberGrouping);
92
+ const renderCurrency = (v) => (0, format_1.formatCurrency)(v, data.currency, {
93
+ locale: settings.defaultLocale,
94
+ showSymbol: template.currencyDisplay === 'symbol',
95
+ });
96
+ const headerConfig = {
97
+ showLogo: template.header.showLogo,
98
+ showSchoolName: template.header.showSchoolName,
99
+ showSchoolAddress: template.header.showSchoolAddress,
100
+ showContact: template.header.showContact,
101
+ tagline: template.header.tagline,
102
+ primaryColor: (_a = template.brandingOverrides) === null || _a === void 0 ? void 0 : _a.primaryColor,
103
+ };
104
+ const headerBranding = {
105
+ logoSrc: (_c = (_b = template.brandingOverrides) === null || _b === void 0 ? void 0 : _b.logoSrc) !== null && _c !== void 0 ? _c : branding.logoSrc,
106
+ schoolName: branding.schoolName,
107
+ addressLines: (_e = (_d = template.brandingOverrides) === null || _d === void 0 ? void 0 : _d.addressLines) !== null && _e !== void 0 ? _e : branding.addressLines,
108
+ phone: branding.phone,
109
+ email: branding.email,
110
+ };
111
+ // Watermark on voided / refunded receipts (paid is the happy path, no mark).
112
+ const watermarkLabel = data.status === 'voided'
113
+ ? (0, i18n_1.t)('receipt', 'watermarkVoided', langs[0])
114
+ : data.status === 'refunded'
115
+ ? (0, i18n_1.t)('receipt', 'watermarkRefunded', langs[0])
116
+ : undefined;
117
+ // Primary metadata block — receipt-specific keys (no due-date concept).
118
+ const metadataEntries = [
119
+ { label: buildPrimary('receiptNumber', langs), value: data.receiptNumber },
120
+ { label: buildPrimary('paymentDate', langs), value: (0, format_1.formatDate)(data.paidDate, template.dateFormat) },
121
+ { label: buildPrimary('invoiceRef', langs), value: data.invoiceNumber },
122
+ { label: buildPrimary('studentName', langs), value: data.studentName },
123
+ { label: buildPrimary('studentId', langs), value: data.studentId },
124
+ { label: buildPrimary('gradeLevel', langs), value: data.gradeLevel },
125
+ { label: buildPrimary('academicYear', langs), value: data.academicYear },
126
+ { label: buildPrimary('billingPeriod', langs), value: data.billingPeriod },
127
+ ];
128
+ // Payment-channel block — entries collapse to [] when all toggles are off,
129
+ // so an operator who wants a minimal receipt drops the whole sub-section.
130
+ const paymentEntries = [];
131
+ if (template.paymentDetails.showPaymentMethod) {
132
+ paymentEntries.push({ label: buildPrimary('paymentMethod', langs), value: data.paymentMethod });
133
+ }
134
+ if (template.paymentDetails.showTransactionId && data.transactionId) {
135
+ paymentEntries.push({ label: buildPrimary('transactionId', langs), value: data.transactionId });
136
+ }
137
+ if (template.paymentDetails.showPaidBy) {
138
+ paymentEntries.push({ label: buildPrimary('paidBy', langs), value: data.paidBy });
139
+ }
140
+ // Tax-breakdown block — PABSON VAT-compliance requirement. PAN/VAT come from
141
+ // branding (school-level); taxableAmount/taxAmount are receipt-level. The
142
+ // entire sub-section is gated by operator toggles: when both showPanNumber
143
+ // AND showVatNumber are off, the operator has opted out of tax disclosure
144
+ // and NO row in this block renders — including the receipt-level amounts.
145
+ // This guards against the case where data carries tax figures but the
146
+ // operator wanted them suppressed (e.g., non-PABSON tenant + GENERIC
147
+ // profile + nonzero data.taxAmount).
148
+ const taxEntries = [];
149
+ const taxBreakdownEnabled = template.taxBreakdownSection.showPanNumber || template.taxBreakdownSection.showVatNumber;
150
+ if (taxBreakdownEnabled) {
151
+ if (template.taxBreakdownSection.showPanNumber && branding.panNumber) {
152
+ taxEntries.push({ label: buildPrimary('panNumber', langs), value: branding.panNumber });
153
+ }
154
+ if (template.taxBreakdownSection.showVatNumber && branding.vatNumber) {
155
+ taxEntries.push({ label: buildPrimary('vatNumber', langs), value: branding.vatNumber });
156
+ }
157
+ if (data.taxableAmount !== undefined && data.taxableAmount > 0) {
158
+ taxEntries.push({
159
+ label: buildPrimary('taxableAmount', langs),
160
+ value: renderCurrency(data.taxableAmount),
161
+ });
162
+ }
163
+ if (data.taxAmount !== undefined && data.taxAmount > 0) {
164
+ taxEntries.push({
165
+ label: buildPrimary('taxAmountLabel', langs),
166
+ value: renderCurrency(data.taxAmount),
167
+ });
168
+ }
169
+ }
170
+ // LineItemTable requires the full 7-column shape — receipts hardcode the
171
+ // four irrelevant columns to false so they never render, then forward the
172
+ // single configurable column (`taxAmount`) from template config.
173
+ const lineItemColumns = {
174
+ description: true,
175
+ quantity: false,
176
+ amount: true,
177
+ discount: false,
178
+ taxRate: false,
179
+ taxAmount: template.lineItemColumns.taxAmount,
180
+ total: true,
181
+ };
182
+ return ((0, jsx_runtime_1.jsx)(Document_1.Document, { title: `Receipt ${data.receiptNumber}`, subject: "Payment Receipt", 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: [
183
+ styles.sectionTitleSecondary,
184
+ { fontFamily: (0, fonts_1.pickFontFamily)((_f = buildSecondary('title', langs)) !== null && _f !== void 0 ? _f : '') },
185
+ ], children: buildSecondary('title', langs) })), (0, jsx_runtime_1.jsx)(KeyValueTable_1.KeyValueTable, { entries: metadataEntries })] }), paymentEntries.length > 0 && ((0, jsx_runtime_1.jsxs)(renderer_1.View, { style: styles.metaBlock, children: [(0, jsx_runtime_1.jsx)(DualLabel, { primary: buildPrimary('paymentDetailsTitle', langs), secondary: buildSecondary('paymentDetailsTitle', langs) }), (0, jsx_runtime_1.jsx)(KeyValueTable_1.KeyValueTable, { entries: paymentEntries })] })), (0, jsx_runtime_1.jsx)(LineItemTable_1.LineItemTable, { items: data.lineItems, columns: lineItemColumns, headers: {
186
+ description: buildPrimary('description', langs),
187
+ quantity: '',
188
+ amount: buildPrimary('amount', langs),
189
+ discount: '',
190
+ taxRate: '',
191
+ taxAmount: buildPrimary('taxAmount', langs),
192
+ total: buildPrimary('total', langs),
193
+ }, renderNumber: renderNumber }), (0, jsx_runtime_1.jsx)(TotalsBlock_1.TotalsBlock, { entries: {
194
+ subtotal: data.subtotal,
195
+ taxTotal: data.taxTotal,
196
+ discountTotal: data.discountTotal,
197
+ grandTotal: data.grandTotal,
198
+ amountPaid: data.paidAmount,
199
+ // amountDue intentionally omitted — by definition a receipt
200
+ // documents an applied payment; there is no "amount due" line.
201
+ amountDue: undefined,
202
+ }, visibility: {
203
+ showSubtotal: template.totalsSection.showSubtotal,
204
+ showTaxTotal: template.totalsSection.showTaxTotal,
205
+ showDiscountTotal: template.totalsSection.showDiscountTotal,
206
+ showAmountPaid: true,
207
+ showAmountDue: false,
208
+ }, labels: {
209
+ subtotal: buildPrimary('subtotal', langs),
210
+ taxTotal: buildPrimary('totalTax', langs),
211
+ discountTotal: buildPrimary('totalDiscount', langs),
212
+ grandTotal: buildPrimary('grandTotal', langs),
213
+ amountPaid: buildPrimary('paidAmount', langs),
214
+ amountDue: '',
215
+ }, renderCurrency: renderCurrency }), taxEntries.length > 0 && ((0, jsx_runtime_1.jsxs)(renderer_1.View, { style: styles.metaBlock, children: [(0, jsx_runtime_1.jsx)(DualLabel, { primary: buildPrimary('taxBreakdownTitle', langs), secondary: buildSecondary('taxBreakdownTitle', langs) }), (0, jsx_runtime_1.jsx)(KeyValueTable_1.KeyValueTable, { entries: taxEntries })] })), 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.showThankYou && ((0, jsx_runtime_1.jsxs)(renderer_1.View, { style: styles.thankYouBlock, children: [(0, jsx_runtime_1.jsx)(renderer_1.Text, { style: [styles.thankYouText, { fontFamily: (0, fonts_1.pickFontFamily)(buildPrimary('thankYou', langs)) }], children: buildPrimary('thankYou', langs) }), isDualLang && ((0, jsx_runtime_1.jsx)(renderer_1.Text, { style: [
216
+ dualLabelStyles.secondary,
217
+ { fontFamily: (0, fonts_1.pickFontFamily)((_g = buildSecondary('thankYou', langs)) !== null && _g !== void 0 ? _g : '') },
218
+ ], children: buildSecondary('thankYou', langs) }))] })), template.footer.showSignatureLine && ((0, jsx_runtime_1.jsx)(SignatureLine_1.SignatureLine, { caption: (_j = (_h = branding.formalName) !== null && _h !== void 0 ? _h : branding.schoolName) !== null && _j !== void 0 ? _j : '', signatureSrc: branding.principalSignatureSrc, align: "right" })), (0, jsx_runtime_1.jsx)(BrandedFooter_1.BrandedFooter, { text: template.footer.text, showPageNumbers: template.footer.showPageNumbers, lang: langs[0] })] }) }));
219
+ };
220
+ exports.ReceiptPdf = ReceiptPdf;
221
+ //# sourceMappingURL=ReceiptPdf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReceiptPdf.js","sourceRoot":"","sources":["../../src/documents/ReceiptPdf.tsx"],"names":[],"mappings":";;;;AAwBA,kDAA6D;AAC7D,qDAAkD;AAClD,6CAA0C;AAC1C,+DAA4D;AAC5D,+DAA4D;AAC5D,uDAAoD;AACpD,+DAAgF;AAChF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,EAAE,UAAU,EAAE,IAAA,sBAAc,EAAC,MAAA,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,mCAAI,EAAE,CAAC,EAAE;6BACxE,YAEA,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,GAC7B,CACR,IACI,CACR,EAEA,QAAQ,CAAC,MAAM,CAAC,iBAAiB,IAAI,CACpC,uBAAC,6BAAa,IACZ,OAAO,EAAE,MAAA,MAAA,QAAQ,CAAC,UAAU,mCAAI,QAAQ,CAAC,UAAU,mCAAI,EAAE,EACzD,YAAY,EAAE,QAAQ,CAAC,qBAAqB,EAC5C,KAAK,EAAC,OAAO,GACb,CACH,EAED,uBAAC,6BAAa,IACZ,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAC1B,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAChD,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GACd,IACG,GACE,CACZ,CAAC;AACJ,CAAC,CAAC;AArQW,QAAA,UAAU,cAqQrB"}
@@ -0,0 +1,36 @@
1
+ {
2
+ "title": "Payment Receipt",
3
+ "subtitle": "Official Receipt",
4
+ "receiptNumber": "Receipt No.",
5
+ "paymentDate": "Payment Date",
6
+ "paymentMethod": "Payment Method",
7
+ "transactionId": "Transaction ID",
8
+ "paidBy": "Paid By",
9
+ "invoiceNumber": "Invoice No.",
10
+ "invoiceRef": "Against Invoice",
11
+ "academicYear": "Academic Year",
12
+ "billingPeriod": "Billing Period",
13
+ "studentName": "Student",
14
+ "studentId": "Student ID",
15
+ "gradeLevel": "Grade",
16
+ "lineItems": "Line items",
17
+ "description": "Description",
18
+ "amount": "Amount",
19
+ "taxAmount": "Tax",
20
+ "total": "Total",
21
+ "subtotal": "Subtotal",
22
+ "totalTax": "Total tax",
23
+ "totalDiscount": "Total discount",
24
+ "grandTotal": "Grand total",
25
+ "paidAmount": "Amount paid",
26
+ "taxBreakdownTitle": "Tax Compliance",
27
+ "panNumber": "PAN",
28
+ "vatNumber": "VAT",
29
+ "taxableAmount": "Taxable amount",
30
+ "taxAmountLabel": "Tax amount",
31
+ "paymentDetailsTitle": "Payment details",
32
+ "notes": "Notes",
33
+ "thankYou": "Thank you for your payment.",
34
+ "watermarkVoided": "VOIDED",
35
+ "watermarkRefunded": "REFUNDED"
36
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "title": "भुक्तानी रसिद",
3
+ "subtitle": "सरकारी रसिद",
4
+ "receiptNumber": "रसिद नं.",
5
+ "paymentDate": "भुक्तानी मिति",
6
+ "paymentMethod": "भुक्तानी विधि",
7
+ "transactionId": "कारोबार आईडी",
8
+ "paidBy": "भुक्तानीकर्ता",
9
+ "invoiceNumber": "बिल नं.",
10
+ "invoiceRef": "बिल विरुद्ध",
11
+ "academicYear": "शैक्षिक वर्ष",
12
+ "billingPeriod": "बिलिंग अवधि",
13
+ "studentName": "विद्यार्थीको नाम",
14
+ "studentId": "विद्यार्थी आईडी",
15
+ "gradeLevel": "कक्षा",
16
+ "lineItems": "विवरण",
17
+ "description": "विवरण",
18
+ "amount": "रकम",
19
+ "taxAmount": "कर",
20
+ "total": "जम्मा",
21
+ "subtotal": "उप-योग",
22
+ "totalTax": "जम्मा कर",
23
+ "totalDiscount": "जम्मा छुट",
24
+ "grandTotal": "जम्मा रकम",
25
+ "paidAmount": "भुक्तानी रकम",
26
+ "taxBreakdownTitle": "कर विवरण",
27
+ "panNumber": "प्यान",
28
+ "vatNumber": "मू.अ.कर",
29
+ "taxableAmount": "कर योग्य रकम",
30
+ "taxAmountLabel": "कर रकम",
31
+ "paymentDetailsTitle": "भुक्तानी विवरण",
32
+ "notes": "टिप्पणी",
33
+ "thankYou": "तपाईंको भुक्तानीको लागि धन्यवाद।",
34
+ "watermarkVoided": "रद्द",
35
+ "watermarkRefunded": "फिर्ता"
36
+ }
package/dist/index.d.ts CHANGED
@@ -9,12 +9,14 @@
9
9
  * - C.0.3: layout primitives + reusable components + Devanagari R45 canary
10
10
  * - C.0.4: TemplateDescriptor<T> generic + per-docType registry
11
11
  * - C.1.1: <InvoicePdf> document + invoice descriptor + invoice i18n
12
+ * - C.1.2: <ReceiptPdf> document + receipt descriptor + receipt i18n
12
13
  *
13
- * Sprint C.1.2+: <ReceiptPdf>, <ReportCardPdf>,
14
+ * Sprint C.1.3+: server-side PdfTemplatesService + finance render endpoints,
15
+ * <ReportCardPdf> (C.3.1), <AdmitCardPdf> (C.5.1), …
14
16
  *
15
17
  * Design source of truth: docs/pilot-greenlight/c-epic-pdf-generation-design.md
16
18
  */
17
- export declare const PDF_RENDERER_PACKAGE_VERSION = "0.5.0";
19
+ export declare const PDF_RENDERER_PACKAGE_VERSION = "0.6.0";
18
20
  export * from './core';
19
21
  export * from './primitives';
20
22
  export * from './components';
@@ -23,4 +25,8 @@ import './descriptors/invoice';
23
25
  export { InvoicePdf } from './documents/InvoicePdf';
24
26
  export type { InvoiceTemplateConfig, InvoiceDocumentData } from './documents/InvoicePdf';
25
27
  export { invoiceDescriptor } from './descriptors/invoice';
28
+ import './descriptors/receipt';
29
+ export { ReceiptPdf } from './documents/ReceiptPdf';
30
+ export type { ReceiptTemplateConfig, ReceiptDocumentData } from './documents/ReceiptPdf';
31
+ export { receiptDescriptor } from './descriptors/receipt';
26
32
  //# sourceMappingURL=index.d.ts.map
@@ -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;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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;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;AAM1D,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
@@ -10,8 +10,10 @@
10
10
  * - C.0.3: layout primitives + reusable components + Devanagari R45 canary
11
11
  * - C.0.4: TemplateDescriptor<T> generic + per-docType registry
12
12
  * - C.1.1: <InvoicePdf> document + invoice descriptor + invoice i18n
13
+ * - C.1.2: <ReceiptPdf> document + receipt descriptor + receipt i18n
13
14
  *
14
- * Sprint C.1.2+: <ReceiptPdf>, <ReportCardPdf>,
15
+ * Sprint C.1.3+: server-side PdfTemplatesService + finance render endpoints,
16
+ * <ReportCardPdf> (C.3.1), <AdmitCardPdf> (C.5.1), …
15
17
  *
16
18
  * Design source of truth: docs/pilot-greenlight/c-epic-pdf-generation-design.md
17
19
  */
@@ -30,8 +32,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
32
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
33
  };
32
34
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.invoiceDescriptor = exports.InvoicePdf = exports.PDF_RENDERER_PACKAGE_VERSION = void 0;
34
- exports.PDF_RENDERER_PACKAGE_VERSION = '0.5.0';
35
+ exports.receiptDescriptor = exports.ReceiptPdf = exports.invoiceDescriptor = exports.InvoicePdf = exports.PDF_RENDERER_PACKAGE_VERSION = void 0;
36
+ exports.PDF_RENDERER_PACKAGE_VERSION = '0.6.0';
35
37
  // Core + primitives + components + descriptor registry from Sprint C.0.
36
38
  __exportStar(require("./core"), exports);
37
39
  __exportStar(require("./primitives"), exports);
@@ -46,4 +48,13 @@ var InvoicePdf_1 = require("./documents/InvoicePdf");
46
48
  Object.defineProperty(exports, "InvoicePdf", { enumerable: true, get: function () { return InvoicePdf_1.InvoicePdf; } });
47
49
  var invoice_1 = require("./descriptors/invoice");
48
50
  Object.defineProperty(exports, "invoiceDescriptor", { enumerable: true, get: function () { return invoice_1.invoiceDescriptor; } });
51
+ // C.1.2 — second concrete document. Same self-registration pattern as the
52
+ // invoice descriptor: importing the descriptor file registers it with the
53
+ // registry, so consumers that only `import '@aibrains/pdf-renderer'` get
54
+ // `getDescriptor('RECEIPT')` working without an explicit subpath import.
55
+ require("./descriptors/receipt");
56
+ var ReceiptPdf_1 = require("./documents/ReceiptPdf");
57
+ Object.defineProperty(exports, "ReceiptPdf", { enumerable: true, get: function () { return ReceiptPdf_1.ReceiptPdf; } });
58
+ var receipt_1 = require("./descriptors/receipt");
59
+ Object.defineProperty(exports, "receiptDescriptor", { enumerable: true, get: function () { return receipt_1.receiptDescriptor; } });
49
60
  //# 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;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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;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;AAE1B,0EAA0E;AAC1E,0EAA0E;AAC1E,yEAAyE;AACzE,yEAAyE;AACzE,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.5.0",
3
+ "version": "0.6.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",