@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.modern.js
CHANGED
|
@@ -13445,61 +13445,59 @@ var contractHtml = (function (props) {
|
|
|
13445
13445
|
return html;
|
|
13446
13446
|
});
|
|
13447
13447
|
|
|
13448
|
-
var
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
var
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
var
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
discount: t ? t('Discount') : 'Discount'
|
|
13495
|
-
};
|
|
13448
|
+
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";
|
|
13449
|
+
|
|
13450
|
+
function formatPrice(price, currency) {
|
|
13451
|
+
if (price === void 0) {
|
|
13452
|
+
price = 0;
|
|
13453
|
+
}
|
|
13454
|
+
if (currency === void 0) {
|
|
13455
|
+
currency = 'USD';
|
|
13456
|
+
}
|
|
13457
|
+
return (price ? Number(price / 100).toFixed(2) : '0') + " " + currency;
|
|
13458
|
+
}
|
|
13459
|
+
function renderAddressItems(addressItems) {
|
|
13460
|
+
if (addressItems === void 0) {
|
|
13461
|
+
addressItems = [];
|
|
13462
|
+
}
|
|
13463
|
+
return addressItems.filter(function (item) {
|
|
13464
|
+
return !!item;
|
|
13465
|
+
}).join(', ');
|
|
13466
|
+
}
|
|
13467
|
+
function Header(_ref) {
|
|
13468
|
+
var logoUrl = _ref.logoUrl,
|
|
13469
|
+
companyName = _ref.companyName,
|
|
13470
|
+
invoiceNo = _ref.invoiceNo,
|
|
13471
|
+
invoiceDate = _ref.invoiceDate;
|
|
13472
|
+
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 ";
|
|
13473
|
+
}
|
|
13474
|
+
function InvoiceSummaryCard(params) {
|
|
13475
|
+
var email = params.email,
|
|
13476
|
+
companyName = params.companyName,
|
|
13477
|
+
businessNumber = params.businessNumber,
|
|
13478
|
+
address = params.address,
|
|
13479
|
+
total = params.total,
|
|
13480
|
+
currency = params.currency,
|
|
13481
|
+
defaultLang = params.defaultLang;
|
|
13482
|
+
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);
|
|
13483
|
+
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);
|
|
13484
|
+
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 ";
|
|
13485
|
+
}
|
|
13486
|
+
function OrderSummary(params) {
|
|
13487
|
+
var amountPaid = params.amountPaid,
|
|
13488
|
+
invoiceItems = params.invoiceItems,
|
|
13489
|
+
cardBrand = params.cardBrand,
|
|
13490
|
+
cardNumber = params.cardNumber,
|
|
13491
|
+
cardLogo = params.cardLogo,
|
|
13492
|
+
currency = params.currency,
|
|
13493
|
+
defaultLang = params.defaultLang;
|
|
13496
13494
|
var hasDiscount = invoiceItems.some(function (item) {
|
|
13497
13495
|
return item.type === 'discount' && item.total > 0;
|
|
13498
13496
|
});
|
|
13499
13497
|
var hasTax = invoiceItems.some(function (item) {
|
|
13500
13498
|
return item.type === 'tax' && item.total > 0;
|
|
13501
13499
|
});
|
|
13502
|
-
|
|
13500
|
+
function renderItem(item) {
|
|
13503
13501
|
var title = item.name || item.description;
|
|
13504
13502
|
var showSubtotal = hasTax && hasDiscount;
|
|
13505
13503
|
if (!showSubtotal && item.type === 'subtotal') {
|
|
@@ -13510,30 +13508,88 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
13510
13508
|
var color = isDiscount ? '#C81E1E' : 'inherit';
|
|
13511
13509
|
var label = isDiscount ? defaultLang.discount + " (" + title + ")" : title;
|
|
13512
13510
|
if (isDiscount && total === 0) return '';
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13511
|
+
var hasDescription = item.description && item.description !== item.name && item.description.trim() !== '';
|
|
13512
|
+
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 ";
|
|
13513
|
+
}
|
|
13514
|
+
function renderItems() {
|
|
13516
13515
|
var rendered = '';
|
|
13517
|
-
|
|
13516
|
+
invoiceItems.forEach(function (item) {
|
|
13518
13517
|
rendered += renderItem(item);
|
|
13519
13518
|
});
|
|
13520
13519
|
return rendered;
|
|
13520
|
+
}
|
|
13521
|
+
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 ";
|
|
13522
|
+
}
|
|
13523
|
+
function Footer(_ref2) {
|
|
13524
|
+
var logoUrl = _ref2.logoUrl;
|
|
13525
|
+
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>";
|
|
13526
|
+
}
|
|
13527
|
+
function SubscriptionInvoiceHtml(_ref3) {
|
|
13528
|
+
var vendor = _ref3.vendor,
|
|
13529
|
+
invoice = _ref3.invoice,
|
|
13530
|
+
customer = _ref3.customer,
|
|
13531
|
+
includeHtmlWrapper = _ref3.includeHtmlWrapper,
|
|
13532
|
+
t = _ref3.t;
|
|
13533
|
+
var _ref4 = vendor != null ? vendor : {},
|
|
13534
|
+
vendorName = _ref4.name,
|
|
13535
|
+
vendorLogoUrl = _ref4.logoUrl,
|
|
13536
|
+
businessNumber = _ref4.businessNumber,
|
|
13537
|
+
address = _ref4.address;
|
|
13538
|
+
var _ref5 = invoice != null ? invoice : {},
|
|
13539
|
+
invoiceNumber = _ref5.no,
|
|
13540
|
+
total = _ref5.total,
|
|
13541
|
+
amountPaid = _ref5.amountPaid,
|
|
13542
|
+
currency = _ref5.currency,
|
|
13543
|
+
transaction = _ref5.transaction,
|
|
13544
|
+
date = _ref5.date,
|
|
13545
|
+
invoiceItems = _ref5.items;
|
|
13546
|
+
var _ref6 = transaction != null ? transaction : {},
|
|
13547
|
+
cardNumber = _ref6.cardNumber,
|
|
13548
|
+
cardBrand = _ref6.cardBrand,
|
|
13549
|
+
cardLogo = _ref6.cardLogo;
|
|
13550
|
+
var _ref7 = customer != null ? customer : {},
|
|
13551
|
+
companyName = _ref7.name,
|
|
13552
|
+
email = _ref7.email;
|
|
13553
|
+
var logoUrl = vendorLogoUrl != null ? vendorLogoUrl : 'https://web.bookipi.com/images/logos/logo-bookipi.png';
|
|
13554
|
+
var defaultLang = {
|
|
13555
|
+
invoiceNo: t ? t('Invoice #', {
|
|
13556
|
+
no: invoiceNumber
|
|
13557
|
+
}) : "Invoice #" + invoiceNumber,
|
|
13558
|
+
total: t ? t('Total') : 'Total',
|
|
13559
|
+
billTo: t ? t('Bill to') : 'Bill to',
|
|
13560
|
+
item: t ? t('Item') : 'Item',
|
|
13561
|
+
amount: t ? t('Amount') : 'Amount',
|
|
13562
|
+
totalCharged: t ? t('Total charged') : 'Total charged',
|
|
13563
|
+
discount: t ? t('Discount') : 'Discount'
|
|
13521
13564
|
};
|
|
13522
|
-
var
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
|
|
13565
|
+
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({
|
|
13566
|
+
logoUrl: logoUrl,
|
|
13567
|
+
companyName: vendorName,
|
|
13568
|
+
invoiceNo: defaultLang.invoiceNo,
|
|
13569
|
+
invoiceDate: date
|
|
13570
|
+
}) + "\n " + InvoiceSummaryCard({
|
|
13571
|
+
email: email,
|
|
13572
|
+
companyName: companyName,
|
|
13573
|
+
businessNumber: businessNumber,
|
|
13574
|
+
address: address,
|
|
13575
|
+
total: total,
|
|
13576
|
+
currency: currency,
|
|
13577
|
+
defaultLang: defaultLang
|
|
13578
|
+
}) + "\n " + OrderSummary({
|
|
13579
|
+
amountPaid: amountPaid,
|
|
13580
|
+
invoiceItems: invoiceItems,
|
|
13581
|
+
cardBrand: cardBrand,
|
|
13582
|
+
cardNumber: cardNumber,
|
|
13583
|
+
cardLogo: cardLogo,
|
|
13584
|
+
currency: currency,
|
|
13585
|
+
defaultLang: defaultLang
|
|
13586
|
+
}) + "\n </div>\n " + Footer({
|
|
13587
|
+
logoUrl: logoUrl
|
|
13588
|
+
}) + "\n </div>\n " + (includeHtmlWrapper ? '</body></html>' : '') + "\n ";
|
|
13533
13589
|
return {
|
|
13534
13590
|
html: html
|
|
13535
13591
|
};
|
|
13536
|
-
}
|
|
13592
|
+
}
|
|
13537
13593
|
|
|
13538
13594
|
var _document$invoice$est;
|
|
13539
13595
|
var langJP = (_document$invoice$est = {
|
|
@@ -14433,5 +14489,5 @@ var presentationHtml = function presentationHtml(_ref) {
|
|
|
14433
14489
|
return htmlRaw$3(_templateObject5$5 || (_templateObject5$5 = _taggedTemplateLiteralLoose(["<!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n ", "\n ", "\n </head>\n <body>\n <div class=\"slides-export\">\n ", "\n </div>\n </body>\n </html>"])), fontLinkTags, css, innerContent);
|
|
14434
14490
|
};
|
|
14435
14491
|
|
|
14436
|
-
export { contractHtml as ContractHtml, InvoiceCompatHtml, InvoiceCompatHtml$1 as InvoiceCompatJapanHtml, invoiceHtml as InvoiceHtml, invoiceHtml$1 as InvoiceJapanHtml, presentationHtml as PresentationHtml,
|
|
14492
|
+
export { contractHtml as ContractHtml, InvoiceCompatHtml, InvoiceCompatHtml$1 as InvoiceCompatJapanHtml, invoiceHtml as InvoiceHtml, invoiceHtml$1 as InvoiceJapanHtml, presentationHtml as PresentationHtml, SubscriptionInvoiceHtml, renderOldLayout as invoiceHtmlWithDetails, renderNewLayout as invoiceHtmlWithDetailsNew, renderLayout as invoiceJapanHtmlWithDetails, renderLayout as renderJapanInvoice, renderNewLayout as renderNewInvoice, renderOldLayout as renderOldInvoice };
|
|
14437
14493
|
//# sourceMappingURL=index.modern.js.map
|