npm install clickup-invoice-generator
See example.ts
for fully functional example.
Copy .env.example
to .env
and run generator using
npm start
import { PDF } from 'clickup-invoice-generator';
const pdf = await new PDF().init();
import { renderTopBar, renderHeaders, renderCredentials } from 'clickup-invoice-generator';
renderTopBar({ pdf, invoiceId });
renderHeaders({
pdf,
from: {
name: 'Jane Doe',
address: '123 Main Street',
country: 'Czech Republic',
postalCode: '123',
ICO: '123',
DIC: '123',
},
to: {
name: 'John Doe',
address: '123 Main Street',
country: 'United States',
postalCode: '123',
},
});
renderCredentials({
pdf,
credentials: {
bankName: 'Revolut',
iban: 'LT123123123',
bic: '123123',
variable: '123', // Invoice ID
},
});
import { fetchTasks } from 'clickup-invoice-generator';
const tasks = await fetchTasks({
clickUp: {
privateKey: 'xxx',
teamId: 'xxx',
userId: 'xxx',
},
period: 'this', // 'last' for previous month
});
import { renderTasks, renderTotal } from 'clickup-invoice-generator';
const total = renderTasks({
pdf,
tasks,
salary: {
currency: '$',
perHour: 40,
},
});
renderTotal({
promo: true, // Please use `renderPromo({ pdf })` elsewhere if you set `false` here
pdf,
total,
currency: '$',
});
await pdf.save('invoice.pdf');
- TBD; only TS script available currently
- Remove
dotenv