@holmdigital/engine 2.1.6 → 2.2.0

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.
Files changed (41) hide show
  1. package/dist/{chunk-Y6FXYEAI.mjs → chunk-DIBTSSLZ.mjs} +9 -1
  2. package/dist/{chunk-BR2T76XC.mjs → chunk-FAZPXKHR.mjs} +122 -57
  3. package/dist/cli/index.js +161 -57
  4. package/dist/cli/index.mjs +26 -7
  5. package/dist/cli/templates/da.json +3 -3
  6. package/dist/cli/templates/de.json +3 -3
  7. package/dist/cli/templates/en-ca.json +39 -0
  8. package/dist/cli/templates/en-gb.json +39 -0
  9. package/dist/cli/templates/en-us.json +39 -0
  10. package/dist/cli/templates/es.json +3 -3
  11. package/dist/cli/templates/fi.json +3 -3
  12. package/dist/cli/templates/fr.json +3 -3
  13. package/dist/cli/templates/it.json +36 -0
  14. package/dist/cli/templates/nl.json +3 -3
  15. package/dist/cli/templates/no.json +3 -3
  16. package/dist/cli/templates/pl.json +36 -0
  17. package/dist/cli/templates/pt.json +36 -0
  18. package/dist/cli/templates/sv.json +3 -3
  19. package/dist/{github-actions-DYED2EIL.mjs → github-actions-5AFDFD4T.mjs} +1 -1
  20. package/dist/{i18n-WJXLKRLV.mjs → i18n-6XB3K2PH.mjs} +2 -2
  21. package/dist/index.d.mts +1 -0
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.js +133 -55
  24. package/dist/index.mjs +3 -3
  25. package/dist/{junit-generator-QIUEEUXW.mjs → junit-generator-MNO6GP5J.mjs} +1 -1
  26. package/dist/templates/da.json +3 -3
  27. package/dist/templates/de.json +3 -3
  28. package/dist/templates/en-ca.json +39 -0
  29. package/dist/templates/en-gb.json +39 -0
  30. package/dist/templates/en-us.json +39 -0
  31. package/dist/templates/es.json +3 -3
  32. package/dist/templates/fi.json +3 -3
  33. package/dist/templates/fr.json +3 -3
  34. package/dist/templates/it.json +36 -0
  35. package/dist/templates/nl.json +3 -3
  36. package/dist/templates/no.json +3 -3
  37. package/dist/templates/pl.json +36 -0
  38. package/dist/templates/pt.json +36 -0
  39. package/dist/templates/sv.json +3 -3
  40. package/package.json +2 -2
  41. /package/dist/{chunk-PIGYYEJV.mjs → chunk-MGIEQZMZ.mjs} +0 -0
package/dist/cli/index.js CHANGED
@@ -30,6 +30,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
+ // ../../node_modules/tsup/assets/cjs_shims.js
34
+ var init_cjs_shims = __esm({
35
+ "../../node_modules/tsup/assets/cjs_shims.js"() {
36
+ "use strict";
37
+ }
38
+ });
39
+
33
40
  // src/locales/en.json
34
41
  var en_default;
