@claritylabs/cl-sdk 3.0.21 → 3.0.22
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 +20 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9675,6 +9675,25 @@ function pageTitleFromText(text, fallback) {
|
|
|
9675
9675
|
if (firstSentence && firstSentence.length <= 120) return firstSentence.replace(/[.]$/, "");
|
|
9676
9676
|
return fallback;
|
|
9677
9677
|
}
|
|
9678
|
+
function pageHeadingTitleFromText(text, fallback) {
|
|
9679
|
+
const normalized = cleanText(text, "");
|
|
9680
|
+
const headingText = normalized.replace(/^page\s+\d+\s*(?:\|\s*page\s*\|\s*page\s+\d+\s*\|?)?/i, "").slice(0, 700);
|
|
9681
|
+
const patterns = [
|
|
9682
|
+
/\bIMPORTANT NOTICE\s+[—-]\s+HOW TO REPORT A CLAIM\b/i,
|
|
9683
|
+
/\bPRIVACY NOTICE TO POLICYHOLDERS\b/i,
|
|
9684
|
+
/\bOFAC ADVISORY NOTICE\b/i,
|
|
9685
|
+
/\bTERRORISM RISK INSURANCE ACT\s*\(TRIA\)\s*DISCLOSURE AND REJECTION\b/i,
|
|
9686
|
+
/\bDECLARATIONS PAGE\b/i,
|
|
9687
|
+
/\bTECHNOLOGY ERRORS?\s*&\s*OMISSIONS AND CYBER LIABILITY INSURANCE POLICY\b/i,
|
|
9688
|
+
/\bTRADE OR ECONOMIC SANCTIONS LIMITATION\b/i,
|
|
9689
|
+
/\bFORMS? AND ENDORSEMENTS\b/i
|
|
9690
|
+
];
|
|
9691
|
+
for (const pattern of patterns) {
|
|
9692
|
+
const match = headingText.match(pattern)?.[0];
|
|
9693
|
+
if (match) return cleanText(match, fallback);
|
|
9694
|
+
}
|
|
9695
|
+
return fallback;
|
|
9696
|
+
}
|
|
9678
9697
|
function pageFormTypeFromText(text) {
|
|
9679
9698
|
if (/\b(declarations?\s+page|declarations?\s+schedule)\b/i.test(text)) return "declarations";
|
|
9680
9699
|
if (/\b(endorsement\s+(?:no\.?|number|#)|this endorsement changes the policy|[A-Z]{2,}-END\s+\d{2,})\b/i.test(text)) return "endorsement";
|
|
@@ -9938,7 +9957,7 @@ function applySemanticPageGrouping(sourceTree) {
|
|
|
9938
9957
|
if (node.kind === "document" || node.kind === "page_group") return node;
|
|
9939
9958
|
let nextNode = node;
|
|
9940
9959
|
if (node.kind === "page" && /^page\s+\d+$/i.test(node.title)) {
|
|
9941
|
-
const title =
|
|
9960
|
+
const title = pageHeadingTitleFromText([node.textExcerpt, node.description].filter(Boolean).join(" "), node.title);
|
|
9942
9961
|
if (title !== node.title) {
|
|
9943
9962
|
nextNode = {
|
|
9944
9963
|
...node,
|