@bookipi/htmlgenerator 1.8.4-alpha2 → 1.8.5-alpha1
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 +122 -66
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +122 -66
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13446,61 +13446,59 @@ var contractHtml = (function (props) {
|
|
|
13446
13446
|
return html;
|
|
13447
13447
|
});
|
|
13448
13448
|
|
|
13449
|
-
var
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
var
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13476
|
-
var
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
discount: t ? t('Discount') : 'Discount'
|
|
13496
|
-
};
|
|
13449
|
+
var styleSheet = "\n<style>\n @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;900&family=Lato:wght@400;700&display=swap');\n\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\n .invoice-content {\n padding: 40px 30px;\n }\n\n .invoice-header {\n display: flex;\n padding: 10px;\n margin-bottom: 40px;\n justify-content: space-between;\n }\n\n .invoice-footer {\n padding: 30px 38px 40px;\n background-color: rgb(245, 246, 250);\n font-size: 12px;\n }\n\n .invoice-footer p {\n display: block;\n margin: 0;\n }\n\n .invoice-footer-logo {\n height: 20px;\n margin-bottom: 12px;\n }\n\n .invoice-logo {\n object-fit: contain;\n max-height: 52px;\n width: auto;\n height: auto;\n }\n\n .invoice-body {\n color: rgb(15, 23, 42);\n font-size: 16px;\n }\n\n .invoice-company {\n text-align: right;\n }\n\n .invoice-spacing {\n margin-bottom: 4px;\n }\n\n .invoice-semi-bold {\n color: rgb(15, 23, 42);\n font-weight: 600;\n font-size: 16px;\n }\n\n .invoice-bold {\n font-family: 'Lato', sans-serif;\n color: black;\n font-weight: 700;\n font-size: 20px;\n }\n\n .invoice-subtitle {\n color: rgba(0, 0, 0, 0.6);\n font-size: 14px;\n }\n\n .invoice-subtitle2 {\n color: rgb(147, 154, 172);\n font-size: 14px;\n }\n\n .invoice-subtitle3 {\n color: rgb(100, 116, 139);\n font-size: 14px;\n }\n\n .invoice-subtitle4 {\n font-size: 10px;\n }\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\n .invoice-summary-total {\n display: flex;\n margin-top: 24px;\n flex-direction: column;\n }\n\n .invoice-summary-customer {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n gap: 16px;\n }\n\n .invoice-summary-customer-column {\n flex: 1;\n overflow-wrap:anywhere;\n }\n\n .invoice-customer-email {\n text-align: right;\n }\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\n .invoice-order-container {\n display: flex;\n justify-content: space-between;\n }\n\n .invoice-order-item {\n padding: 12px 0px 5px;\n }\n\n .invoice-order-details {\n display: flex;\n justify-content: space-between;\n }\n\n .invoice-item-details {\n color: rgb(100, 116, 139);\n font-size: 14px;\n margin-top: 4px;\n }\n\n .invoice-tax {\n display: flex;\n justify-content: space-between;\n margin-top: 8px;\n }\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\n .invoice-card {\n display: flex;\n padding: 8px 0px;\n }\n\n .invoice-card img {\n height: 24px;\n margin-right: 6px;\n }\n\n .invoice-bill-to {\n display: none;\n }\n\n .invoice-order-item-amount {\n font-size: 16px;\n white-space: nowrap;\n }\n\n .invoice-card-number {\n color: rgb(15, 23, 42);\n font-size: 16px;\n font-weight: 400;\n }\n\n .invoice-total-amount {\n font-size: 18px;\n text-align: right;\n }\n\n @media (max-width: 600px) {\n .bookipay-invoice {\n border-radius: 0;\n }\n }\n\n @media (max-width: 799px) {\n .invoice-header {\n flex-direction: column;\n padding: 10px 0;\n }\n\n .invoice-company {\n text-align: left;\n }\n\n .invoice-logo {\n max-width: 100px;\n margin-bottom: 16px;\n }\n\n .invoice-header,\n .invoice-summary {\n margin-bottom: 20px;\n }\n\n .invoice-summary {\n margin-left: -30px;\n margin-right: -30px;\n border-radius: 0;\n padding: 32px 30px;\n }\n\n .invoice-content {\n padding: 20px 30px;\n }\n\n .invoice-bill-to {\n display: flex;\n }\n }\n\n @media (max-width: 399px) {\n .footer-actions {\n flex-direction: column;\n }\n\n .footer-action {\n margin-bottom: 12px;\n }\n\n footer {\n margin: 30px 0;\n }\n\n footer p {\n margin-top: 0;\n }\n }\n\n @media print {\n * {\n color-adjust: exact;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n\n .invoice-footer {\n width: 100%;\n max-width: 100%;\n margin: 0;\n }\n\n .bookipay-invoice {\n max-width: 100%;\n }\n\n @page {\n margin: 0;\n }\n\n body {\n margin: 1.6cm;\n }\n }\n</style>\n";
|
|
13450
|
+
|
|
13451
|
+
function formatPrice(price, currency) {
|
|
13452
|
+
if (price === void 0) {
|
|
13453
|
+
price = 0;
|
|
13454
|
+
}
|
|
13455
|
+
if (currency === void 0) {
|
|
13456
|
+
currency = 'USD';
|
|
13457
|
+
}
|
|
13458
|
+
return (price ? Number(price / 100).toFixed(2) : '0') + " " + currency;
|
|
13459
|
+
}
|
|
13460
|
+
function renderAddressItems(addressItems) {
|
|
13461
|
+
if (addressItems === void 0) {
|
|
13462
|
+
addressItems = [];
|
|
13463
|
+
}
|
|
13464
|
+
return addressItems.filter(function (item) {
|
|
13465
|
+
return !!item;
|
|
13466
|
+
}).join(', ');
|
|
13467
|
+
}
|
|
13468
|
+
function Header(_ref) {
|
|
13469
|
+
var logoUrl = _ref.logoUrl,
|
|
13470
|
+
companyName = _ref.companyName,
|
|
13471
|
+
invoiceNo = _ref.invoiceNo,
|
|
13472
|
+
invoiceDate = _ref.invoiceDate;
|
|
13473
|
+
return "\n <div class=\"invoice-header\">\n <img class=\"invoice-logo\" src=" + logoUrl + " />\n <div class=\"invoice-company\">\n <div class=\"invoice-company-name invoice-semi-bold invoice-spacing\">\n " + companyName + "\n </div>\n <div class=\"invoice-number invoice-subtitle invoice-spacing\">\n " + invoiceNo + "\n </div>\n <div class=\"invoice-date invoice-subtitle invoice-spacing\">\n " + invoiceDate + "\n </div>\n </div>\n </div>\n ";
|
|
13474
|
+
}
|
|
13475
|
+
function InvoiceSummaryCard(params) {
|
|
13476
|
+
var email = params.email,
|
|
13477
|
+
companyName = params.companyName,
|
|
13478
|
+
businessNumber = params.businessNumber,
|
|
13479
|
+
address = params.address,
|
|
13480
|
+
total = params.total,
|
|
13481
|
+
currency = params.currency,
|
|
13482
|
+
defaultLang = params.defaultLang;
|
|
13483
|
+
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);
|
|
13484
|
+
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);
|
|
13485
|
+
return "\n <div class=\"invoice-summary\">\n <div class=\"invoice-summary-customer\">\n <div class=\"invoice-summary-customer-column\">\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 invoice-summary-customer-column\">\n " + email + "\n </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 ";
|
|
13486
|
+
}
|
|
13487
|
+
function OrderSummary(params) {
|
|
13488
|
+
var amountPaid = params.amountPaid,
|
|
13489
|
+
invoiceItems = params.invoiceItems,
|
|
13490
|
+
cardBrand = params.cardBrand,
|
|
13491
|
+
cardNumber = params.cardNumber,
|
|
13492
|
+
cardLogo = params.cardLogo,
|
|
13493
|
+
currency = params.currency,
|
|
13494
|
+
defaultLang = params.defaultLang;
|
|
13497
13495
|
var hasDiscount = invoiceItems.some(function (item) {
|
|
13498
13496
|
return item.type === 'discount' && item.total > 0;
|
|
13499
13497
|
});
|
|
13500
13498
|
var hasTax = invoiceItems.some(function (item) {
|
|
13501
13499
|
return item.type === 'tax' && item.total > 0;
|
|
13502
13500
|
});
|
|
13503
|
-
|
|
13501
|
+
function renderItem(item) {
|
|
13504
13502
|
var title = item.name || item.description;
|
|
13505
13503
|
var showSubtotal = hasTax && hasDiscount;
|
|
13506
13504
|
if (!showSubtotal && item.type === 'subtotal') {
|
|
@@ -13511,30 +13509,88 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
13511
13509
|
var color = isDiscount ? '#C81E1E' : 'inherit';
|
|
13512
13510
|
var label = isDiscount ? defaultLang.discount + " (" + title + ")" : title;
|
|
13513
13511
|
if (isDiscount && total === 0) return '';
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13512
|
+
var hasDescription = item.description && item.description !== item.name && item.description.trim() !== '';
|
|
13513
|
+
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 + ";\">\n " + label + "\n </div>\n " + (hasDescription ? "<div class=\"invoice-item-details\">" + item.description + "</div>" : '') + "\n </div>\n <div class=\"invoice-order-item-amount\" style=\"color:" + color + ";\">\n " + formatPrice(total, currency) + "\n </div>\n </div>\n </div>\n ";
|
|
13514
|
+
}
|
|
13515
|
+
function renderItems() {
|
|
13517
13516
|
var rendered = '';
|
|
13518
|
-
|
|
13517
|
+
invoiceItems.forEach(function (item) {
|
|
13519
13518
|
rendered += renderItem(item);
|
|
13520
13519
|
});
|
|
13521
13520
|
return rendered;
|
|
13521
|
+
}
|
|
13522
|
+
return "\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() + "\n <div class=\"invoice-payment\">\n <div class=\"invoice-bold\" style=\"font-size:'16px;\">\n " + defaultLang.totalCharged + "\n </div>\n <div class=\"invoice-body3\">\n <div class=\"invoice-bold invoice-spacing invoice-total-amount\">\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-card-number\">\n " + (cardBrand.charAt(0).toUpperCase() + cardBrand.slice(1)) + " \u2022\u2022\u2022\u2022 " + cardNumber + "\n </div>\n </div>\n " : '') + "\n </div>\n </div>\n ";
|
|
13523
|
+
}
|
|
13524
|
+
function Footer(_ref2) {
|
|
13525
|
+
var logoUrl = _ref2.logoUrl;
|
|
13526
|
+
return "\n <div class=\"invoice-footer invoice-subtitle2\">\n <img class=\"invoice-footer-logo\" src=" + logoUrl + " />\n <p>\xA92025 Bookipi Pty Ltd.</p>\n <p>9 George St, North Strathfield NSW 2137, Australia</p>\n <p>ABN: 91617668185</p>\n </div>";
|
|
13527
|
+
}
|
|
13528
|
+
function SubscriptionInvoiceHtml(_ref3) {
|
|
13529
|
+
var vendor = _ref3.vendor,
|
|
13530
|
+
invoice = _ref3.invoice,
|
|
13531
|
+
customer = _ref3.customer,
|
|
13532
|
+
includeHtmlWrapper = _ref3.includeHtmlWrapper,
|
|
13533
|
+
t = _ref3.t;
|
|
13534
|
+
var _ref4 = vendor != null ? vendor : {},
|
|
13535
|
+
vendorName = _ref4.name,
|
|
13536
|
+
vendorLogoUrl = _ref4.logoUrl,
|
|
13537
|
+
businessNumber = _ref4.businessNumber,
|
|
13538
|
+
address = _ref4.address;
|
|
13539
|
+
var _ref5 = invoice != null ? invoice : {},
|
|
13540
|
+
invoiceNumber = _ref5.no,
|
|
13541
|
+
total = _ref5.total,
|
|
13542
|
+
amountPaid = _ref5.amountPaid,
|
|
13543
|
+
currency = _ref5.currency,
|
|
13544
|
+
transaction = _ref5.transaction,
|
|
13545
|
+
date = _ref5.date,
|
|
13546
|
+
invoiceItems = _ref5.items;
|
|
13547
|
+
var _ref6 = transaction != null ? transaction : {},
|
|
13548
|
+
cardNumber = _ref6.cardNumber,
|
|
13549
|
+
cardBrand = _ref6.cardBrand,
|
|
13550
|
+
cardLogo = _ref6.cardLogo;
|
|
13551
|
+
var _ref7 = customer != null ? customer : {},
|
|
13552
|
+
companyName = _ref7.name,
|
|
13553
|
+
email = _ref7.email;
|
|
13554
|
+
var logoUrl = vendorLogoUrl != null ? vendorLogoUrl : 'https://web.bookipi.com/images/logos/logo-bookipi.png';
|
|
13555
|
+
var defaultLang = {
|
|
13556
|
+
invoiceNo: t ? t('Invoice #', {
|
|
13557
|
+
no: invoiceNumber
|
|
13558
|
+
}) : "Invoice #" + invoiceNumber,
|
|
13559
|
+
total: t ? t('Total') : 'Total',
|
|
13560
|
+
billTo: t ? t('Bill to') : 'Bill to',
|
|
13561
|
+
item: t ? t('Item') : 'Item',
|
|
13562
|
+
amount: t ? t('Amount') : 'Amount',
|
|
13563
|
+
totalCharged: t ? t('Total charged') : 'Total charged',
|
|
13564
|
+
discount: t ? t('Discount') : 'Discount'
|
|
13522
13565
|
};
|
|
13523
|
-
var
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
|
|
13533
|
-
|
|
13566
|
+
var html = "\n " + (includeHtmlWrapper ? '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<title>Invoice</title>' : '') + "\n " + styleSheet + "\n " + (includeHtmlWrapper ? '</head>' : '') + "\n <div class=\"bookipay-invoice\">\n <div class=\"invoice-content\">\n " + Header({
|
|
13567
|
+
logoUrl: logoUrl,
|
|
13568
|
+
companyName: vendorName,
|
|
13569
|
+
invoiceNo: defaultLang.invoiceNo,
|
|
13570
|
+
invoiceDate: date
|
|
13571
|
+
}) + "\n " + InvoiceSummaryCard({
|
|
13572
|
+
email: email,
|
|
13573
|
+
companyName: companyName,
|
|
13574
|
+
businessNumber: businessNumber,
|
|
13575
|
+
address: address,
|
|
13576
|
+
total: total,
|
|
13577
|
+
currency: currency,
|
|
13578
|
+
defaultLang: defaultLang
|
|
13579
|
+
}) + "\n " + OrderSummary({
|
|
13580
|
+
amountPaid: amountPaid,
|
|
13581
|
+
invoiceItems: invoiceItems,
|
|
13582
|
+
cardBrand: cardBrand,
|
|
13583
|
+
cardNumber: cardNumber,
|
|
13584
|
+
cardLogo: cardLogo,
|
|
13585
|
+
currency: currency,
|
|
13586
|
+
defaultLang: defaultLang
|
|
13587
|
+
}) + "\n </div>\n " + Footer({
|
|
13588
|
+
logoUrl: logoUrl
|
|
13589
|
+
}) + "\n </div>\n " + (includeHtmlWrapper ? '</body></html>' : '') + "\n ";
|
|
13534
13590
|
return {
|
|
13535
13591
|
html: html
|
|
13536
13592
|
};
|
|
13537
|
-
}
|
|
13593
|
+
}
|
|
13538
13594
|
|
|
13539
13595
|
var _document$invoice$est;
|
|
13540
13596
|
var langJP = (_document$invoice$est = {
|
|
@@ -14440,7 +14496,7 @@ exports.InvoiceCompatJapanHtml = InvoiceCompatHtml$1;
|
|
|
14440
14496
|
exports.InvoiceHtml = invoiceHtml;
|
|
14441
14497
|
exports.InvoiceJapanHtml = invoiceHtml$1;
|
|
14442
14498
|
exports.PresentationHtml = presentationHtml;
|
|
14443
|
-
exports.SubscriptionInvoiceHtml =
|
|
14499
|
+
exports.SubscriptionInvoiceHtml = SubscriptionInvoiceHtml;
|
|
14444
14500
|
exports.invoiceHtmlWithDetails = renderOldLayout;
|
|
14445
14501
|
exports.invoiceHtmlWithDetailsNew = renderNewLayout;
|
|
14446
14502
|
exports.invoiceJapanHtmlWithDetails = renderLayout;
|