35
42
  var init_en = __esm({
@@ -484,6 +491,7 @@ var locales, currentLang;
484
491
  var init_i18n = __esm({
485
492
  "src/i18n/index.ts"() {
486
493
  "use strict";
494
+ init_cjs_shims();
487
495
  init_en();
488
496
  init_sv();
489
497
  init_de();
@@ -542,6 +550,7 @@ Fix: ${report.remediation.component ? `Use <${report.remediation.component} />`
542
550
  var init_github_actions = __esm({
543
551
  "src/reporting/github-actions.ts"() {
544
552
  "use strict";
553
+ init_cjs_shims();
545
554
  }
546
555
  });
547
556
 
@@ -625,19 +634,23 @@ function escapeXML(unsafe) {
625
634
  var init_junit_generator = __esm({
626
635
  "src/reporting/junit-generator.ts"() {
627
636
  "use strict";
637
+ init_cjs_shims();
628
638
  }
629
639
  });
630
640
 
631
641
  // src/cli/index.ts
642
+ init_cjs_shims();
632
643
  var import_commander = require("commander");
633
644
  var import_chalk = __toESM(require("chalk"));
634
645
  var import_ora = __toESM(require("ora"));
635
646
 
636
647
  // src/core/regulatory-scanner.ts
648
+ init_cjs_shims();
637
649
  var import_axe_core = __toESM(require("axe-core"));
638
650
  var import_puppeteer = __toESM(require("puppeteer"));
639
651
 
640
652
  // src/core/virtual-dom.ts
653
+ init_cjs_shims();
641
654
  var VirtualDOMBuilder = class {
642
655
  page;
643
656
  constructor(page) {
@@ -728,6 +741,7 @@ var VirtualDOMBuilder = class {
728
741
  };
729
742
 
730
743
  // src/core/html-validator.ts
744
+ init_cjs_shims();
731
745
  var import_html_validate = require("html-validate");
732
746
  var HtmlValidator = class {
733
747
  validator;
@@ -768,7 +782,7 @@ var HtmlValidator = class {
768
782
  // src/core/regulatory-scanner.ts
769
783
  var import_node_fs = require("fs");
770
784
  function getEngineVersion() {
771
- return "2.1.6";
785
+ return "2.2.0";
772
786
  }
773
787
  function getStandardsVersion() {
774
788
  try {
@@ -1034,6 +1048,7 @@ var RegulatoryScanner = class {
1034
1048
  };
1035
1049
 
1036
1050
  // src/automation/pseudo-automation.ts
1051
+ init_cjs_shims();
1037
1052
  var PseudoAutomationEngine = class {
1038
1053
  /**
1039
1054
  * Generera ett Playwright-testskript baserat på en rapport
@@ -1101,7 +1116,11 @@ test('${testName}', async ({ page }) => {
1101
1116
  }
1102
1117
  };
1103
1118
 
1119
+ // src/reporting/html-template.ts
1120
+ init_cjs_shims();
1121
+
1104
1122
  // src/reporting/badge-generator.ts
1123
+ init_cjs_shims();
1105
1124
  var BADGE_COLOR = "00703C";
1106
1125
  var BADGE_BASE_URL = "https://img.shields.io/badge/HolmDigital_Engine";
1107
1126
  function generateBadgeUrl(score) {
@@ -1120,13 +1139,30 @@ function generateBadgeMarkdown(score) {
1120
1139
 
1121
1140
  // src/reporting/html-template.ts
1122
1141
  init_i18n();
1142
+ var LOCALE_TO_INTL = {
1143
+ sv: "sv-SE",
1144
+ en: "en-US",
1145
+ no: "nb-NO",
1146
+ nb: "nb-NO",
1147
+ fi: "fi-FI",
1148
+ da: "da-DK",
1149
+ dk: "da-DK",
1150
+ de: "de-DE",
1151
+ fr: "fr-FR",
1152
+ es: "es-ES",
1153
+ nl: "nl-NL",
1154
+ "en-gb": "en-GB",
1155
+ "en-us": "en-US",
1156
+ "en-ca": "en-CA"
1157
+ };
1123
1158
  function generateReportHTML(result) {
1124
1159
  const criticalCount = result.stats.critical;
1125
1160
  const highCount = result.stats.high;
1126
1161
  const htmlErrorsCount = result.htmlValidation?.errors?.length ?? 0;
1127
1162
  const scoreColor = result.score > 90 ? "#16a34a" : result.score > 70 ? "#eab308" : "#dc2626";
1128
1163
  const formatDate = (dateString) => {
1129
- return new Date(dateString).toLocaleDateString(getCurrentLang() === "sv" ? "sv-SE" : "en-US", {
1164
+ const intlLocale = LOCALE_TO_INTL[getCurrentLang()] || "en-US";
1165
+ return new Date(dateString).toLocaleDateString(intlLocale, {
1130
1166
  year: "numeric",
1131
1167
  month: "long",
1132
1168
  day: "numeric",
@@ -1406,6 +1442,7 @@ function generateReportHTML(result) {
1406
1442
  }
1407
1443
 
1408
1444
  // src/reporting/pdf-generator.ts
1445
+ init_cjs_shims();
1409
1446
  var import_puppeteer2 = __toESM(require("puppeteer"));
1410
1447
  async function generatePDF(htmlContent, outputPath) {
1411
1448
  const browser = await import_puppeteer2.default.launch({
@@ -1435,52 +1472,77 @@ async function generatePDF(htmlContent, outputPath) {
1435
1472
  }
1436
1473
 
1437
1474
  // src/reporting/statement-generator.ts
1475
+ init_cjs_shims();
1438
1476
  var import_react = __toESM(require("react"));
1439
1477
  var import_server = require("react-dom/server");
1440
1478
  var import_components = require("@holmdigital/components");
1441
1479
  var import_standards = require("@holmdigital/standards");
1442
1480
  var import_promises = __toESM(require("fs/promises"));
1443
1481
  var import_path = __toESM(require("path"));
1444
- var import_node_url = require("url");
1445
- var import_meta = {};
1446
- var __dirname_esm = typeof __dirname === "undefined" ? import_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url)) : __dirname;
1482
+ var EVALUATION_METHOD = {
1483
+ sv: "Automatiserad granskning via @holmdigital/engine",
1484
+ en: "Automated scan via @holmdigital/engine",
1485
+ no: "Automatisert gjennomgang via @holmdigital/engine",
1486
+ nb: "Automatisert gjennomgang via @holmdigital/engine",
1487
+ fi: "Automaattinen tarkistus @holmdigital/engine-ty\xF6kalulla",
1488
+ da: "Automatiseret gennemgang via @holmdigital/engine",
1489
+ de: "Automatisierte Pr\xFCfung mit @holmdigital/engine",
1490
+ fr: "Analyse automatis\xE9e via @holmdigital/engine",
1491
+ es: "An\xE1lisis automatizado mediante @holmdigital/engine",
1492
+ nl: "Geautomatiseerde controle via @holmdigital/engine",
1493
+ it: "Scansione automatizzata tramite @holmdigital/engine",
1494
+ pt: "Verifica\xE7\xE3o automatizada via @holmdigital/engine",
1495
+ pl: "Automatyczne skanowanie za pomoc\u0105 @holmdigital/engine",
1496
+ "en-gb": "Automated scan via @holmdigital/engine",
1497
+ "en-us": "Automated scan via @holmdigital/engine",
1498
+ "en-ca": "Automated scan via @holmdigital/engine"
1499
+ };
1500
+ var STATUS_LABELS = {
1501
+ sv: { full: "Fullt ut f\xF6renlig", partial: "Delvis f\xF6renlig", "non-compliant": "Inte f\xF6renlig" },
1502
+ en: { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
1503
+ no: { full: "Helt i samsvar", partial: "Delvis i samsvar", "non-compliant": "Ikke i samsvar" },
1504
+ nb: { full: "Helt i samsvar", partial: "Delvis i samsvar", "non-compliant": "Ikke i samsvar" },
1505
+ fi: { full: "T\xE4ysin saavutettava", partial: "Osittain saavutettava", "non-compliant": "Ei saavutettava" },
1506
+ da: { full: "Fuldt ud i overensstemmelse", partial: "Delvist i overensstemmelse", "non-compliant": "Ikke i overensstemmelse" },
1507
+ de: { full: "Vollst\xE4ndig konform", partial: "Teilweise konform", "non-compliant": "Nicht konform" },
1508
+ fr: { full: "Totalement conforme", partial: "Partiellement conforme", "non-compliant": "Non conforme" },
1509
+ es: { full: "Plenamente conforme", partial: "Parcialmente conforme", "non-compliant": "No conforme" },
1510
+ nl: { full: "Volledig conform", partial: "Gedeeltelijk conform", "non-compliant": "Niet conform" },
1511
+ it: { full: "Pienamente conforme", partial: "Parzialmente conforme", "non-compliant": "Non conforme" },
1512
+ pt: { full: "Totalmente conforme", partial: "Parcialmente conforme", "non-compliant": "N\xE3o conforme" },
1513
+ pl: { full: "W pe\u0142ni zgodny", partial: "Cz\u0119\u015Bciowo zgodny", "non-compliant": "Niezgodny" },
1514
+ "en-gb": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
1515
+ "en-us": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" },
1516
+ "en-ca": { full: "Fully compliant", partial: "Partially compliant", "non-compliant": "Non-compliant" }
1517
+ };
1518
+ var RESPONSE_TIME_DEFAULT = {
1519
+ sv: "2 dagar",
1520
+ en: "2 days",
1521
+ no: "2 dager",
1522
+ nb: "2 dager",
1523
+ fi: "2 p\xE4iv\xE4\xE4",
1524
+ da: "2 dage",
1525
+ de: "2 Tage",
1526
+ fr: "2 jours",
1527
+ es: "2 d\xEDas",
1528
+ nl: "2 dagen",
1529
+ it: "2 giorni",
1530
+ pt: "2 dias",
1531
+ pl: "2 dni",
1532
+ "en-gb": "2 days",
1533
+ "en-us": "2 days",
1534
+ "en-ca": "2 days"
1535
+ };
1447
1536
  async function generateStatementContent(result, lang = "en", format = "html", metadata) {
1537
+ const templatePath = import_path.default.join(__dirname, "templates", `${lang}.json`);
1448
1538
  let template;
1449
- const possibleTemplatePaths = [
1450
- import_path.default.join(__dirname_esm, "templates", `${lang}.json`),
1451
- import_path.default.join(__dirname_esm, "../src/reporting/templates", `${lang}.json`),
1452
- import_path.default.join(process.cwd(), "packages/engine/src/reporting/templates", `${lang}.json`)
1453
- ];
1454
- let loaded = false;
1455
- for (const p of possibleTemplatePaths) {
1456
- try {
1457
- const data = await import_promises.default.readFile(p, "utf-8");
1458
- template = JSON.parse(data);
1459
- loaded = true;
1460
- break;
1461
- } catch (e) {
1462
- continue;
1463
- }
1464
- }
1465
- if (!loaded) {
1466
- const fallbackPaths = [
1467
- import_path.default.join(__dirname_esm, "templates", "en.json"),
1468
- import_path.default.join(__dirname_esm, "../src/reporting/templates", "en.json"),
1469
- import_path.default.join(process.cwd(), "packages/engine/src/reporting/templates", "en.json")
1470
- ];
1471
- for (const p of fallbackPaths) {
1472
- try {
1473
- const data = await import_promises.default.readFile(p, "utf-8");
1474
- template = JSON.parse(data);
1475
- loaded = true;
1476
- break;
1477
- } catch (e) {
1478
- continue;
1479
- }
1480
- }
1481
- }
1482
- if (!loaded || !template) {
1483
- throw new Error(`Accessibility statement templates missing. Looked in: ${possibleTemplatePaths.join(", ")}`);
1539
+ try {
1540
+ const data = await import_promises.default.readFile(templatePath, "utf-8");
1541
+ template = JSON.parse(data);
1542
+ } catch {
1543
+ throw new Error(
1544
+ `Accessibility statement template not found for locale "${lang}". Expected file at: ${templatePath}`
1545
+ );
1484
1546
  }
1485
1547
  let complianceLevel = "full";
1486
1548
  if (result.stats.critical > 0 || result.legalSummary && result.legalSummary.eaaDeadlineViolations > 0) {
@@ -1496,14 +1558,35 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1496
1558
  }
1497
1559
  });
1498
1560
  const nonComplianceItems = Array.from(issuesMap.values());
1499
- let country = metadata?.country || "SE";
1500
- if (!metadata?.country) {
1501
- if (result.url.endsWith(".no")) country = "NO";
1502
- if (result.url.endsWith(".dk")) country = "DK";
1503
- if (result.url.endsWith(".fi")) country = "FI";
1504
- if (result.url.endsWith(".de")) country = "DE";
1561
+ let country = "EU";
1562
+ if (metadata?.country) {
1563
+ country = metadata.country;
1564
+ } else {
1565
+ const TLD_MAP = {
1566
+ "se": "SE",
1567
+ "no": "NO",
1568
+ "dk": "DK",
1569
+ "fi": "FI",
1570
+ "de": "DE",
1571
+ "fr": "FR",
1572
+ "nl": "NL",
1573
+ "es": "ES",
1574
+ "it": "IT",
1575
+ "pt": "PT",
1576
+ "pl": "PL",
1577
+ "uk": "GB",
1578
+ "us": "US",
1579
+ "ca": "CA"
1580
+ };
1581
+ try {
1582
+ const hostname = new URL(result.url).hostname;
1583
+ const tld = hostname.split(".").pop()?.toLowerCase() || "";
1584
+ country = TLD_MAP[tld] ?? "EU";
1585
+ } catch {
1586
+ country = "EU";
1587
+ }
1505
1588
  }
1506
- const sector = "public";
1589
+ const sector = metadata?.sector || "public";
1507
1590
  let logoUrl;
1508
1591
  try {
1509
1592
  const possiblePaths = [
@@ -1531,7 +1614,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1531
1614
  complianceLevel,
1532
1615
  lastReviewDate: /* @__PURE__ */ new Date(),
1533
1616
  assessmentDate: /* @__PURE__ */ new Date(),
1534
- evaluationMethod: lang === "sv" ? "Automatiserad granskning via @holmdigital/engine" : "Automated Scan via @holmdigital/engine",
1617
+ evaluationMethod: EVALUATION_METHOD[lang] || EVALUATION_METHOD["en"],
1535
1618
  generatorTool: {
1536
1619
  name: "HolmDigital Regulatory Engine",
1537
1620
  url: "https://holmdigital.se"
@@ -1539,7 +1622,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1539
1622
  logoUrl,
1540
1623
  contactEmail: metadata?.contactEmail || "hej@holmdigital.se",
1541
1624
  phoneNumber: metadata?.phoneNumber || "070-123 45 67",
1542
- responseTime: metadata?.responseTime || (lang === "sv" ? "2 dagar" : "2 days"),
1625
+ responseTime: metadata?.responseTime || RESPONSE_TIME_DEFAULT[lang] || RESPONSE_TIME_DEFAULT["en"],
1543
1626
  nonComplianceItems,
1544
1627
  locale: lang,
1545
1628
  badgeUrl: generateBadgeUrl(result.score) || void 0,
@@ -1565,10 +1648,11 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1565
1648
  </html>`;
1566
1649
  } else {
1567
1650
  const dateStr = props.lastReviewDate.toISOString().split("T")[0];
1651
+ const labels = STATUS_LABELS[lang] || STATUS_LABELS["en"];
1568
1652
  const statusMap = {
1569
- "full": lang === "sv" ? "Fullt ut f\xF6renlig" : lang === "no" || lang === "nb" ? "Helt i samsvar" : lang === "da" ? "Fuldt ud i overensstemmelse" : "Fully compliant",
1570
- "partial": lang === "sv" ? "Delvis f\xF6renlig" : lang === "no" || lang === "nb" ? "Delvis i samsvar" : lang === "da" ? "Delvist i overensstemmelse" : "Partially compliant",
1571
- "non-compliant": lang === "sv" ? "Inte f\xF6renlig" : lang === "no" || lang === "nb" ? "Ikke i samsvar" : lang === "da" ? "Ikke i overensstemmelse" : "Non-compliant"
1653
+ "full": labels["full"],
1654
+ "partial": labels["partial"],
1655
+ "non-compliant": labels["non-compliant"]
1572
1656
  };
1573
1657
  const substitutions = {
1574
1658
  statusString: statusMap[complianceLevel],
@@ -1580,6 +1664,8 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1580
1664
  "{<e-postadress>}": props.contactEmail || "",
1581
1665
  "{<e-mailosoite>}": props.contactEmail || "",
1582
1666
  "{<e-mailadresse>}": props.contactEmail || "",
1667
+ "{<e-mailadres>}": props.contactEmail || "",
1668
+ "{<e-postadresse>}": props.contactEmail || "",
1583
1669
  "{<e-mail address>}": props.contactEmail || "",
1584
1670
  "{<email address>}": props.contactEmail || "",
1585
1671
  "{<telefonnummer>}": props.phoneNumber || "",
@@ -1599,6 +1685,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1599
1685
  "{<assessment date>}": dateStr,
1600
1686
  "{<uppdateringsdatum>}": dateStr,
1601
1687
  "{<oppdateringsdato>}": dateStr,
1688
+ "{<opdateringsdato>}": dateStr,
1602
1689
  "{<p\xE4ivitysp\xE4iv\xE4>}": dateStr,
1603
1690
  "{<updatedatum>}": dateStr,
1604
1691
  "{<aktualisierungsdatum>}": dateStr,
@@ -1612,13 +1699,18 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1612
1699
  "{<ver\xF6ffentlichungsdatum>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1613
1700
  "{<date_publication>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1614
1701
  "{<fecha_publicacion>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1702
+ "{<offentligg\xF8relsesdato>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1615
1703
  "{<publish date>}": props.publishDate?.toISOString().split("T")[0] || "2024-01-01",
1616
1704
  "{<metod>}": props.evaluationMethod || "Automated Scan",
1617
1705
  "{<metodi>}": props.evaluationMethod || "Automated Scan",
1618
1706
  "{<methode>}": props.evaluationMethod || "Automated Scan",
1707
+ "{<metode>}": props.evaluationMethod || "Automated Scan",
1708
+ "{<metodo>}": props.evaluationMethod || "Automated Scan",
1709
+ "{<m\xE9thode>}": props.evaluationMethod || "Automated Scan",
1619
1710
  "{<m\xE9todo>}": props.evaluationMethod || "Automated Scan",
1620
1711
  "{<method>}": props.evaluationMethod || "Automated Scan",
1621
1712
  "{<extern akt\xF6r>}": props.generatorTool?.name || "HolmDigital Engine",
1713
+ "{<ekstern akt\xF8r>}": props.generatorTool?.name || "HolmDigital Engine",
1622
1714
  "{<ekstern aktor>}": props.generatorTool?.name || "HolmDigital Engine",
1623
1715
  "{<ulkoinen taho>}": props.generatorTool?.name || "HolmDigital Engine",
1624
1716
  "{<externe partij>}": props.generatorTool?.name || "HolmDigital Engine",
@@ -1626,7 +1718,11 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1626
1718
  "{<tiers externe>}": props.generatorTool?.name || "HolmDigital Engine",
1627
1719
  "{<tercero externo>}": props.generatorTool?.name || "HolmDigital Engine",
1628
1720
  "{<third party>}": props.generatorTool?.name || "HolmDigital Engine",
1629
- "{<enforcement_body>}": import_standards.ENFORCEMENT_BODIES[country] || import_standards.ENFORCEMENT_BODIES.EU,
1721
+ "{<enforcement_body>}": (0, import_standards.getEnforcementBody)(country, sector),
1722
+ "{<national_law>}": (() => {
1723
+ const law = (0, import_standards.getNationalLawByFramework)(sector === "private" ? "EAA" : "WAD", country);
1724
+ return law ? `${law.fullName} (${law.law})` : "";
1725
+ })(),
1630
1726
  "{<brister>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "sv" ? "Inga k\xE4nda brister." : "No known issues.",
1631
1727
  "{<puutteet>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fi" ? "Ei tiedossa olevia puutteita." : "No known issues.",
1632
1728
  "{<gebreken>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "nl" ? "Geen bekende gebreken." : "No known issues.",
@@ -1634,6 +1730,9 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1634
1730
  "{<d\xE9fauts>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "fr" ? "Aucun d\xE9faut connu." : "No known issues.",
1635
1731
  "{<deficiencias>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "es" ? "No hay deficiencias conocidas." : "No known issues.",
1636
1732
  "{<mangler>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : lang === "no" || lang === "da" ? "Ingen kendte mangler." : "No known issues.",
1733
+ "{<carenze>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Nessuna carenza nota.",
1734
+ "{<defici\xEAncias>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Nenhuma defici\xEAncia conhecida.",
1735
+ "{<braki>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "Brak znanych problem\xF3w.",
1637
1736
  "{<issues>}": nonComplianceItems.length > 0 ? nonComplianceItems.map((item) => `* ${item}`).join("\n") : "No known issues."
1638
1737
  };
1639
1738
  const processText = (text) => {
@@ -1645,11 +1744,14 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1645
1744
  if (content2.includes("{<telefonnummer>}") || content2.includes("{<telephone number>}")) {
1646
1745
  return props.phoneNumber ? content2 : "";
1647
1746
  }
1648
- if (content2.includes("{<brister>}") || content2.includes("{<mangler>}") || content2.includes("{<issues>}")) {
1747
+ if (content2.includes("{<brister>}") || content2.includes("{<mangler>}") || content2.includes("{<issues>}") || content2.includes("{<carenze>}") || content2.includes("{<defici\xEAncias>}") || content2.includes("{<braki>}")) {
1649
1748
  return complianceLevel !== "full" ? content2 : "";
1650
1749
  }
1651
1750
  return content2;
1652
1751
  });
1752
+ processed = processed.replace(/\{<[^>]+>\}/g, (match) => {
1753
+ return substitutions[match] !== void 0 ? substitutions[match] : match;
1754
+ });
1653
1755
  processed = processed.replace(/\{([^{}]*?)\}/g, (_match, content2) => {
1654
1756
  const parts = content2.split("/");
1655
1757
  if (parts.length >= 2) {
@@ -1658,8 +1760,7 @@ async function generateStatementContent(result, lang = "en", format = "html", me
1658
1760
  if (complianceLevel === "non-compliant") idx = parts.length > 2 ? 2 : 1;
1659
1761
  return parts[idx].trim();
1660
1762
  }
1661
- const key = `{${content2}}`;
1662
- return substitutions[key] !== void 0 ? substitutions[key] : _match;
1763
+ return _match;
1663
1764
  });
1664
1765
  return processed;
1665
1766
  };
@@ -1690,6 +1791,7 @@ async function generateStatement(result, outputPath, lang = "en", format = "html
1690
1791
  init_i18n();
1691
1792
 
1692
1793
  // src/cli/cloud-client.ts
1794
+ init_cjs_shims();
1693
1795
  function transformToCloudPayload(result) {
1694
1796
  const violations = result.reports.map((report) => {
1695
1797
  const firstNode = report.failingNodes?.[0];
@@ -1779,7 +1881,7 @@ function isValidUrl(urlString) {
1779
1881
  }
1780
1882
  var program = new import_commander.Command();
1781
1883
  program.name("hd-a11y-scan").description("HolmDigital Regulatory Scanner").version(getEngineVersion());
1782
- program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").action(async (url, cliOptions) => {
1884
+ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--sector <type>", "Sector type: public (WAD) or private (EAA)", "public").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").action(async (url, cliOptions) => {
1783
1885
  const explorer = (0, import_cosmiconfig.cosmiconfig)("a11y");
1784
1886
  const configResult = await explorer.search();
1785
1887
  const fileConfig = configResult ? configResult.config : {};
@@ -1804,6 +1906,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1804
1906
  org: cliOptions.org || fileConfig.org,
1805
1907
  responseTime: cliOptions.responseTime || fileConfig.responseTime,
1806
1908
  country: cliOptions.country || fileConfig.country,
1909
+ sector: cliOptions.sector || fileConfig.sector || "public",
1807
1910
  publishDate: cliOptions.publishDate || fileConfig.publishDate
1808
1911
  };
1809
1912
  setLanguage(options.lang);
@@ -1855,6 +1958,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1855
1958
  organizationName: options.org,
1856
1959
  responseTime: options.responseTime,
1857
1960
  country: options.country,
1961
+ sector: options.sector,
1858
1962
  publishDate: options.publishDate
1859
1963
  };
1860
1964
  if (options.statement.toLowerCase().endsWith(".pdf")) {
@@ -7,13 +7,13 @@ import {
7
7
  generateStatement,
8
8
  generateStatementContent,
9
9
  getEngineVersion
10
- } from "../chunk-BR2T76XC.mjs";
10
+ } from "../chunk-FAZPXKHR.mjs";
11
11
  import {
12
12
  getCurrentLang,
13
13
  setLanguage,
14
14
  t
15
- } from "../chunk-PIGYYEJV.mjs";
16
- import "../chunk-Y6FXYEAI.mjs";
15
+ } from "../chunk-MGIEQZMZ.mjs";
16
+ import "../chunk-DIBTSSLZ.mjs";
17
17
 
18
18
  // src/cli/index.ts
19
19
  import { Command } from "commander";
@@ -21,13 +21,30 @@ import chalk from "chalk";
21
21
  import ora from "ora";
22
22
 
23
23
  // src/reporting/html-template.ts
24
+ var LOCALE_TO_INTL = {
25
+ sv: "sv-SE",
26
+ en: "en-US",
27
+ no: "nb-NO",
28
+ nb: "nb-NO",
29
+ fi: "fi-FI",
30
+ da: "da-DK",
31
+ dk: "da-DK",
32
+ de: "de-DE",
33
+ fr: "fr-FR",
34
+ es: "es-ES",
35
+ nl: "nl-NL",
36
+ "en-gb": "en-GB",
37
+ "en-us": "en-US",
38
+ "en-ca": "en-CA"
39
+ };
24
40
  function generateReportHTML(result) {
25
41
  const criticalCount = result.stats.critical;
26
42
  const highCount = result.stats.high;
27
43
  const htmlErrorsCount = result.htmlValidation?.errors?.length ?? 0;
28
44
  const scoreColor = result.score > 90 ? "#16a34a" : result.score > 70 ? "#eab308" : "#dc2626";
29
45
  const formatDate = (dateString) => {
30
- return new Date(dateString).toLocaleDateString(getCurrentLang() === "sv" ? "sv-SE" : "en-US", {
46
+ const intlLocale = LOCALE_TO_INTL[getCurrentLang()] || "en-US";
47
+ return new Date(dateString).toLocaleDateString(intlLocale, {
31
48
  year: "numeric",
32
49
  month: "long",
33
50
  day: "numeric",
@@ -425,7 +442,7 @@ function isValidUrl(urlString) {
425
442
  }
426
443
  var program = new Command();
427
444
  program.name("hd-a11y-scan").description("HolmDigital Regulatory Scanner").version(getEngineVersion());
428
- program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").action(async (url, cliOptions) => {
445
+ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code (en, sv)").option("--ci", "Run in CI/CD mode (exit code 1 on critical failures)").option("--generate-tests", "Generate Pseudo-Automation tests").option("--json", "Output as JSON").option("--junit <path>", "Generate JUnit XML report").option("--pdf <path>", "Generate PDF report to path").option("--statement <path>", "Generate accessibility statement HTML to path").option("--format <type>", "Output format for statement (html, md)", "html").option("--viewport <size>", 'Set viewport (e.g. "mobile", "desktop", "1024x768")').option("--threshold <level>", "Severity threshold (critical, high, medium, low)").option("--api-key <key>", "API key for HolmDigital Cloud").option("--cloud-url <url>", "Cloud API URL").option("--invalid-https-cert", "Allow scanning on pages with invalid https certificate").option("--email <email>", "Contact email for accessibility statement").option("--phone <number>", "Contact phone number for accessibility statement").option("--org <name>", "Organization name for accessibility statement").option("--response-time <time>", "Expected response time for accessibility statement").option("--country <code>", "Country code for accessibility statement enforcement body").option("--sector <type>", "Sector type: public (WAD) or private (EAA)", "public").option("--publish-date <date>", "Publish date for the website (YYYY-MM-DD)").action(async (url, cliOptions) => {
429
446
  const explorer = cosmiconfig("a11y");
430
447
  const configResult = await explorer.search();
431
448
  const fileConfig = configResult ? configResult.config : {};
@@ -450,6 +467,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
450
467
  org: cliOptions.org || fileConfig.org,
451
468
  responseTime: cliOptions.responseTime || fileConfig.responseTime,
452
469
  country: cliOptions.country || fileConfig.country,
470
+ sector: cliOptions.sector || fileConfig.sector || "public",
453
471
  publishDate: cliOptions.publishDate || fileConfig.publishDate
454
472
  };
455
473
  setLanguage(options.lang);
@@ -501,6 +519,7 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
501
519
  organizationName: options.org,
502
520
  responseTime: options.responseTime,
503
521
  country: options.country,
522
+ sector: options.sector,
504
523
  publishDate: options.publishDate
505
524
  };
506
525
  if (options.statement.toLowerCase().endsWith(".pdf")) {
@@ -618,11 +637,11 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
618
637
  }
619
638
  }
620
639
  if (options.ci && result.reports.length > 0) {
621
- const { generateGitHubActionsAnnotations } = await import("../github-actions-DYED2EIL.mjs");
640
+ const { generateGitHubActionsAnnotations } = await import("../github-actions-5AFDFD4T.mjs");
622
641
  generateGitHubActionsAnnotations(result.reports);
623
642
  }
624
643
  if (options.junit) {
625
- const { generateJUnitXML } = await import("../junit-generator-QIUEEUXW.mjs");
644
+ const { generateJUnitXML } = await import("../junit-generator-MNO6GP5J.mjs");
626
645
  const fs = await import("fs/promises");
627
646
  const xml = generateJUnitXML(result);
628
647
  await fs.writeFile(options.junit, xml);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Tilgængelighed for {<webbplats>}",
3
- "intro": "{<organisation>} står bag dette websted. Vi ønsker, at så mange som muligt skal kunne bruge det. Dette dokument beskriver, hvordan {<webbplats>} overholder loven om webtilgængelighed, eventuelle kendte tilgængelighedsproblemer, og hvordan du kan rapportere mangler til os, så vi kan udbedre dem.",
3
+ "intro": "{<organisation>} står bag dette websted. Vi ønsker, at så mange som muligt skal kunne bruge det. Dette dokument beskriver, hvordan {<webbplats>} overholder {<national_law>}, eventuelle kendte tilgængelighedsproblemer, og hvordan du kan rapportere mangler til os, så vi kan udbedre dem.",
4
4
  "sections": [
5
5
  {
6
6
  "id": "how-accessible",
@@ -20,12 +20,12 @@
20
20
  {
21
21
  "id": "enforcement",
22
22
  "title": "Håndhævelsesprocedure",
23
- "content": "{<enforcement_body>} har ansvaret for tilsyn med loven om webtilgængelighed. Du kan klage til {<enforcement_body>}, hvis du mener, at vores digitale service har mangler i tilgængeligheden.\n\nDu kan også klage til {<enforcement_body>}, hvis du mener, at vores vurdering af, hvad der er en uforholdsmæssig stor byrde, skal gennemgås, hvis du mener, at vores tilgængelighedserklæring har mangler, eller hvis du mener, at vi ikke har håndteret din anmodning om tilgængeliggørelse korrekt."
23
+ "content": "{<enforcement_body>} har ansvaret for tilsyn med {<national_law>}. Du kan klage til {<enforcement_body>}, hvis du mener, at vores digitale service har mangler i tilgængeligheden.\n\nDu kan også klage til {<enforcement_body>}, hvis du mener, at vores vurdering af, hvad der er en uforholdsmæssig stor byrde, skal gennemgås, hvis du mener, at vores tilgængelighedserklæring har mangler, eller hvis du mener, at vi ikke har håndteret din anmodning om tilgængeliggørelse korrekt."
24
24
  },
25
25
  {
26
26
  "id": "technical",
27
27
  "title": "Teknisk information om webstedets tilgængelighed",
28
- "content": "{Dette websted er fuldt ud i overensstemmelse med loven om webtilgængelighed./Dette websted er delvist i overensstemmelse med loven om webtilgængelighed på grund af de mangler, der er beskrevet nedenfor./Dette websted er ikke i overensstemmelse med loven om webtilgængelighed. Utilgængelige dele er beskrevet nedenfor.}"
28
+ "content": "{Dette websted er fuldt ud i overensstemmelse med {<national_law>}./Dette websted er delvist i overensstemmelse med {<national_law>} på grund af de mangler, der er beskrevet nedenfor./Dette websted er ikke i overensstemmelse med {<national_law>}. Utilgængelige dele er beskrevet nedenfor.}"
29
29
  },
30
30
  {
31
31
  "content": "Det indhold, der er beskrevet nedenfor, er på den ene eller anden måde ikke helt tilgængeligt.\n\n[\n**Manglende overholdelse af lovkravene**\n\n{<mangler>}\n]"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "title": "Barrierefreiheitserklärung für {<webbplats>}",
3
- "intro": "{<organisation>} ist bemüht, ihre Website im Einklang mit den nationalen Rechtsvorschriften zur Umsetzung der Richtlinie (EU) 2016/2102 des Europäischen Parlaments und des Rates barrierefrei zugänglich zu machen. Diese Erklärung zur Barrierefreiheit gilt für {<webbplats>}.",
3
+ "intro": "{<organisation>} ist bemüht, ihre Website im Einklang mit {<national_law>} barrierefrei zugänglich zu machen. Diese Erklärung zur Barrierefreiheit gilt für {<webbplats>}.",
4
4
  "sections": [
5
5
  {
6
6
  "id": "how-accessible",
@@ -20,12 +20,12 @@
20
20
  {
21
21
  "id": "enforcement",
22
22
  "title": "Durchsetzungsverfahren",
23
- "content": "Die {<enforcement_body>} ist für die Überwachung der Barrierefreiheitsanforderungen zuständig. Wenn Sie auf unsere Benachrichtigungen oder Anfragen keine zufriedenstellende Antwort erhalten haben, können Sie sich an {<enforcement_body>} wenden.\n\nSie können auch eine Beschwerde bei {<enforcement_body>} einreichen, wenn Sie der Meinung sind, dass unsere Einschätzung einer unverhältnismäßigen Belastung überprüft werden sollte, wenn Sie Mängel in unserer Barrierefreiheitserklärung feststellen oder wenn Sie der Meinung sind, dass wir Ihren Antrag auf barrierefreie Bereitstellung von Inhalten nicht korrekt bearbeitet haben."
23
+ "content": "Die {<enforcement_body>} ist für die Überwachung der Anforderungen gemäß {<national_law>} zuständig. Wenn Sie auf unsere Benachrichtigungen oder Anfragen keine zufriedenstellende Antwort erhalten haben, können Sie sich an {<enforcement_body>} wenden.\n\nSie können auch eine Beschwerde bei {<enforcement_body>} einreichen, wenn Sie der Meinung sind, dass unsere Einschätzung einer unverhältnismäßigen Belastung überprüft werden sollte, wenn Sie Mängel in unserer Barrierefreiheitserklärung feststellen oder wenn Sie der Meinung sind, dass wir Ihren Antrag auf barrierefreie Bereitstellung von Inhalten nicht korrekt bearbeitet haben."
24
24
  },
25
25
  {
26
26
  "id": "technical",
27
27
  "title": "Technische Informationen zur Barrierefreiheit der Website",
28
- "content": "{Diese Website ist vollständig mit den Barrierefreiheitsanforderungen vereinbar./Diese Website ist wegen der folgenden Unvereinbarkeiten teilweise mit den Barrierefreiheitsanforderungen vereinbar./Diese Website ist nicht mit den Barrierefreiheitsanforderungen vereinbar.}"
28
+ "content": "{Diese Website ist vollständig mit den Anforderungen gemäß {<national_law>} vereinbar./Diese Website ist wegen der folgenden Unvereinbarkeiten teilweise mit den Anforderungen gemäß {<national_law>} vereinbar./Diese Website ist nicht mit den Anforderungen gemäß {<national_law>} vereinbar.}"
29
29
  },
30
30
  {
31
31
  "id": "testing",
@@ -0,0 +1,39 @@
1
+ {
2
+ "title": "Accessibility of {<website>}",
3
+ "intro": "This website is run by {<organisation>}. We want as many people as possible to be able to use it, and this document describes how {<website>} complies with the Accessible Canada Act and the Accessibility for Ontarians with Disabilities Act, any known accessibility issues, and how you can report problems so that we can fix them.",
4
+ "sections": [
5
+ {
6
+ "id": "how-accessible",
7
+ "title": "How accessible is the website?",
8
+ "content": "{There are no known accessibility issues with this website./We know some parts of this website aren't fully accessible. See the section on non-accessible content below for more information./We know some parts of this website aren't fully accessible. See the section on non-accessible content below for more information.}"
9
+ },
10
+ {
11
+ "id": "what-to-do",
12
+ "title": "What to do if you can't access parts of this website?",
13
+ "content": "If you need content from this website that is not accessible for you, but is not within the scope of the accessibility regulations as described below, please contact us.\n\n[Our normal response time is {<response time>}.]\n\n[You can also contact us in the following ways:\n\n* email {<email address>}\n* call {<telephone number>}]"
14
+ },
15
+ {
16
+ "id": "reporting",
17
+ "title": "Reporting accessibility problems with this website",
18
+ "content": "We're always looking to improve the accessibility of this website. If you find any problems that aren't listed on this page or if we're not meeting the requirements of the accessibility regulations, contact us and let us know about the problem."
19
+ },
20
+ {
21
+ "id": "enforcement",
22
+ "title": "Enforcement procedure",
23
+ "content": "The {<enforcement_body>} is responsible for enforcing the Accessible Canada Act. If you experience accessibility issues on our website, you can submit a complaint to {<enforcement_body>}.\n\nYou can also file a complaint with {<enforcement_body>} if you believe our website does not comply with the Accessible Canada Act or the Accessibility for Ontarians with Disabilities Act, or if your request for accessible content has not been handled appropriately."
24
+ },
25
+ {
26
+ "id": "technical",
27
+ "title": "Technical information about this website's accessibility",
28
+ "content": "{This website is fully compliant with the Accessible Canada Act and the Accessibility for Ontarians with Disabilities Act./This website is partially compliant with the Accessible Canada Act and the Accessibility for Ontarians with Disabilities Act, due to the non-compliances listed below./This website is not compliant with the Accessible Canada Act and the Accessibility for Ontarians with Disabilities Act. The non-accessible sections are listed below.}"
29
+ },
30
+ {
31
+ "content": "The content described below is, in one way or another, not fully accessible.\n\n[\n**Non-compliance with the accessibility regulations**\n\n{<issues>}\n]"
32
+ },
33
+ {
34
+ "id": "testing",
35
+ "title": "How we tested this website",
36
+ "content": "{We have performed a self-assessment (internal testing) of {<website>}./{<third party>} has tested {<website>}./We have estimated the accessibility without testing.}\n\nThe last assessment was made on {<assessment date>}.\n\n[Assessment method: {<method>}]\n\nThe website was published on {<publish date>}.\n\nThe statement was last updated on {<update date>}."
37
+ }
38
+ ]
39
+ }