@bookipi/htmlgenerator 1.5.23 → 1.5.24
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/.vscode/common.settings.json +38 -0
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +20 -20
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"//": "auto save & auto formatting on save",
|
|
3
|
+
"files.autoSave": "onFocusChange",
|
|
4
|
+
"editor.formatOnSave": true,
|
|
5
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
6
|
+
"prettier.requireConfig": false,
|
|
7
|
+
"editor.codeActionsOnSave": {
|
|
8
|
+
"source.organizeImports": "always",
|
|
9
|
+
"source.fixAll": "always"
|
|
10
|
+
},
|
|
11
|
+
"eslint.enable": true,
|
|
12
|
+
|
|
13
|
+
"//": "please install `Code Spell Checker` extension to use this configuration",
|
|
14
|
+
"cSpell.words": [
|
|
15
|
+
"AIPO",
|
|
16
|
+
"bds",
|
|
17
|
+
"bg",
|
|
18
|
+
"Bookipay",
|
|
19
|
+
"bw",
|
|
20
|
+
"comms",
|
|
21
|
+
"cy",
|
|
22
|
+
"devias",
|
|
23
|
+
"esign",
|
|
24
|
+
"Fcm",
|
|
25
|
+
"FRAMEBUSTED",
|
|
26
|
+
"gql",
|
|
27
|
+
"hocs",
|
|
28
|
+
"idx",
|
|
29
|
+
"noreferrer",
|
|
30
|
+
"Quickbook",
|
|
31
|
+
"Quickbooks",
|
|
32
|
+
"showmore",
|
|
33
|
+
"Signit",
|
|
34
|
+
"testid",
|
|
35
|
+
"UI",
|
|
36
|
+
"vh"
|
|
37
|
+
]
|
|
38
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -13429,48 +13429,48 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
13429
13429
|
var _ref5 = customer != null ? customer : {},
|
|
13430
13430
|
companyName = _ref5.name,
|
|
13431
13431
|
email = _ref5.email;
|
|
13432
|
-
var vendorLogoUrl = logoUrl != null ? logoUrl :
|
|
13432
|
+
var vendorLogoUrl = logoUrl != null ? logoUrl : 'https://web.bookipi.com/images/logos/logo-bookipi.png';
|
|
13433
13433
|
var formatPrice = function formatPrice(price, currency) {
|
|
13434
13434
|
if (price === void 0) {
|
|
13435
13435
|
price = 0;
|
|
13436
13436
|
}
|
|
13437
13437
|
if (currency === void 0) {
|
|
13438
|
-
currency =
|
|
13438
|
+
currency = 'USD';
|
|
13439
13439
|
}
|
|
13440
|
-
return (price ? Number(price / 100).toFixed(2) :
|
|
13440
|
+
return (price ? Number(price / 100).toFixed(2) : '0') + " " + currency;
|
|
13441
13441
|
};
|
|
13442
13442
|
var defaultLang = {
|
|
13443
|
-
invoiceNo: t ? t(
|
|
13443
|
+
invoiceNo: t ? t('Invoice #', {
|
|
13444
13444
|
no: invoiceNumber
|
|
13445
13445
|
}) : "Invoice #" + invoiceNumber,
|
|
13446
|
-
total: t ? t(
|
|
13447
|
-
billTo: t ? t(
|
|
13448
|
-
item: t ? t(
|
|
13449
|
-
amount: t ? t(
|
|
13450
|
-
totalCharged: t ? t(
|
|
13451
|
-
discount: t ? t(
|
|
13446
|
+
total: t ? t('Total') : 'Total',
|
|
13447
|
+
billTo: t ? t('Bill to') : 'Bill to',
|
|
13448
|
+
item: t ? t('Item') : 'Item',
|
|
13449
|
+
amount: t ? t('Amount') : 'Amount',
|
|
13450
|
+
totalCharged: t ? t('Total charged') : 'Total charged',
|
|
13451
|
+
discount: t ? t('Discount') : 'Discount'
|
|
13452
13452
|
};
|
|
13453
13453
|
var hasDiscount = invoiceItems.some(function (item) {
|
|
13454
|
-
return item.type ===
|
|
13454
|
+
return item.type === 'discount' && item.total > 0;
|
|
13455
13455
|
});
|
|
13456
13456
|
var hasTax = invoiceItems.some(function (item) {
|
|
13457
|
-
return item.type ===
|
|
13457
|
+
return item.type === 'tax' && item.total > 0;
|
|
13458
13458
|
});
|
|
13459
13459
|
var renderItem = function renderItem(item) {
|
|
13460
13460
|
var title = item.name || item.description;
|
|
13461
13461
|
var showSubtotal = hasTax && hasDiscount;
|
|
13462
|
-
if (!showSubtotal && item.type ===
|
|
13463
|
-
return
|
|
13462
|
+
if (!showSubtotal && item.type === 'subtotal') {
|
|
13463
|
+
return '';
|
|
13464
13464
|
}
|
|
13465
|
-
var isDiscount = item.type ===
|
|
13465
|
+
var isDiscount = item.type === 'discount';
|
|
13466
13466
|
var total = item.total * (isDiscount ? -1 : 1);
|
|
13467
|
-
var color = isDiscount ?
|
|
13467
|
+
var color = isDiscount ? '#C81E1E' : 'inherit';
|
|
13468
13468
|
var label = isDiscount ? defaultLang.discount + " (" + title + ")" : title;
|
|
13469
|
-
if (isDiscount && total === 0) return
|
|
13469
|
+
if (isDiscount && total === 0) return '';
|
|
13470
13470
|
return "\n <div class=\"invoice-order-item\">\n <div class=\"invoice-order-details\">\n <div>\n <div class=\"invoice-spacing invoice-body3\" style=\"color:" + color + ";\">" + label + "</div>\n </div>\n <div style=\"font-size:16px;color:" + color + ";\">\n " + formatPrice(total, currency) + "\n </div>\n </div>\n </div>\n ";
|
|
13471
13471
|
};
|
|
13472
13472
|
var renderItems = function renderItems(items) {
|
|
13473
|
-
var rendered =
|
|
13473
|
+
var rendered = '';
|
|
13474
13474
|
items.forEach(function (item) {
|
|
13475
13475
|
rendered += renderItem(item);
|
|
13476
13476
|
});
|
|
@@ -13482,11 +13482,11 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
13482
13482
|
}
|
|
13483
13483
|
return addressItems.filter(function (item) {
|
|
13484
13484
|
return !!item;
|
|
13485
|
-
}).join(
|
|
13485
|
+
}).join(', ');
|
|
13486
13486
|
};
|
|
13487
13487
|
var hasAddressLine = (address === null || address === void 0 ? void 0 : address.address1) || (address === null || address === void 0 ? void 0 : address.address2) || (address === null || address === void 0 ? void 0 : address.address3);
|
|
13488
13488
|
var hasAddress = (address === null || address === void 0 ? void 0 : address.city) || (address === null || address === void 0 ? void 0 : address.zip) || (address === null || address === void 0 ? void 0 : address.country);
|
|
13489
|
-
var html = "\n " + (includeHtmlWrapper ? '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<title>Invoice</title>' :
|
|
13489
|
+
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-top: 24px;\n flex-direction: column;\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: left;\n }\n .invoice-customer-email {\n margin-left: 8px;\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 padding: 8px 0px;\n }\n .invoice-card img {\n height: 24px;\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-customer\">\n <div>\n <div class=\"invoice-bold invoice-spacing\">" + companyName + "</div>\n " + (businessNumber ? "<div class=\"invoice-subtitle2\">" + businessNumber + "</div>" : '') + "\n " + (hasAddressLine ? "<div class=\"invoice-subtitle2\">\n " + renderAddressItems([address.address1, address.address2, address.address3]) + "\n </div>" : '') + "\n " + (hasAddress ? "<div class=\"invoice-subtitle2\">\n " + renderAddressItems([address.city, address.zip, address.country]) + "\n </div>" : '') + "\n </div>\n <div class=\"invoice-customer-email invoice-subtitle2\">" + email + "</div>\n </div>\n <div class=\"invoice-summary-total\">\n <div class=\"invoice-subtitle3 invoice-spacing\">\n " + defaultLang.total + "\n </div>\n <div class=\"invoice-summary-total-value invoice-bold invoice-spacing\">\n " + formatPrice(total, currency) + "\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 " + renderItems(invoiceItems) + "\n <div class=\"invoice-payment\">\n <div class=\"invoice-bold\" style=\"font-size: 16px;\">\n " + defaultLang.totalCharged + "</div>\n <div class=\"invoice-body3\">\n <div class=\"invoice-bold invoice-spacing\" style=\"font-size: 18px;text-align: right;\">\n " + formatPrice(amountPaid, currency) + "\n </div>\n </div>\n </div>\n " + (cardBrand && cardNumber ? "\n <div class=\"invoice-card\">\n <img src=" + cardLogo + " alt=" + cardBrand + " />\n <div class=\"invoice-semi-bold\" style=\"font-weight: 400;\">\n " + (cardBrand.charAt(0).toUpperCase() + cardBrand.slice(1)) + " \u2022\u2022\u2022\u2022 " + cardNumber + "\n </div>\n </div>\n " : '') + "\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 ";
|
|
13490
13490
|
return {
|
|
13491
13491
|
html: html
|
|
13492
13492
|
};
|