75 lines
2.7 KiB
JavaScript
75 lines
2.7 KiB
JavaScript
import fs from 'node:fs';
|
|
import { BUILDERS } from '../src/tools/artifacts/documents.js';
|
|
|
|
const out = 'C:/Users/HP/AppData/Local/Temp/claude/c--Users-HP-Desktop-Dev-Agentic-AI/8b30e040-7edd-46bd-97f0-c9d03d3965cf/scratchpad';
|
|
|
|
const spec = {
|
|
title: 'WeLe CRM — Performance Review',
|
|
subtitle: 'Last 90 days · generated from live CRM data',
|
|
summary:
|
|
'Lead volume is healthy at 3,371 new leads, but conversion is the constraint: only 14 of 97 payment '
|
|
+ 'attempts completed (14.4%), leaving ₹363,817 in abandoned checkouts. The largest funnel leak is '
|
|
+ 'new_lead → contacted, where 91% of leads never receive a first touch.',
|
|
sections: [
|
|
{
|
|
heading: 'Headline figures',
|
|
kpis: [
|
|
{ label: 'New leads', value: '3,371' },
|
|
{ label: 'Paid enrolments', value: '14' },
|
|
{ label: 'Payment success', value: '14.4%' },
|
|
{ label: 'Abandoned value', value: '₹3.64L' },
|
|
],
|
|
text: 'Volume is not the problem. Follow-up capacity is.',
|
|
},
|
|
{
|
|
heading: 'Pipeline by stage',
|
|
chart: {
|
|
type: 'bar', title: 'Leads by stage', format: 'number',
|
|
data: [
|
|
{ label: 'new_lead', value: 3417 }, { label: 'contacted', value: 500 },
|
|
{ label: 'lost', value: 282 }, { label: 'qualified', value: 59 },
|
|
{ label: 'demo', value: 4 }, { label: 'converted', value: 4 },
|
|
],
|
|
},
|
|
bullets: [
|
|
'76.6% of all leads have never moved past new_lead.',
|
|
'Only 59 leads reached qualified in 90 days.',
|
|
],
|
|
},
|
|
{
|
|
heading: 'Payment attempts',
|
|
chart: {
|
|
type: 'donut', title: 'Attempts by status', center_label: 'attempts',
|
|
data: [{ label: 'CANCELLED', value: 206 }, { label: 'SUCCESS', value: 39 }, { label: 'FAILED', value: 5 }, { label: 'ERROR', value: 3 }],
|
|
},
|
|
},
|
|
{
|
|
heading: 'Top batches',
|
|
table: {
|
|
columns: ['Batch', 'Paid', 'Attempts', 'Revenue', 'Success %'],
|
|
rows: [
|
|
['AI Basics for Manufacturing', 12, 59, 18400, 20.3],
|
|
['AI Quality Inspection', 8, 31, 9200, 25.8],
|
|
['Build Your First AI Agent in 60 Minutes (Live)', 6, 31, 4300, 19.4],
|
|
['AI for IoT & Sensors', 3, 14, 1800, 21.4],
|
|
['Digital Marketing Mastery', 2, 12, 1200, 16.7],
|
|
],
|
|
},
|
|
},
|
|
],
|
|
};
|
|
|
|
for (const [ext, build] of Object.entries(BUILDERS)) {
|
|
const t = Date.now();
|
|
try {
|
|
const buf = await build(spec);
|
|
const p = `${out}/report.${ext}`;
|
|
fs.writeFileSync(p, buf);
|
|
console.log(`PASS ${ext.padEnd(5)} ${String((buf.length / 1024).toFixed(1)).padStart(8)} kB ${Date.now() - t}ms`);
|
|
} catch (e) {
|
|
console.log(`FAIL ${ext.padEnd(5)} ${e.message}`);
|
|
console.log(e.stack?.split('\n').slice(1, 4).join('\n'));
|
|
}
|
|
}
|
|
process.exit(0);
|