@bookipi/htmlgenerator 1.1.23-alpha13 → 1.1.23-alpha15

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 CHANGED
@@ -1652,71 +1652,8 @@ var FormatCurrencyDetails = function FormatCurrencyDetails(value, currency, lang
1652
1652
  formattedValue = format.format.replace("###", formattedValue);
1653
1653
  formattedValue = formattedValue.replace("$$", symbol);
1654
1654
  var currencySplit = formattedValue.split(format.decimal);
1655
- var format2 = numberFormat[numberFormatObj];
1656
- var startFromSymbol = format2.format.startsWith("$$");
1657
- var currencySplitFormatedArr = format2.format.replace("###", "|###|").replace("$$", "|$$$$|").split("|").filter(function (v) {
1658
- return v !== "";
1659
- }).map(function (section) {
1660
- if (section === "###") {
1661
- var decimalArr = formatMoney(parseFloat(value), decimal, format2.decimal, format2.group, true).split(format.decimal);
1662
-
1663
- if (decimalArr.length > 0) {
1664
- decimalArr[0] = {
1665
- type: "int",
1666
- val: decimalArr[0]
1667
- };
1668
- }
1669
-
1670
- if (decimalArr.length > 1) {
1671
- decimalArr.push({
1672
- type: "decimal",
1673
- val: decimalArr[1]
1674
- });
1675
- decimalArr[1] = {
1676
- type: "decimalSeperator",
1677
- val: format.decimal
1678
- };
1679
- }
1680
-
1681
- if (!startFromSymbol) {
1682
- decimalArr = [{
1683
- type: "negative",
1684
- val: value < 0 ? "-" : ""
1685
- }].concat(decimalArr);
1686
- }
1687
-
1688
- if (rtl && currencies[currencyName].rtl) {
1689
- decimalArr = decimalArr.reverse();
1690
- }
1691
-
1692
- return decimalArr;
1693
- } else if (section === "$$") {
1694
- if (startFromSymbol) {
1695
- return [{
1696
- type: "negative",
1697
- val: value < 0 ? "-" : ""
1698
- }, {
1699
- type: "symbol",
1700
- val: symbol
1701
- }];
1702
- } else {
1703
- return [{
1704
- type: "symbol",
1705
- val: symbol
1706
- }];
1707
- }
1708
- } else {
1709
- return [{
1710
- type: "text",
1711
- val: section
1712
- }];
1713
- }
1714
- }).reduce(function (a, b) {
1715
- return a.concat(b);
1716
- });
1717
1655
  return {
1718
1656
  currencySplit: currencySplit,
1719
- currencySplitFormatedArr: currencySplitFormatedArr,
1720
1657
  format: format,
1721
1658
  str: (value < 0 ? "-" : "") + formattedValue,
1722
1659
  symbol: symbol
@@ -9417,7 +9354,72 @@ function sanitize(obj) {
9417
9354
  var val = objarr[1];
9418
9355
 
9419
9356
  if (typeof val === "string" || val instanceof String) {
9420
- return [objarr[0], sanitizeHtml(objarr[1])];
9357
+ return [objarr[0], sanitizeHtml(objarr[1], {
9358
+ allowedAttributes: {
9359
+ "*": ["style"]
9360
+ },
9361
+ allowedStyles: {
9362
+ "*": {
9363
+ color: [/^.*$/],
9364
+ direction: [/^.*$/],
9365
+ "letter-spacing": [/^.*$/],
9366
+ "line-height": [/^.*$/],
9367
+ "text-align": [/^.*$/],
9368
+ "text-decoration": [/^.*$/],
9369
+ "text-indent": [/^.*$/],
9370
+ "text-shadow": [/^.*$/],
9371
+ "text-transform": [/^.*$/],
9372
+ "text-overflow": [/^.*$/],
9373
+ "vertical-align": [/^.*$/],
9374
+ "word-spacing": [/^.*$/],
9375
+ font: [/^.*$/],
9376
+ "font-family": [/^.*$/],
9377
+ "font-size": [/^\d.*$/],
9378
+ "font-style": [/^.*$/],
9379
+ "font-variant": [/^.*$/],
9380
+ "font-weight": [/^.*$/],
9381
+ "list-style-type": [/^.*$/],
9382
+ height: [/^.*$/],
9383
+ width: [/^.*$/],
9384
+ margin: [/^.*$/],
9385
+ "margin-top": [/^.*$/],
9386
+ "margin-right": [/^.*$/],
9387
+ "margin-bottom": [/^.*$/],
9388
+ "margin-left": [/^.*$/],
9389
+ padding: [/^.*$/],
9390
+ "padding-top": [/^.*$/],
9391
+ "padding-right": [/^.*$/],
9392
+ "padding-bottom": [/^.*$/],
9393
+ "padding-left": [/^.*$/],
9394
+ border: [/^.*$/],
9395
+ "border-color": [/^.*$/],
9396
+ "border-style": [/^.*$/],
9397
+ "border-width": [/^.*$/],
9398
+ "border-radius": [/^.*$/],
9399
+ "border-bottom": [/^.*$/],
9400
+ "border-bottom-color": [/^.*$/],
9401
+ "border-bottom-style": [/^.*$/],
9402
+ "border-bottom-width": [/^.*$/],
9403
+ "border-left": [/^.*$/],
9404
+ "border-left-color": [/^.*$/],
9405
+ "border-left-style": [/^.*$/],
9406
+ "border-left-width": [/^.*$/],
9407
+ "border-right": [/^.*$/],
9408
+ "border-right-color": [/^.*$/],
9409
+ "border-right-style": [/^.*$/],
9410
+ "border-right-width": [/^.*$/],
9411
+ "border-top": [/^.*$/],
9412
+ "border-top-color": [/^.*$/],
9413
+ "border-top-style": [/^.*$/],
9414
+ "border-top-width": [/^.*$/],
9415
+ outline: [/^.*$/],
9416
+ "outline-color": [/^.*$/],
9417
+ "outline-offset": [/^.*$/],
9418
+ "outline-style": [/^.*$/],
9419
+ "outline-width": [/^.*$/]
9420
+ }
9421
+ }
9422
+ })];
9421
9423
  } else if (typeof val === "object") {
9422
9424
  return [objarr[0], sanitize(objarr[1])];
9423
9425
  } else {
@@ -9750,7 +9752,7 @@ var DocumentDefinitionCompat = function DocumentDefinitionCompat(dd) {
9750
9752
 
9751
9753
  var CompanyCompat = function CompanyCompat(doc) {
9752
9754
  if (doc == null) return null;
9753
- var mapping = new Map([["dateFormat", "df"], ["timeZone", "tz"], ["language", "la"], ["TFN", "tfn"], ["paymentInstruction1", "p1"], ["paymentInstruction2", "p2"], ["paymentInstruction3", "p3"], ["invoiceColor", "ct"], ["taxPercentage", "tp"], ["taxDeductible", "t1d"], ["taxInclusive", "ti"], ["taxName", "tn"], ["twoTaxes", "ttx"], ["taxName2", "tn2"], ["taxPercentage2", "tp2"], ["taxDeductible2", "t2d"], ["name", "c"], ["hasPaymentInstruction", "pi"], ["additionalInfo", "ai"], ["phoneNumber", "ph"], ["displayEmail", "de"], ["email", "e"], ["logoExists", "lg"], ["currency", "cr"], ["hasSignature", "sg"], ["currencyFormat", "cf"]]);
9755
+ var mapping = new Map([["dateFormat", "df"], ["timeZone", "tz"], ["language", "la"], ["businessNumber", "tfn"], ["abbrBusinessNumber", "bn"], ["paymentInstruction1", "p1"], ["paymentInstruction2", "p2"], ["paymentInstruction3", "p3"], ["invoiceColor", "ct"], ["taxPercentage", "tp"], ["taxDeductible", "t1d"], ["taxInclusive", "ti"], ["taxName", "tn"], ["twoTaxes", "ttx"], ["taxName2", "tn2"], ["taxPercentage2", "tp2"], ["taxDeductible2", "t2d"], ["name", "c"], ["hasPaymentInstruction", "pi"], ["additionalInfo", "ai"], ["phoneNumber", "ph"], ["displayEmail", "de"], ["email", "e"], ["logoExists", "lg"], ["currency", "cr"], ["hasSignature", "sg"], ["currencyFormat", "cf"]]);
9754
9756
  var rootMapping = new Map([["template", TemplateCompat], ["documentDefinitions", DocumentDefinitionCompat]]);
9755
9757
  var newCompany = Object.fromEntries(Object.entries(doc).map(function (_ref6) {
9756
9758
  var k = _ref6[0],