chromiumly
Version:
A lightweight Typescript library that interacts with Gotenberg's different modules to convert a variety of document formats to PDF files.
47 lines (46 loc) • 2.01 kB
TypeScript
export type Currency = 'USD' | 'EUR' | 'GBP' | 'JPY' | 'CNY' | 'CHF' | 'CAD' | 'AUD' | 'INR' | 'BRL' | 'MXN' | 'SGD' | 'HKD' | 'NOK' | 'SEK' | 'DKK' | 'NZD' | 'ZAR' | 'AED' | 'SAR' | 'KWD' | 'QAR' | 'BHD' | 'OMR' | 'JOD' | 'EGP' | 'MAD' | 'TND' | 'NGN' | 'KES' | 'GHS' | 'TZS' | 'UGX' | 'ETB' | 'XOF' | 'XAF' | 'TRY' | 'RUB' | 'PLN' | 'CZK' | 'HUF' | 'RON' | 'BGN' | 'HRK' | 'RSD' | 'UAH' | 'ILS' | 'PKR' | 'BDT' | 'LKR' | 'NPR' | 'MMK' | 'THB' | 'VND' | 'IDR' | 'MYR' | 'PHP' | 'KRW' | 'TWD' | 'MNT' | 'KZT' | 'UZS' | 'GEL' | 'AMD' | 'AZN' | 'IRR' | 'IQD' | 'CLP' | 'COP' | 'ARS' | 'PEN' | 'UYU' | 'BOB' | 'PYG' | 'VES' | 'CRC' | 'GTQ' | 'HNL' | 'NIO' | 'DOP' | 'CUP' | 'JMD' | 'TTD' | 'BBD' | 'XCD';
export type TemplateType = 'invoice_freelancer' | 'invoice_saas' | 'invoice_classic' | 'invoice_minimal' | 'invoice_modern';
export interface TemplateParty {
name: string;
addressLine1: string;
addressLine2?: string;
tax?: string;
iban?: string;
bic?: string;
}
export interface InvoiceItem {
description: string;
qty: number;
unitPrice: string;
amount: string;
}
export interface InvoiceSaasTemplateData {
invoiceNumber: string;
createdDate: string;
dueDate: string;
companyLogo?: string;
sender: TemplateParty;
receiver: TemplateParty;
items: InvoiceItem[];
currency: Currency;
subTotal: string;
taxRate: number;
taxAmount: string;
total: string;
footerNote: string;
footerDisclaimer?: string;
}
export interface InvoiceClassicTemplateData extends Omit<InvoiceSaasTemplateData, 'companyLogo'> {
companyLogo: string;
}
export interface TemplateDataByType {
invoice_saas: InvoiceSaasTemplateData;
invoice_freelancer: InvoiceSaasTemplateData;
invoice_classic: InvoiceClassicTemplateData;
invoice_minimal: InvoiceSaasTemplateData;
invoice_modern: InvoiceSaasTemplateData;
}
export type TemplateRequest<TType extends TemplateType> = {
type: TType;
data: TemplateDataByType[TType];
};