@bookipi/htmlgenerator 1.1.35 → 1.1.37
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.
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +22 -5
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -10689,7 +10689,7 @@ var invoiceHtmlWithDetails = (function (_ref) {
|
|
|
10689
10689
|
t = _ref.t;
|
|
10690
10690
|
invoice = sanitize(invoice);
|
|
10691
10691
|
var defaultLang = {
|
|
10692
|
-
document: t ? t("Document") : lang["
|
|
10692
|
+
document: t ? t("Document") : lang["Invoice"],
|
|
10693
10693
|
creditNote: t ? t("Credit Note") : lang["creditnote"],
|
|
10694
10694
|
estimate: t ? t("Estimate") : lang["Estimate"],
|
|
10695
10695
|
by_signing: t ? t("By signing") : lang["by_signing"],
|
|
@@ -10728,7 +10728,7 @@ var invoiceHtmlWithDetails = (function (_ref) {
|
|
|
10728
10728
|
var signatureBase64 = invoice.signatureBase64;
|
|
10729
10729
|
var companyLogoVersion = invoice.companyLogoVersion;
|
|
10730
10730
|
var logoPath = company.lg === false ? null : invoice.logoPath || company.lg && "" + companyLogoBase + company._id + "/logo.jpg?v=" + companyLogoVersion;
|
|
10731
|
-
var
|
|
10731
|
+
var defaultocumentName = getDocumentName({
|
|
10732
10732
|
document: document,
|
|
10733
10733
|
company: company,
|
|
10734
10734
|
defaultLang: {
|
|
@@ -10737,6 +10737,7 @@ var invoiceHtmlWithDetails = (function (_ref) {
|
|
|
10737
10737
|
estimate: defaultLang.estimate
|
|
10738
10738
|
}
|
|
10739
10739
|
});
|
|
10740
|
+
var documentName = t ? t(defaultocumentName) : defaultocumentName;
|
|
10740
10741
|
var logoContainer = LogoContainer({
|
|
10741
10742
|
company: company,
|
|
10742
10743
|
logoPath: logoPath,
|
|
@@ -11385,7 +11386,8 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
11385
11386
|
invoice = _ref.invoice,
|
|
11386
11387
|
customer = _ref.customer,
|
|
11387
11388
|
_ref$includeHtmlWrapp = _ref.includeHtmlWrapper,
|
|
11388
|
-
includeHtmlWrapper = _ref$includeHtmlWrapp === void 0 ? false : _ref$includeHtmlWrapp
|
|
11389
|
+
includeHtmlWrapper = _ref$includeHtmlWrapp === void 0 ? false : _ref$includeHtmlWrapp,
|
|
11390
|
+
t = _ref.t;
|
|
11389
11391
|
var _ref2 = vendor != null ? vendor : {},
|
|
11390
11392
|
vendorName = _ref2.name,
|
|
11391
11393
|
logoUrl = _ref2.logoUrl;
|
|
@@ -11414,6 +11416,16 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
11414
11416
|
}
|
|
11415
11417
|
return (price ? Number(price / 100).toFixed(2) : '0') + " " + currency;
|
|
11416
11418
|
};
|
|
11419
|
+
var defaultLang = {
|
|
11420
|
+
invoiceNo: t ? t('Invoice #', {
|
|
11421
|
+
no: invoiceNumber
|
|
11422
|
+
}) : "Invoice #" + invoiceNumber,
|
|
11423
|
+
total: t ? t('Total') : 'Total',
|
|
11424
|
+
billTo: t ? t('Bill to') : 'Bill to',
|
|
11425
|
+
item: t ? t('Item') : 'Item',
|
|
11426
|
+
amount: t ? t('Amount') : 'Amount',
|
|
11427
|
+
totalCharged: t ? t('Total charged') : 'Total charged'
|
|
11428
|
+
};
|
|
11417
11429
|
var productItems = (_invoiceItems$filter = invoiceItems.filter(function (item) {
|
|
11418
11430
|
return item.type === 'product';
|
|
11419
11431
|
})) != null ? _invoiceItems$filter : [];
|
|
@@ -11427,13 +11439,18 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
11427
11439
|
return item.type === 'discount';
|
|
11428
11440
|
});
|
|
11429
11441
|
var renderItem = function renderItem(item, type) {
|
|
11442
|
+
var title = isDiscount ? item.name : item.description || item.name;
|
|
11443
|
+
var itemLang = {
|
|
11444
|
+
title: t ? t(title) : title,
|
|
11445
|
+
description: t ? t(item.description) : item.description
|
|
11446
|
+
};
|
|
11430
11447
|
var isDiscount = type === 'discount';
|
|
11431
|
-
return "\n <div class=\"invoice-order-item\">\n <div class=\"invoice-order-details\">\n <div>\n <div class=\"invoice-spacing invoice-body3\">" +
|
|
11448
|
+
return "\n <div class=\"invoice-order-item\">\n <div class=\"invoice-order-details\">\n <div>\n <div class=\"invoice-spacing invoice-body3\">" + itemLang.title + "</div>\n " + (isDiscount ? "<div class=\"invoice-subtitle4\">" + itemLang.description + "</div>" : '') + "\n </div>\n <div style=\"font-size:16px;color:" + (isDiscount ? '#C81E1E' : 'inherit') + ";\">\n " + (isDiscount ? '-' : '') + formatPrice(item.total, currency) + "\n </div>\n </div>\n </div>\n ";
|
|
11432
11449
|
};
|
|
11433
11450
|
var hasDiscount = discountItem && (discountItem === null || discountItem === void 0 ? void 0 : discountItem.total) > 0;
|
|
11434
11451
|
var hasTax = taxItem && (taxItem === null || taxItem === void 0 ? void 0 : taxItem.total) > 0;
|
|
11435
11452
|
var hasSubtotal = subtotalItem && (subtotalItem === null || subtotalItem === void 0 ? void 0 : subtotalItem.total) > 0;
|
|
11436
|
-
var html = "\n " + (includeHtmlWrapper ? '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<title>Invoice</title>' : "") + "\n <style>\n @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;900&family=Lato:wght@400;700&display=swap');\n .bookipay-invoice {\n width: 100%;\n max-width: 600px;\n background-color: white;\n display:flex;\n border-radius: 16px;\n flex-direction: column;\n overflow: hidden;\n font-family: 'Inter', sans-serif;\n line-height: 1.2;\n color: black;\n font-size: 16px;\n }\n .invoice-content {\n padding: 40px 30px;\n }\n .invoice-header {\n display: flex;\n padding: 10px;\n margin-bottom: 40px;\n justify-content: space-between;\n }\n .invoice-footer {\n padding: 30px 38px 40px;\n background-color: rgb(245, 246, 250);\n }\n .invoice-footer p {\n display: block;\n margin: 0;\n }\n .invoice-footer-logo {\n height: 20px;\n margin-bottom: 12px;\n }\n .invoice-logo {\n object-fit: contain;\n max-height: 52px;\n width: auto;\n height: auto;\n }\n .invoice-body {\n color: color: rgb(15, 23, 42);\n font-size: 16px;\n }\n .invoice-company {\n text-align: right;\n }\n .invoice-spacing {\n margin-bottom: 4px;\n }\n .invoice-semi-bold {\n color: rgb(15, 23, 42);\n font-weight: 600;\n font-size: 16px;\n }\n .invoice-bold {\n font-family: 'Lato', sans-serif;\n color: black;\n font-weight: 700;\n font-size: 20px;\n }\n .invoice-subtitle {\n color: rgba(0, 0, 0, 0.6);\n font-size: 14px;\n }\n .invoice-subtitle2 {\n color: rgb(147, 154, 172);\n font-size: 14px;\n }\n .invoice-subtitle3 {\n color: rgb(100, 116, 139);\n font-size: 14px;\n }\n .invoice-subtitle4 {\n font-size: 10px;\n }\n .invoice-summary {\n background-color: rgb(245, 246, 250);\n padding: 32px 24px;\n border-radius: 16px;\n margin-bottom: 40px;\n }\n .invoice-summary-total {\n display: flex;\n margin-bottom: 16px;\n justify-content: space-between;\n }\n .invoice-summary-customer {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n text-align: right;\n }\n .invoice-order-header {\n padding: 8px 0;\n margin-bottom: 8px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n display: flex;\n justify-content: space-between;\n }\n .invoice-order-container {\n display: flex;\n justify-content: space-between;\n }\n .invoice-order-item {\n padding: 12px 0px 5px;\n }\n .invoice-order-details {\n display: flex;\n justify-content: space-between;\n }\n .invoice-tax {\n display: flex;\n justify-content:space-between;\n margin-top: 8px;\n }\n .invoice-payment {\n display: flex;\n padding: 12px 0px 16px;\n justify-content: space-between;\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n margin-top: 15px;\n }\n .invoice-card {\n display: flex;\n }\n .invoice-card img {\n height: 18px;\n margin-right: 6px;\n }\n .invoice-bill-to {\n display: none;\n }\n @media (max-width: 600px) {\n .bookipay-invoice {\n border-radius: 0;\n }\n }\n @media (max-width: 799px) {\n .invoice-header {\n flex-direction: column;\n padding: 10px 0;\n }\n .invoice-company {\n text-align: left;\n }\n .invoice-logo {\n max-width: 100px;\n margin-bottom: 16px;\n }\n .invoice-header, .invoice-summary {\n margin-bottom: 20px;\n }\n .invoice-summary {\n margin-left: -30px;\n margin-right: -30px;\n border-radius: 0;\n padding: 32px 30px;\n }\n .invoice-content {\n padding: 20px 30px;\n }\n .invoice-bill-to {\n display: flex;\n }\n }\n @media (max-width: 399px) {\n .footer-actions {\n flex-direction: column;\n }\n .footer-action {\n margin-bottom: 12px;\n }\n footer {\n margin: 30px 0;\n }\n footer p {\n margin-top: 0;\n }\n }\n @media print {\n * {\n color-adjust: exact;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n .invoice-footer {\n width: 100%;\n max-width: 100%;\n margin: 0;\n }\n .bookipay-invoice {\n max-width: 100%;\n }\n @page { margin: 0; }\n body { margin: 1.6cm; }\n }\n </style>\n <div class=\"bookipay-invoice\">\n <div class=\"invoice-content\">\n <div class=\"invoice-header\">\n <img class=\"invoice-logo\" src=\"" + vendorLogoUrl + "\" />\n <div class=\"invoice-company\">\n <div class=\"invoice-company-name invoice-semi-bold invoice-spacing\">" + vendorName + "</div>\n <div class=\"invoice-number invoice-subtitle invoice-spacing\">
|
|
11453
|
+
var html = "\n " + (includeHtmlWrapper ? '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<title>Invoice</title>' : "") + "\n <style>\n @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;900&family=Lato:wght@400;700&display=swap');\n .bookipay-invoice {\n width: 100%;\n max-width: 600px;\n background-color: white;\n display:flex;\n border-radius: 16px;\n flex-direction: column;\n overflow: hidden;\n font-family: 'Inter', sans-serif;\n line-height: 1.2;\n color: black;\n font-size: 16px;\n }\n .invoice-content {\n padding: 40px 30px;\n }\n .invoice-header {\n display: flex;\n padding: 10px;\n margin-bottom: 40px;\n justify-content: space-between;\n }\n .invoice-footer {\n padding: 30px 38px 40px;\n background-color: rgb(245, 246, 250);\n }\n .invoice-footer p {\n display: block;\n margin: 0;\n }\n .invoice-footer-logo {\n height: 20px;\n margin-bottom: 12px;\n }\n .invoice-logo {\n object-fit: contain;\n max-height: 52px;\n width: auto;\n height: auto;\n }\n .invoice-body {\n color: color: rgb(15, 23, 42);\n font-size: 16px;\n }\n .invoice-company {\n text-align: right;\n }\n .invoice-spacing {\n margin-bottom: 4px;\n }\n .invoice-semi-bold {\n color: rgb(15, 23, 42);\n font-weight: 600;\n font-size: 16px;\n }\n .invoice-bold {\n font-family: 'Lato', sans-serif;\n color: black;\n font-weight: 700;\n font-size: 20px;\n }\n .invoice-subtitle {\n color: rgba(0, 0, 0, 0.6);\n font-size: 14px;\n }\n .invoice-subtitle2 {\n color: rgb(147, 154, 172);\n font-size: 14px;\n }\n .invoice-subtitle3 {\n color: rgb(100, 116, 139);\n font-size: 14px;\n }\n .invoice-subtitle4 {\n font-size: 10px;\n }\n .invoice-summary {\n background-color: rgb(245, 246, 250);\n padding: 32px 24px;\n border-radius: 16px;\n margin-bottom: 40px;\n }\n .invoice-summary-total {\n display: flex;\n margin-bottom: 16px;\n justify-content: space-between;\n }\n .invoice-summary-customer {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n text-align: right;\n }\n .invoice-order-header {\n padding: 8px 0;\n margin-bottom: 8px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n display: flex;\n justify-content: space-between;\n }\n .invoice-order-container {\n display: flex;\n justify-content: space-between;\n }\n .invoice-order-item {\n padding: 12px 0px 5px;\n }\n .invoice-order-details {\n display: flex;\n justify-content: space-between;\n }\n .invoice-tax {\n display: flex;\n justify-content:space-between;\n margin-top: 8px;\n }\n .invoice-payment {\n display: flex;\n padding: 12px 0px 16px;\n justify-content: space-between;\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n margin-top: 15px;\n }\n .invoice-card {\n display: flex;\n }\n .invoice-card img {\n height: 18px;\n margin-right: 6px;\n }\n .invoice-bill-to {\n display: none;\n }\n @media (max-width: 600px) {\n .bookipay-invoice {\n border-radius: 0;\n }\n }\n @media (max-width: 799px) {\n .invoice-header {\n flex-direction: column;\n padding: 10px 0;\n }\n .invoice-company {\n text-align: left;\n }\n .invoice-logo {\n max-width: 100px;\n margin-bottom: 16px;\n }\n .invoice-header, .invoice-summary {\n margin-bottom: 20px;\n }\n .invoice-summary {\n margin-left: -30px;\n margin-right: -30px;\n border-radius: 0;\n padding: 32px 30px;\n }\n .invoice-content {\n padding: 20px 30px;\n }\n .invoice-bill-to {\n display: flex;\n }\n }\n @media (max-width: 399px) {\n .footer-actions {\n flex-direction: column;\n }\n .footer-action {\n margin-bottom: 12px;\n }\n footer {\n margin: 30px 0;\n }\n footer p {\n margin-top: 0;\n }\n }\n @media print {\n * {\n color-adjust: exact;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n .invoice-footer {\n width: 100%;\n max-width: 100%;\n margin: 0;\n }\n .bookipay-invoice {\n max-width: 100%;\n }\n @page { margin: 0; }\n body { margin: 1.6cm; }\n }\n </style>\n <div class=\"bookipay-invoice\">\n <div class=\"invoice-content\">\n <div class=\"invoice-header\">\n <img class=\"invoice-logo\" src=\"" + vendorLogoUrl + "\" />\n <div class=\"invoice-company\">\n <div class=\"invoice-company-name invoice-semi-bold invoice-spacing\">" + vendorName + "</div>\n <div class=\"invoice-number invoice-subtitle invoice-spacing\">" + defaultLang.invoiceNo + "</div>\n <div class=\"invoice-date invoice-subtitle invoice-spacing\">" + date + "</div>\n </div>\n </div>\n <div class=\"invoice-summary\">\n <div class=\"invoice-summary-total\">\n <div class=\"invoice-summary-total-title invoice-semi-bold invoice-spacing\">" + defaultLang.total + "</div>\n <div class=\"invoice-summary-total-value invoice-bold invoice-spacing\">" + formatPrice(total, currency) + "</div>\n </div>\n <div class=\"invoice-summary-customer\">\n <div><div class=\"invoice-bill-to invoice-semi-bold invoice-spacing\">" + defaultLang.billTo + "</div></div>\n <div>\n <div class=\"invoice-bold invoice-spacing\">" + companyName + "</div>\n <div class=\"invoice-customer-email invoice-subtitle2\">" + email + "</div>\n </div>\n </div>\n </div>\n <div class=\"invoice-order\">\n <div class=\"invoice-order-header\">\n <div class=\"invoice-subtitle3\">" + defaultLang.item + "</div>\n <div class=\"invoice-subtitle3\">" + defaultLang.amount + "</div>\n </div>\n <div class=\"invoice-order-item-container\">\n " + productItems.map(renderItem) + "\n " + (hasDiscount ? renderItem(discountItem, 'discount') : '') + "\n " + (hasDiscount && hasTax && hasSubtotal ? renderItem(subtotalItem, 'subtotal') : '') + "\n " + (hasTax ? renderItem(taxItem, 'tax') : '') + "\n <div class=\"invoice-payment\">\n <div class=\"invoice-bold\" style=\"font-size: 16px;\">" + defaultLang.totalCharged + "</div>\n <div class=\"invoice-body3\">\n <div class=\"invoice-bold invoice-spacing\" style=\"font-size: 18px;text-align: right;\">" + formatPrice(amountPaid, currency) + "</div>\n <div class=\"invoice-card\">\n <img src=" + cardLogo + " alt=" + cardBrand + " />\n <div class=\"invoice-semi-bold\" style=\"font-weight: 400;\">" + (cardBrand.charAt(0).toUpperCase() + cardBrand.slice(1)) + " \u2022\u2022\u2022\u2022 " + cardNumber + "</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"invoice-footer invoice-subtitle2\" style=\"font-size: 12px;\">\n <img class=\"invoice-footer-logo\" src=\"" + vendorLogoUrl + "\" />\n <!-- TODO: Dynamic company info -->\n <p>\xA92023 Bookipi Pty Ltd.</p>\n <p>9 George St, North Strathfield NSW 2137, Australia</p>\n <p>ABN: 91617668185</p>\n </div>\n </div>\n " + (includeHtmlWrapper ? "</body></html>" : "") + "\n ";
|
|
11437
11454
|
return {
|
|
11438
11455
|
html: html
|
|
11439
11456
|
};
|