@formepdf/mcp 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.
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+ export const receiptSchema = z.object({
3
+ receiptNumber: z.string().describe('Receipt identifier, e.g. "R-84291"'),
4
+ date: z.string().describe('Purchase date'),
5
+ taxRate: z.number().describe('Tax rate as decimal, e.g. 0.0875 for 8.75%'),
6
+ store: z.object({
7
+ name: z.string(),
8
+ address: z.string(),
9
+ cityStateZip: z.string(),
10
+ phone: z.string(),
11
+ website: z.string(),
12
+ }).describe('Store details'),
13
+ items: z.array(z.object({
14
+ name: z.string(),
15
+ price: z.number(),
16
+ quantity: z.number().optional().describe('Defaults to 1'),
17
+ })).describe('Purchased items'),
18
+ paymentMethod: z.string().describe('Payment method, e.g. "Visa"'),
19
+ cardLastFour: z.string().optional().describe('Last 4 digits of card'),
20
+ });
21
+ export const receiptDescription = 'Simple retail receipt with store header, itemized purchases, tax calculation, and payment method.';
22
+ export const receiptFields = {
23
+ receiptNumber: 'string - receipt identifier',
24
+ date: 'string - purchase date',
25
+ taxRate: 'number - tax rate as decimal',
26
+ store: 'object - store name, address, phone, website',
27
+ items: 'array - items with name, price, and optional quantity',
28
+ paymentMethod: 'string - payment method name',
29
+ cardLastFour: 'string? - last 4 digits of card',
30
+ };
31
+ export const receiptExample = {
32
+ receiptNumber: 'R-84291',
33
+ date: 'February 14, 2026',
34
+ taxRate: 0.0875,
35
+ store: {
36
+ name: 'Golden Gate Provisions',
37
+ address: '742 Valencia Street',
38
+ cityStateZip: 'San Francisco, CA 94110',
39
+ phone: '(415) 555-0198',
40
+ website: 'www.goldengateprovisions.com',
41
+ },
42
+ items: [
43
+ { name: 'Organic Sourdough Loaf', price: 7.50, quantity: 2 },
44
+ { name: 'Heirloom Tomatoes (1 lb)', price: 5.99, quantity: 1 },
45
+ { name: 'Local Wildflower Honey (12 oz)', price: 12.00, quantity: 1 },
46
+ { name: 'Free-Range Eggs (dozen)', price: 8.50, quantity: 1 },
47
+ { name: 'Artisan Cheddar (8 oz)', price: 9.75, quantity: 1 },
48
+ { name: 'Cold Brew Coffee (16 oz)', price: 6.50, quantity: 2 },
49
+ ],
50
+ paymentMethod: 'Visa',
51
+ cardLastFour: '4821',
52
+ };
@@ -0,0 +1,158 @@
1
+ import { z } from 'zod';
2
+ export declare const reportSchema: z.ZodObject<{
3
+ title: z.ZodString;
4
+ subtitle: z.ZodString;
5
+ author: z.ZodString;
6
+ department: z.ZodString;
7
+ company: z.ZodString;
8
+ date: z.ZodString;
9
+ classification: z.ZodString;
10
+ keyMetrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
11
+ value: z.ZodString;
12
+ label: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ value: string;
15
+ label: string;
16
+ }, {
17
+ value: string;
18
+ label: string;
19
+ }>, "many">>;
20
+ sections: z.ZodArray<z.ZodObject<{
21
+ title: z.ZodString;
22
+ paragraphs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
23
+ intro: z.ZodOptional<z.ZodString>;
24
+ tableData: z.ZodOptional<z.ZodArray<z.ZodObject<{
25
+ region: z.ZodString;
26
+ q1: z.ZodString;
27
+ q2: z.ZodString;
28
+ q3: z.ZodString;
29
+ q4: z.ZodString;
30
+ }, "strip", z.ZodTypeAny, {
31
+ region: string;
32
+ q1: string;
33
+ q2: string;
34
+ q3: string;
35
+ q4: string;
36
+ }, {
37
+ region: string;
38
+ q1: string;
39
+ q2: string;
40
+ q3: string;
41
+ q4: string;
42
+ }>, "many">>;
43
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ title: z.ZodString;
45
+ description: z.ZodString;
46
+ priority: z.ZodString;
47
+ timeline: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ description: string;
50
+ title: string;
51
+ priority: string;
52
+ timeline: string;
53
+ }, {
54
+ description: string;
55
+ title: string;
56
+ priority: string;
57
+ timeline: string;
58
+ }>, "many">>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ title: string;
61
+ items?: {
62
+ description: string;
63
+ title: string;
64
+ priority: string;
65
+ timeline: string;
66
+ }[] | undefined;
67
+ paragraphs?: string[] | undefined;
68
+ intro?: string | undefined;
69
+ tableData?: {
70
+ region: string;
71
+ q1: string;
72
+ q2: string;
73
+ q3: string;
74
+ q4: string;
75
+ }[] | undefined;
76
+ }, {
77
+ title: string;
78
+ items?: {
79
+ description: string;
80
+ title: string;
81
+ priority: string;
82
+ timeline: string;
83
+ }[] | undefined;
84
+ paragraphs?: string[] | undefined;
85
+ intro?: string | undefined;
86
+ tableData?: {
87
+ region: string;
88
+ q1: string;
89
+ q2: string;
90
+ q3: string;
91
+ q4: string;
92
+ }[] | undefined;
93
+ }>, "many">;
94
+ }, "strip", z.ZodTypeAny, {
95
+ date: string;
96
+ company: string;
97
+ title: string;
98
+ author: string;
99
+ subtitle: string;
100
+ department: string;
101
+ classification: string;
102
+ sections: {
103
+ title: string;
104
+ items?: {
105
+ description: string;
106
+ title: string;
107
+ priority: string;
108
+ timeline: string;
109
+ }[] | undefined;
110
+ paragraphs?: string[] | undefined;
111
+ intro?: string | undefined;
112
+ tableData?: {
113
+ region: string;
114
+ q1: string;
115
+ q2: string;
116
+ q3: string;
117
+ q4: string;
118
+ }[] | undefined;
119
+ }[];
120
+ keyMetrics?: {
121
+ value: string;
122
+ label: string;
123
+ }[] | undefined;
124
+ }, {
125
+ date: string;
126
+ company: string;
127
+ title: string;
128
+ author: string;
129
+ subtitle: string;
130
+ department: string;
131
+ classification: string;
132
+ sections: {
133
+ title: string;
134
+ items?: {
135
+ description: string;
136
+ title: string;
137
+ priority: string;
138
+ timeline: string;
139
+ }[] | undefined;
140
+ paragraphs?: string[] | undefined;
141
+ intro?: string | undefined;
142
+ tableData?: {
143
+ region: string;
144
+ q1: string;
145
+ q2: string;
146
+ q3: string;
147
+ q4: string;
148
+ }[] | undefined;
149
+ }[];
150
+ keyMetrics?: {
151
+ value: string;
152
+ label: string;
153
+ }[] | undefined;
154
+ }>;
155
+ export type ReportData = z.infer<typeof reportSchema>;
156
+ export declare const reportDescription = "Multi-page business report with cover page, table of contents, executive summary, data tables with charts, and recommendations.";
157
+ export declare const reportFields: Record<string, string>;
158
+ export declare const reportExample: ReportData;
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod';
2
+ const tableRowSchema = z.object({
3
+ region: z.string(),
4
+ q1: z.string(),
5
+ q2: z.string(),
6
+ q3: z.string(),
7
+ q4: z.string(),
8
+ });
9
+ const recommendationSchema = z.object({
10
+ title: z.string(),
11
+ description: z.string(),
12
+ priority: z.string(),
13
+ timeline: z.string(),
14
+ });
15
+ const sectionSchema = z.object({
16
+ title: z.string(),
17
+ paragraphs: z.array(z.string()).optional(),
18
+ intro: z.string().optional(),
19
+ tableData: z.array(tableRowSchema).optional(),
20
+ items: z.array(recommendationSchema).optional(),
21
+ });
22
+ export const reportSchema = z.object({
23
+ title: z.string().describe('Report title'),
24
+ subtitle: z.string().describe('Report subtitle'),
25
+ author: z.string().describe('Author name'),
26
+ department: z.string().describe('Department name'),
27
+ company: z.string().describe('Company name'),
28
+ date: z.string().describe('Report date'),
29
+ classification: z.string().describe('Document classification, e.g. "Internal - Confidential"'),
30
+ keyMetrics: z.array(z.object({
31
+ value: z.string(),
32
+ label: z.string(),
33
+ })).optional().describe('Key metric cards shown after executive summary'),
34
+ sections: z.array(sectionSchema).describe('Report sections: [0] Executive Summary (paragraphs), [1] Data (tableData), [2] Visual Analysis (intro only), [3] Recommendations (items)'),
35
+ });
36
+ export const reportDescription = 'Multi-page business report with cover page, table of contents, executive summary, data tables with charts, and recommendations.';
37
+ export const reportFields = {
38
+ title: 'string - report title',
39
+ subtitle: 'string - report subtitle',
40
+ author: 'string - author name',
41
+ department: 'string - department',
42
+ company: 'string - company name',
43
+ date: 'string - report date',
44
+ classification: 'string - confidentiality level',
45
+ keyMetrics: 'array? - metric cards with value and label',
46
+ sections: 'array - 4 sections: executive summary, data table, visual analysis, recommendations',
47
+ };
48
+ export const reportExample = {
49
+ title: 'Annual Performance Review',
50
+ subtitle: 'Fiscal Year 2025 Results and Strategic Outlook',
51
+ author: 'Rachel Torres',
52
+ department: 'Strategy & Operations',
53
+ company: 'Cascadia Holdings',
54
+ date: 'January 28, 2026',
55
+ classification: 'Internal - Confidential',
56
+ keyMetrics: [
57
+ { value: '$142M', label: 'Total Revenue' },
58
+ { value: '+18%', label: 'Year-over-Year Growth' },
59
+ { value: '94.2%', label: 'Customer Retention' },
60
+ ],
61
+ sections: [
62
+ {
63
+ title: 'Executive Summary',
64
+ paragraphs: [
65
+ 'Fiscal year 2025 marked a period of sustained growth, with consolidated revenue reaching $142 million, an 18% increase over the prior year.',
66
+ 'Customer retention remained above target at 94.2%, reflecting continued investment in support infrastructure and product reliability.',
67
+ 'Operating margins expanded by 2.3 percentage points to 31.4%, driven by economies of scale.',
68
+ ],
69
+ },
70
+ {
71
+ title: 'Revenue by Region',
72
+ intro: 'Quarterly revenue (in millions) by operating region for fiscal year 2025.',
73
+ tableData: [
74
+ { region: 'Pacific Northwest', q1: '$12.4M', q2: '$13.1M', q3: '$14.2M', q4: '$15.8M' },
75
+ { region: 'Northern California', q1: '$8.7M', q2: '$9.2M', q3: '$9.8M', q4: '$10.1M' },
76
+ { region: 'Southern California', q1: '$6.3M', q2: '$6.8M', q3: '$7.1M', q4: '$7.5M' },
77
+ { region: 'Southeast', q1: '$3.2M', q2: '$4.1M', q3: '$4.8M', q4: '$5.6M' },
78
+ ],
79
+ },
80
+ {
81
+ title: 'Visual Analysis',
82
+ intro: 'Charts illustrating key trends in regional performance and quarterly growth.',
83
+ },
84
+ {
85
+ title: 'Recommendations',
86
+ intro: 'Strategic initiatives for the coming fiscal year.',
87
+ items: [
88
+ { title: 'Accelerate Southeast Expansion', description: 'Open regional office in Atlanta with 8 new sales headcount.', priority: 'High', timeline: 'Q1 2026' },
89
+ { title: 'Launch Enterprise Tier', description: 'Dedicated enterprise tier with custom SLAs and advanced analytics.', priority: 'High', timeline: 'Q2 2026' },
90
+ { title: 'International Pilot Program', description: 'Evaluate expansion into Canada and the UK with 10-15 pilot customers.', priority: 'Medium', timeline: 'Q3 2026' },
91
+ ],
92
+ },
93
+ ],
94
+ };
@@ -0,0 +1,75 @@
1
+ import { z } from 'zod';
2
+ export declare const shippingLabelSchema: z.ZodObject<{
3
+ tracking: z.ZodString;
4
+ service: z.ZodString;
5
+ weight: z.ZodString;
6
+ dimensions: z.ZodString;
7
+ from: z.ZodObject<{
8
+ name: z.ZodString;
9
+ address: z.ZodString;
10
+ cityStateZip: z.ZodString;
11
+ }, "strip", z.ZodTypeAny, {
12
+ name: string;
13
+ address: string;
14
+ cityStateZip: string;
15
+ }, {
16
+ name: string;
17
+ address: string;
18
+ cityStateZip: string;
19
+ }>;
20
+ to: z.ZodObject<{
21
+ name: z.ZodString;
22
+ address: z.ZodString;
23
+ address2: z.ZodOptional<z.ZodString>;
24
+ cityStateZip: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ name: string;
27
+ address: string;
28
+ cityStateZip: string;
29
+ address2?: string | undefined;
30
+ }, {
31
+ name: string;
32
+ address: string;
33
+ cityStateZip: string;
34
+ address2?: string | undefined;
35
+ }>;
36
+ stamps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ tracking: string;
39
+ service: string;
40
+ weight: string;
41
+ dimensions: string;
42
+ from: {
43
+ name: string;
44
+ address: string;
45
+ cityStateZip: string;
46
+ };
47
+ to: {
48
+ name: string;
49
+ address: string;
50
+ cityStateZip: string;
51
+ address2?: string | undefined;
52
+ };
53
+ stamps?: string[] | undefined;
54
+ }, {
55
+ tracking: string;
56
+ service: string;
57
+ weight: string;
58
+ dimensions: string;
59
+ from: {
60
+ name: string;
61
+ address: string;
62
+ cityStateZip: string;
63
+ };
64
+ to: {
65
+ name: string;
66
+ address: string;
67
+ cityStateZip: string;
68
+ address2?: string | undefined;
69
+ };
70
+ stamps?: string[] | undefined;
71
+ }>;
72
+ export type ShippingLabelData = z.infer<typeof shippingLabelSchema>;
73
+ export declare const shippingLabelDescription = "Compact 4x6 shipping label with sender/recipient addresses, barcode placeholder, tracking number, and handling stamps.";
74
+ export declare const shippingLabelFields: Record<string, string>;
75
+ export declare const shippingLabelExample: ShippingLabelData;
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ export const shippingLabelSchema = z.object({
3
+ tracking: z.string().describe('Tracking number'),
4
+ service: z.string().describe('Shipping service level, e.g. "Priority"'),
5
+ weight: z.string().describe('Package weight, e.g. "4.2 lbs"'),
6
+ dimensions: z.string().describe('Package dimensions, e.g. "12 x 8 x 6 in"'),
7
+ from: z.object({
8
+ name: z.string(),
9
+ address: z.string(),
10
+ cityStateZip: z.string(),
11
+ }).describe('Sender address'),
12
+ to: z.object({
13
+ name: z.string(),
14
+ address: z.string(),
15
+ address2: z.string().optional(),
16
+ cityStateZip: z.string(),
17
+ }).describe('Recipient address'),
18
+ stamps: z.array(z.string()).optional().describe('Handling stamps, e.g. ["FRAGILE", "THIS SIDE UP"]'),
19
+ });
20
+ export const shippingLabelDescription = 'Compact 4x6 shipping label with sender/recipient addresses, barcode placeholder, tracking number, and handling stamps.';
21
+ export const shippingLabelFields = {
22
+ tracking: 'string - tracking number',
23
+ service: 'string - shipping service level',
24
+ weight: 'string - package weight',
25
+ dimensions: 'string - package dimensions',
26
+ from: 'object - sender name, address, cityStateZip',
27
+ to: 'object - recipient name, address, optional address2, cityStateZip',
28
+ stamps: 'array? - handling stamps like "FRAGILE"',
29
+ };
30
+ export const shippingLabelExample = {
31
+ tracking: '1Z 999 AA1 0123 4567 890',
32
+ service: 'Priority',
33
+ weight: '4.2 lbs',
34
+ dimensions: '12 x 8 x 6 in',
35
+ from: {
36
+ name: 'Cascade Electronics',
37
+ address: '2901 Third Avenue, Unit 4B',
38
+ cityStateZip: 'Seattle, WA 98121',
39
+ },
40
+ to: {
41
+ name: 'Marcus Webb',
42
+ address: '1455 Pennsylvania Ave NW',
43
+ address2: 'Apt 712',
44
+ cityStateZip: 'Washington, DC 20004',
45
+ },
46
+ stamps: ['FRAGILE', 'THIS SIDE UP'],
47
+ };
@@ -0,0 +1,10 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { z } from 'zod';
3
+ export interface TemplateEntry {
4
+ fn: (data: any) => ReactElement;
5
+ description: string;
6
+ fields: Record<string, string>;
7
+ schema: z.ZodType;
8
+ example: Record<string, unknown>;
9
+ }
10
+ export declare const templates: Record<string, TemplateEntry>;
@@ -0,0 +1,47 @@
1
+ import Invoice from './invoice.js';
2
+ import Receipt from './receipt.js';
3
+ import Report from './report.js';
4
+ import ShippingLabel from './shipping-label.js';
5
+ import Letter from './letter.js';
6
+ import { invoiceSchema, invoiceDescription, invoiceFields, invoiceExample } from '../schemas/invoice.js';
7
+ import { receiptSchema, receiptDescription, receiptFields, receiptExample } from '../schemas/receipt.js';
8
+ import { reportSchema, reportDescription, reportFields, reportExample } from '../schemas/report.js';
9
+ import { shippingLabelSchema, shippingLabelDescription, shippingLabelFields, shippingLabelExample } from '../schemas/shipping-label.js';
10
+ import { letterSchema, letterDescription, letterFields, letterExample } from '../schemas/letter.js';
11
+ export const templates = {
12
+ invoice: {
13
+ fn: Invoice,
14
+ description: invoiceDescription,
15
+ fields: invoiceFields,
16
+ schema: invoiceSchema,
17
+ example: invoiceExample,
18
+ },
19
+ receipt: {
20
+ fn: Receipt,
21
+ description: receiptDescription,
22
+ fields: receiptFields,
23
+ schema: receiptSchema,
24
+ example: receiptExample,
25
+ },
26
+ report: {
27
+ fn: Report,
28
+ description: reportDescription,
29
+ fields: reportFields,
30
+ schema: reportSchema,
31
+ example: reportExample,
32
+ },
33
+ 'shipping-label': {
34
+ fn: ShippingLabel,
35
+ description: shippingLabelDescription,
36
+ fields: shippingLabelFields,
37
+ schema: shippingLabelSchema,
38
+ example: shippingLabelExample,
39
+ },
40
+ letter: {
41
+ fn: Letter,
42
+ description: letterDescription,
43
+ fields: letterFields,
44
+ schema: letterSchema,
45
+ example: letterExample,
46
+ },
47
+ };
@@ -0,0 +1,2 @@
1
+ import type { InvoiceData } from '../schemas/invoice.js';
2
+ export default function Invoice(data: InvoiceData): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Document, Page, View, Text, Table, Row, Cell, Fixed } from '@formepdf/react';
3
+ export default function Invoice(data) {
4
+ const items = data.items || [];
5
+ const subtotal = items.reduce((sum, item) => sum + item.quantity * item.unitPrice, 0);
6
+ const tax = subtotal * (data.taxRate || 0);
7
+ const total = subtotal + tax;
8
+ return (_jsx(Document, { title: `Invoice ${data.invoiceNumber}`, author: data.company.name, children: _jsxs(Page, { size: "Letter", margin: 48, children: [_jsx(Fixed, { position: "footer", children: _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', paddingTop: 8, borderTopWidth: 1, borderColor: '#e2e8f0' }, children: [_jsx(Text, { style: { fontSize: 8, color: '#94a3b8' }, children: data.company.name }), _jsxs(Text, { style: { fontSize: 8, color: '#94a3b8' }, children: ["Page ", '{{pageNumber}}', " of ", '{{totalPages}}'] })] }) }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', marginBottom: 32 }, children: [_jsxs(View, { children: [_jsx(View, { style: { width: 48, height: 48, backgroundColor: '#2563eb', borderRadius: 8, marginBottom: 12, justifyContent: 'center', alignItems: 'center' }, children: _jsx(Text, { style: { fontSize: 18, fontWeight: 700, color: '#ffffff', textAlign: 'center', lineHeight: 1.2 }, children: data.company.initials }) }), _jsx(Text, { style: { fontSize: 16, fontWeight: 700, color: '#1e293b' }, children: data.company.name }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 4 }, children: data.company.address }), _jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: data.company.cityStateZip }), _jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: data.company.email })] }), _jsxs(View, { style: { alignItems: 'flex-end' }, children: [_jsx(Text, { style: { fontSize: 32, fontWeight: 700, color: '#2563eb' }, children: "INVOICE" }), _jsxs(Text, { style: { fontSize: 10, color: '#64748b', marginTop: 8 }, children: ["Invoice No: ", data.invoiceNumber] }), _jsxs(Text, { style: { fontSize: 10, color: '#64748b', marginTop: 2 }, children: ["Date: ", data.date] }), _jsxs(Text, { style: { fontSize: 10, color: '#64748b', marginTop: 2 }, children: ["Due: ", data.dueDate] })] })] }), _jsxs(View, { style: { flexDirection: 'row', gap: 32, marginBottom: 24 }, children: [_jsxs(View, { style: { flexGrow: 1 }, children: [_jsx(Text, { style: { fontSize: 9, fontWeight: 700, color: '#2563eb', textTransform: 'uppercase', letterSpacing: 1, marginBottom: 8 }, children: "Bill To" }), _jsx(Text, { style: { fontSize: 10, fontWeight: 700, color: '#1e293b' }, children: data.billTo.name }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.billTo.company }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.billTo.address }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.billTo.cityStateZip }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.billTo.email })] }), _jsxs(View, { style: { flexGrow: 1 }, children: [_jsx(Text, { style: { fontSize: 9, fontWeight: 700, color: '#2563eb', textTransform: 'uppercase', letterSpacing: 1, marginBottom: 8 }, children: "Ship To" }), _jsx(Text, { style: { fontSize: 10, fontWeight: 700, color: '#1e293b' }, children: data.shipTo.name }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.shipTo.address }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.shipTo.cityStateZip })] })] }), _jsxs(Table, { columns: [
9
+ { width: { fraction: 0.45 } },
10
+ { width: { fraction: 0.15 } },
11
+ { width: { fraction: 0.2 } },
12
+ { width: { fraction: 0.2 } }
13
+ ], children: [_jsxs(Row, { header: true, style: { backgroundColor: '#2563eb' }, children: [_jsx(Cell, { style: { padding: 10 }, children: _jsx(Text, { style: { fontSize: 9, fontWeight: 700, color: '#ffffff' }, children: "Description" }) }), _jsx(Cell, { style: { padding: 10 }, children: _jsx(Text, { style: { fontSize: 9, fontWeight: 700, color: '#ffffff', textAlign: 'center' }, children: "Qty" }) }), _jsx(Cell, { style: { padding: 10 }, children: _jsx(Text, { style: { fontSize: 9, fontWeight: 700, color: '#ffffff', textAlign: 'right' }, children: "Unit Price" }) }), _jsx(Cell, { style: { padding: 10 }, children: _jsx(Text, { style: { fontSize: 9, fontWeight: 700, color: '#ffffff', textAlign: 'right' }, children: "Amount" }) })] }), items.map((item, i) => (_jsxs(Row, { style: { backgroundColor: i % 2 === 0 ? '#ffffff' : '#f8fafc' }, children: [_jsx(Cell, { style: { padding: 10 }, children: _jsx(Text, { style: { fontSize: 9, color: '#1e293b' }, children: item.description }) }), _jsx(Cell, { style: { padding: 10 }, children: _jsx(Text, { style: { fontSize: 9, color: '#475569', textAlign: 'center' }, children: item.quantity }) }), _jsx(Cell, { style: { padding: 10 }, children: _jsxs(Text, { style: { fontSize: 9, color: '#475569', textAlign: 'right' }, children: ["$", item.unitPrice.toFixed(2)] }) }), _jsx(Cell, { style: { padding: 10 }, children: _jsxs(Text, { style: { fontSize: 9, color: '#1e293b', textAlign: 'right' }, children: ["$", (item.quantity * item.unitPrice).toFixed(2)] }) })] }, i)))] }), _jsx(View, { style: { flexDirection: 'row', justifyContent: 'flex-end', marginTop: 16 }, children: _jsxs(View, { style: { width: 200 }, children: [_jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', padding: 8 }, children: [_jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: "Subtotal" }), _jsxs(Text, { style: { fontSize: 9, color: '#1e293b' }, children: ["$", subtotal.toFixed(2)] })] }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', padding: 8 }, children: [_jsxs(Text, { style: { fontSize: 9, color: '#64748b' }, children: ["Tax (", (data.taxRate * 100).toFixed(0), "%)"] }), _jsxs(Text, { style: { fontSize: 9, color: '#1e293b' }, children: ["$", tax.toFixed(2)] })] }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', padding: 12, backgroundColor: '#2563eb', borderRadius: 4, marginTop: 4 }, children: [_jsx(Text, { style: { fontSize: 11, fontWeight: 700, color: '#ffffff' }, children: "Total Due" }), _jsxs(Text, { style: { fontSize: 11, fontWeight: 700, color: '#ffffff' }, children: ["$", total.toFixed(2)] })] })] }) }), _jsxs(View, { style: { marginTop: 32, padding: 16, backgroundColor: '#f8fafc', borderRadius: 4 }, children: [_jsx(Text, { style: { fontSize: 9, fontWeight: 700, color: '#1e293b', marginBottom: 8 }, children: "Payment Terms" }), _jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: data.paymentTerms })] }), data.notes && (_jsxs(View, { style: { marginTop: 16 }, children: [_jsx(Text, { style: { fontSize: 9, fontWeight: 700, color: '#1e293b', marginBottom: 4 }, children: "Notes" }), _jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: data.notes })] }))] }) }));
14
+ }
@@ -0,0 +1,2 @@
1
+ import type { LetterData } from '../schemas/letter.js';
2
+ export default function Letter(data: LetterData): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Document, Page, View, Text } from '@formepdf/react';
3
+ export default function Letter(data) {
4
+ return (_jsx(Document, { title: `Letter to ${data.recipient.name}`, author: data.sender.name, children: _jsxs(Page, { size: "Letter", margin: { top: 72, right: 72, bottom: 72, left: 72 }, children: [_jsxs(View, { style: { marginBottom: 32 }, children: [_jsx(Text, { style: { fontSize: 16, fontWeight: 700, color: '#1e293b' }, children: data.sender.company }), _jsx(View, { style: { borderTopWidth: 2, borderColor: '#2563eb', marginTop: 8, marginBottom: 12 } }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between' }, children: [_jsxs(View, { children: [_jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: data.sender.address }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.sender.cityStateZip })] }), _jsxs(View, { style: { alignItems: 'flex-end' }, children: [data.sender.phone && (_jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: data.sender.phone })), data.sender.email && (_jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.sender.email }))] })] })] }), _jsx(Text, { style: { fontSize: 10, color: '#1e293b', marginBottom: 24 }, children: data.date }), _jsxs(View, { style: { marginBottom: 24 }, children: [_jsx(Text, { style: { fontSize: 10, color: '#1e293b' }, children: data.recipient.name }), data.recipient.title && (_jsx(Text, { style: { fontSize: 10, color: '#1e293b', marginTop: 2 }, children: data.recipient.title })), data.recipient.company && (_jsx(Text, { style: { fontSize: 10, color: '#1e293b', marginTop: 2 }, children: data.recipient.company })), _jsx(Text, { style: { fontSize: 10, color: '#1e293b', marginTop: 2 }, children: data.recipient.address }), _jsx(Text, { style: { fontSize: 10, color: '#1e293b', marginTop: 2 }, children: data.recipient.cityStateZip })] }), _jsx(Text, { style: { fontSize: 10, color: '#1e293b', marginBottom: 16 }, children: data.salutation }), data.body.map((paragraph, i) => (_jsx(Text, { style: { fontSize: 10, color: '#334155', lineHeight: 1.6, marginBottom: 12 }, children: paragraph }, i))), _jsxs(View, { style: { marginTop: 16 }, children: [_jsx(Text, { style: { fontSize: 10, color: '#1e293b' }, children: data.closing }), _jsx(View, { style: { height: 48 } }), _jsx(Text, { style: { fontSize: 10, fontWeight: 700, color: '#1e293b' }, children: data.signatureName }), data.signatureTitle && (_jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.signatureTitle }))] })] }) }));
5
+ }
@@ -0,0 +1,2 @@
1
+ import type { ReceiptData } from '../schemas/receipt.js';
2
+ export default function Receipt(data: ReceiptData): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Document, Page, View, Text } from '@formepdf/react';
3
+ export default function Receipt(data) {
4
+ const items = data.items || [];
5
+ const subtotal = items.reduce((sum, item) => sum + item.price * (item.quantity || 1), 0);
6
+ const tax = subtotal * (data.taxRate || 0);
7
+ const total = subtotal + tax;
8
+ return (_jsx(Document, { title: `Receipt ${data.receiptNumber}`, author: data.store.name, children: _jsxs(Page, { size: "Letter", margin: { top: 72, right: 120, bottom: 72, left: 120 }, children: [_jsxs(View, { style: { alignItems: 'center', marginBottom: 24 }, children: [_jsx(Text, { style: { fontSize: 20, fontWeight: 700, color: '#1e293b' }, children: data.store.name }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 4 }, children: data.store.address }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.store.cityStateZip }), _jsx(Text, { style: { fontSize: 9, color: '#64748b', marginTop: 2 }, children: data.store.phone })] }), _jsx(View, { style: { borderTopWidth: 1, borderColor: '#e2e8f0', marginBottom: 16 } }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', marginBottom: 16 }, children: [_jsxs(Text, { style: { fontSize: 9, color: '#64748b' }, children: ["Receipt #", data.receiptNumber] }), _jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: data.date })] }), items.map((item, i) => (_jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', paddingTop: 6, paddingBottom: 6 }, children: [_jsxs(View, { style: { flexDirection: 'row', gap: 8, flexGrow: 1 }, children: [_jsx(Text, { style: { fontSize: 9, color: '#1e293b' }, children: item.name }), (item.quantity || 1) > 1 && (_jsxs(Text, { style: { fontSize: 9, color: '#94a3b8' }, children: ["x", item.quantity] }))] }), _jsxs(Text, { style: { fontSize: 9, color: '#1e293b' }, children: ["$", (item.price * (item.quantity || 1)).toFixed(2)] })] }, i))), _jsx(View, { style: { borderTopWidth: 1, borderColor: '#e2e8f0', marginTop: 12, marginBottom: 12 } }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', paddingTop: 4, paddingBottom: 4 }, children: [_jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: "Subtotal" }), _jsxs(Text, { style: { fontSize: 9, color: '#1e293b' }, children: ["$", subtotal.toFixed(2)] })] }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', paddingTop: 4, paddingBottom: 4 }, children: [_jsxs(Text, { style: { fontSize: 9, color: '#64748b' }, children: ["Tax (", (data.taxRate * 100).toFixed(1), "%)"] }), _jsxs(Text, { style: { fontSize: 9, color: '#1e293b' }, children: ["$", tax.toFixed(2)] })] }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', paddingTop: 12, paddingBottom: 12, borderTopWidth: 2, borderColor: '#1e293b', marginTop: 4 }, children: [_jsx(Text, { style: { fontSize: 12, fontWeight: 700, color: '#1e293b' }, children: "Total" }), _jsxs(Text, { style: { fontSize: 12, fontWeight: 700, color: '#1e293b' }, children: ["$", total.toFixed(2)] })] }), _jsxs(View, { style: { marginTop: 16, paddingTop: 12, paddingBottom: 12, borderTopWidth: 1, borderColor: '#e2e8f0' }, children: [_jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between' }, children: [_jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: "Payment Method" }), _jsx(Text, { style: { fontSize: 9, color: '#1e293b' }, children: data.paymentMethod })] }), data.cardLastFour && (_jsxs(View, { style: { flexDirection: 'row', justifyContent: 'space-between', marginTop: 4 }, children: [_jsx(Text, { style: { fontSize: 9, color: '#64748b' }, children: "Card" }), _jsxs(Text, { style: { fontSize: 9, color: '#1e293b' }, children: ["****", data.cardLastFour] })] }))] }), _jsxs(View, { style: { alignItems: 'center', marginTop: 32 }, children: [_jsx(Text, { style: { fontSize: 10, color: '#64748b' }, children: "Thank you for your purchase!" }), _jsx(Text, { style: { fontSize: 8, color: '#94a3b8', marginTop: 8 }, children: data.store.website })] })] }) }));
9
+ }
@@ -0,0 +1,2 @@
1
+ import type { ReportData } from '../schemas/report.js';
2
+ export default function Report(data: ReportData): import("react/jsx-runtime").JSX.Element;