@wix/web5-core 1.63.40 → 1.63.41
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/cjs/component/componentDefinitions/EntityCollectionSectionDefinition.js +3 -2
- package/dist/cjs/component/componentDefinitions/EntityCollectionSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/parse-utils.js +11 -1
- package/dist/cjs/component/componentDefinitions/parse-utils.js.map +1 -1
- package/dist/esm/component/componentDefinitions/EntityCollectionSectionDefinition.js +3 -2
- package/dist/esm/component/componentDefinitions/EntityCollectionSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/parse-utils.js +11 -1
- package/dist/esm/component/componentDefinitions/parse-utils.js.map +1 -1
- package/dist/types/component/componentDefinitions/EntityCollectionSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/parse-utils.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -94,13 +94,14 @@ class EntityCollectionSectionDefinition {
|
|
|
94
94
|
entityId: 'gid://shopify/Collection/347895267466',
|
|
95
95
|
entityType: 'collection',
|
|
96
96
|
entityUrl: 'web5://entity/collection/gid://shopify/Collection/347895267466',
|
|
97
|
-
|
|
97
|
+
// The model wrote it lowercase; the parse raises the first letter.
|
|
98
|
+
description: 'Storewide assortment spanning the full product range'
|
|
98
99
|
}, {
|
|
99
100
|
entityId: 'gid://shopify/Collection/348001501322',
|
|
100
101
|
entityType: 'collection',
|
|
101
102
|
entityUrl: 'web5://entity/collection/gid://shopify/Collection/348001501322',
|
|
102
103
|
// Inline emphasis survives — descriptions keep their markdown.
|
|
103
|
-
description: '
|
|
104
|
+
description: 'Artistic **Watercolor** candles with bright vessels'
|
|
104
105
|
}]
|
|
105
106
|
}
|
|
106
107
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_parseUtils","require","_diagnosticTypes","COLLECTION_ENTITY_TYPE","EntityCollectionSectionDefinition","constructor","_defineProperty2","default","title","items","entityId","entityType","entityUrl","linkText","markdown","expected","description","parse","parts","context","entityRefs","extractEntityRefs","length","reportDiagnostic","DIAGNOSTIC_TYPES","SECTION_REJECTED","some","e","headingText","entitySectionBodyText","undefined","callout","calloutFromParts","map","imageUrl","markdownImageUrl","exports"],"sources":["../../../../src/component/componentDefinitions/EntityCollectionSectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n entitySectionBodyText,\n extractEntityRefs,\n calloutFromParts,\n} from './parse-utils';\nimport type { Part } from '../../parts/parts';\nimport type {\n EntityCompProps,\n EntityItem,\n EntitySectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition, ParseContext } from '../section-definition';\nimport { DIAGNOSTIC_TYPES } from '../diagnosticTypes';\n\n/**\n * The semantic entity type this definition claims — the `<type>` segment of\n * `web5://entity/<type>/<id>` (see the client `entityConfig.entityTypes` map).\n */\nconst COLLECTION_ENTITY_TYPE = 'collection';\n\n/**\n * Entity section restricted to **collection** entities\n * (`web5://entity/collection/<id>`).\n *\n * Same markdown shapes as {@link EntitySectionDefinition} — an `h2`, optional\n * intro/callout, then entity links either at the top level or as list items —\n * but every entity link must be a collection. That makes it a strictly narrower\n * match, so it MUST be registered **before** `EntitySectionDefinition` (which\n * claims any `link[entityType]`, i.e. product and article sections too). Once\n * `EntitySectionDefinition` matches, the block is consumed and no later\n * definition is consulted.\n *\n * Mixed blocks (a collection next to a product or an article) fall through:\n * the patterns only cover consecutive collection links, and `parse()` returns\n * `null` when a non-collection entity slipped into the matched slice, handing\n * the block to `EntitySectionDefinition`.\n *\n * Props are the shared {@link EntityCompProps} shape, so a client renders it\n * with a dedicated `EntityCollectionSection` component while product/article\n * sections keep using their own components under `EntitySectionDefinition`.\n */\nexport class EntityCollectionSectionDefinition\n implements SectionDefinition<EntitySectionComponent>\n{\n sectionType = 'entityCollection' as const;\n /**\n * One pattern, matching the shape the orchestrator actually emits for a\n * collections block:\n *\n * <!-- section:entities, semantic:items -->\n * ## Curated collections by theme\n * - [](web5://entity/collection/<id>) description\n *\n * The head absorbs the section descriptor and any intro copy or ECHO\n * callout; each list item is a collection link, an optional markdown image,\n * then its description and optional per-item callout. A trailing\n * section-level callout is intentionally left outside the pattern so it\n * falls through to the downstream CalloutSection.\n *\n * Deliberately narrow: anything else (collection links at the top level\n * rather than in a list, a block mixing entity types) falls through to\n * `EntitySectionDefinition`, which is what handled it before this\n * definition existed.\n */\n patterns = [\n 'html_comment* > h2 > (html_comment | t | callout)* > list{item[1-]:link[entityType=\"collection\"] > image? > (t | callout)*}',\n ];\n\n defaults: EntityCompProps = {\n title: 'Collections',\n items: [\n {\n entityId: 'example-1',\n entityType: COLLECTION_ENTITY_TYPE,\n entityUrl: 'web5://entity/collection/example-1',\n linkText: 'Example collection',\n },\n ],\n };\n\n fixtures: SectionFixture<EntityCompProps>[] = [\n {\n markdown:\n '## Shop the collections\\n\\nCurated edits for the season.\\n\\n- [Running](web5://entity/collection/pUx3mVQ1TmyN2mVYQqQ8Jg) Shoes and kit built for the road\\n- [Trail](web5://entity/collection/Rr8kQyO0S1uH2nQ0mQ2AqQ) Grip and protection off-road',\n expected: {\n title: 'Shop the collections',\n description: 'Curated edits for the season.',\n items: [\n {\n entityId: 'pUx3mVQ1TmyN2mVYQqQ8Jg',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/pUx3mVQ1TmyN2mVYQqQ8Jg',\n linkText: 'Running',\n description: 'Shoes and kit built for the road',\n },\n {\n entityId: 'Rr8kQyO0S1uH2nQ0mQ2AqQ',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/Rr8kQyO0S1uH2nQ0mQ2AqQ',\n linkText: 'Trail',\n description: 'Grip and protection off-road',\n },\n ],\n },\n },\n {\n // The shape the orchestrator emits: a section descriptor, empty link\n // text, and a Shopify gid (which is itself a `://` url) as the entity id.\n markdown:\n '<!-- section:entities, semantic:items -->\\n## Curated collections by theme\\n- [](web5://entity/collection/gid://shopify/Collection/347895267466) storewide assortment spanning the full product range\\n- [](web5://entity/collection/gid://shopify/Collection/348001501322) artistic **Watercolor** candles with bright vessels',\n expected: {\n title: 'Curated collections by theme',\n items: [\n {\n entityId: 'gid://shopify/Collection/347895267466',\n entityType: 'collection',\n entityUrl:\n 'web5://entity/collection/gid://shopify/Collection/347895267466',\n description: 'storewide assortment spanning the full product range',\n },\n {\n entityId: 'gid://shopify/Collection/348001501322',\n entityType: 'collection',\n entityUrl:\n 'web5://entity/collection/gid://shopify/Collection/348001501322',\n // Inline emphasis survives — descriptions keep their markdown.\n description: 'artistic **Watercolor** candles with bright vessels',\n },\n ],\n },\n },\n {\n // Single collection — the full-width banner shape.\n markdown:\n '## Winter essentials\\n\\n- [Shop winter](web5://entity/collection/aB1cD2eF3gH4iJ5kL6mN7o) Layers for the cold months',\n expected: {\n title: 'Winter essentials',\n items: [\n {\n entityId: 'aB1cD2eF3gH4iJ5kL6mN7o',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/aB1cD2eF3gH4iJ5kL6mN7o',\n linkText: 'Shop winter',\n description: 'Layers for the cold months',\n },\n ],\n },\n },\n ];\n\n parse(parts: Part[], context?: ParseContext): EntityCompProps | null {\n const entityRefs = extractEntityRefs(parts);\n\n if (entityRefs.length === 0) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'entityCollection: no entity links found',\n );\n return null;\n }\n\n // Guard the pattern: anything that is not a collection means this block\n // belongs to the generic entity section, not here.\n if (entityRefs.some((e) => e.entityType !== COLLECTION_ENTITY_TYPE)) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'entityCollection: block mixes collections with other entity types',\n );\n return null;\n }\n\n const title = headingText(parts, 2) || 'Collections';\n const description = entitySectionBodyText(parts) || undefined;\n\n // Every entity link lives inside the list, so any top-level callout is\n // section-level by construction — per-item callouts are nested in the list\n // items and are picked up by extractEntityRefs instead.\n const callout = calloutFromParts(parts);\n\n const items: EntityItem[] = entityRefs.map((e) => ({\n entityId: e.entityId,\n entityType: e.entityType,\n entityUrl: e.entityUrl,\n linkText: e.linkText || undefined,\n description: e.description || undefined,\n imageUrl: e.markdownImageUrl,\n callout: e.callout,\n }));\n\n return { title, description, callout, items };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAcA,IAAAC,gBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA,MAAME,sBAAsB,GAAG,YAAY;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iCAAiC,CAE9C;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,uBACgB,kBAAkB;IAChC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAlBE,IAAAD,gBAAA,CAAAC,OAAA,oBAmBW,CACT,6HAA6H,CAC9H;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBAE2B;MAC1BC,KAAK,EAAE,aAAa;MACpBC,KAAK,EAAE,CACL;QACEC,QAAQ,EAAE,WAAW;QACrBC,UAAU,EAAER,sBAAsB;QAClCS,SAAS,EAAE,oCAAoC;QAC/CC,QAAQ,EAAE;MACZ,CAAC;IAEL,CAAC;IAAA,IAAAP,gBAAA,CAAAC,OAAA,oBAE6C,CAC5C;MACEO,QAAQ,EACN,oPAAoP;MACtPC,QAAQ,EAAE;QACRP,KAAK,EAAE,sBAAsB;QAC7BQ,WAAW,EAAE,+BAA+B;QAC5CP,KAAK,EAAE,CACL;UACEC,QAAQ,EAAE,wBAAwB;UAClCC,UAAU,EAAE,YAAY;UACxBC,SAAS,EAAE,iDAAiD;UAC5DC,QAAQ,EAAE,SAAS;UACnBG,WAAW,EAAE;QACf,CAAC,EACD;UACEN,QAAQ,EAAE,wBAAwB;UAClCC,UAAU,EAAE,YAAY;UACxB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AACC,gBAAgB,EACjC,mEACF,CAAC;MACD,OAAO,IAAI;IACb;IAEA,MAAMjB,KAAK,GAAG,IAAAoB,uBAAW,EAACV,KAAK,EAAE,CAAC,CAAC,IAAI,aAAa;IACpD,MAAMF,WAAW,GAAG,IAAAa,iCAAqB,EAACX,KAAK,CAAC,IAAIY,SAAS;;IAE7D;IACA;IACA;IACA,MAAMC,OAAO,GAAG,IAAAC,4BAAgB,EAACd,KAAK,CAAC;IAEvC,MAAMT,KAAmB,GAAGW,UAAU,CAACa,GAAG,CAAEN,CAAC,KAAM;MACjDjB,QAAQ,EAAEiB,CAAC,CAACjB,QAAQ;MACpBC,UAAU,EAAEgB,CAAC,CAAChB,UAAU;MACxBC,SAAS,EAAEe,CAAC,CAACf,SAAS;MACtBC,QAAQ,EAAEc,CAAC,CAACd,QAAQ,IAAIiB,SAAS;MACjCd,WAAW,EAAEW,CAAC,CAACX,WAAW,IAAIc,SAAS;MACvCI,QAAQ,EAAEP,CAAC,CAACQ,gBAAgB;MAC5BJ,OAAO,EAAEJ,CAAC,CAACI;IACb,CAAC,CAAC,CAAC;IAEH,OAAO;MAAEvB,KAAK;MAAEQ,WAAW;MAAEe,OAAO;MAAEtB;IAAM,CAAC;EAC/C;AACF;AAAC2B,OAAA,CAAAhC,iCAAA,GAAAA,iCAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_parseUtils","require","_diagnosticTypes","COLLECTION_ENTITY_TYPE","EntityCollectionSectionDefinition","constructor","_defineProperty2","default","title","items","entityId","entityType","entityUrl","linkText","markdown","expected","description","parse","parts","context","entityRefs","extractEntityRefs","length","reportDiagnostic","DIAGNOSTIC_TYPES","SECTION_REJECTED","some","e","headingText","entitySectionBodyText","undefined","callout","calloutFromParts","map","imageUrl","markdownImageUrl","exports"],"sources":["../../../../src/component/componentDefinitions/EntityCollectionSectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n entitySectionBodyText,\n extractEntityRefs,\n calloutFromParts,\n} from './parse-utils';\nimport type { Part } from '../../parts/parts';\nimport type {\n EntityCompProps,\n EntityItem,\n EntitySectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition, ParseContext } from '../section-definition';\nimport { DIAGNOSTIC_TYPES } from '../diagnosticTypes';\n\n/**\n * The semantic entity type this definition claims — the `<type>` segment of\n * `web5://entity/<type>/<id>` (see the client `entityConfig.entityTypes` map).\n */\nconst COLLECTION_ENTITY_TYPE = 'collection';\n\n/**\n * Entity section restricted to **collection** entities\n * (`web5://entity/collection/<id>`).\n *\n * Same markdown shapes as {@link EntitySectionDefinition} — an `h2`, optional\n * intro/callout, then entity links either at the top level or as list items —\n * but every entity link must be a collection. That makes it a strictly narrower\n * match, so it MUST be registered **before** `EntitySectionDefinition` (which\n * claims any `link[entityType]`, i.e. product and article sections too). Once\n * `EntitySectionDefinition` matches, the block is consumed and no later\n * definition is consulted.\n *\n * Mixed blocks (a collection next to a product or an article) fall through:\n * the patterns only cover consecutive collection links, and `parse()` returns\n * `null` when a non-collection entity slipped into the matched slice, handing\n * the block to `EntitySectionDefinition`.\n *\n * Props are the shared {@link EntityCompProps} shape, so a client renders it\n * with a dedicated `EntityCollectionSection` component while product/article\n * sections keep using their own components under `EntitySectionDefinition`.\n */\nexport class EntityCollectionSectionDefinition\n implements SectionDefinition<EntitySectionComponent>\n{\n sectionType = 'entityCollection' as const;\n /**\n * One pattern, matching the shape the orchestrator actually emits for a\n * collections block:\n *\n * <!-- section:entities, semantic:items -->\n * ## Curated collections by theme\n * - [](web5://entity/collection/<id>) description\n *\n * The head absorbs the section descriptor and any intro copy or ECHO\n * callout; each list item is a collection link, an optional markdown image,\n * then its description and optional per-item callout. A trailing\n * section-level callout is intentionally left outside the pattern so it\n * falls through to the downstream CalloutSection.\n *\n * Deliberately narrow: anything else (collection links at the top level\n * rather than in a list, a block mixing entity types) falls through to\n * `EntitySectionDefinition`, which is what handled it before this\n * definition existed.\n */\n patterns = [\n 'html_comment* > h2 > (html_comment | t | callout)* > list{item[1-]:link[entityType=\"collection\"] > image? > (t | callout)*}',\n ];\n\n defaults: EntityCompProps = {\n title: 'Collections',\n items: [\n {\n entityId: 'example-1',\n entityType: COLLECTION_ENTITY_TYPE,\n entityUrl: 'web5://entity/collection/example-1',\n linkText: 'Example collection',\n },\n ],\n };\n\n fixtures: SectionFixture<EntityCompProps>[] = [\n {\n markdown:\n '## Shop the collections\\n\\nCurated edits for the season.\\n\\n- [Running](web5://entity/collection/pUx3mVQ1TmyN2mVYQqQ8Jg) Shoes and kit built for the road\\n- [Trail](web5://entity/collection/Rr8kQyO0S1uH2nQ0mQ2AqQ) Grip and protection off-road',\n expected: {\n title: 'Shop the collections',\n description: 'Curated edits for the season.',\n items: [\n {\n entityId: 'pUx3mVQ1TmyN2mVYQqQ8Jg',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/pUx3mVQ1TmyN2mVYQqQ8Jg',\n linkText: 'Running',\n description: 'Shoes and kit built for the road',\n },\n {\n entityId: 'Rr8kQyO0S1uH2nQ0mQ2AqQ',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/Rr8kQyO0S1uH2nQ0mQ2AqQ',\n linkText: 'Trail',\n description: 'Grip and protection off-road',\n },\n ],\n },\n },\n {\n // The shape the orchestrator emits: a section descriptor, empty link\n // text, and a Shopify gid (which is itself a `://` url) as the entity id.\n markdown:\n '<!-- section:entities, semantic:items -->\\n## Curated collections by theme\\n- [](web5://entity/collection/gid://shopify/Collection/347895267466) storewide assortment spanning the full product range\\n- [](web5://entity/collection/gid://shopify/Collection/348001501322) artistic **Watercolor** candles with bright vessels',\n expected: {\n title: 'Curated collections by theme',\n items: [\n {\n entityId: 'gid://shopify/Collection/347895267466',\n entityType: 'collection',\n entityUrl:\n 'web5://entity/collection/gid://shopify/Collection/347895267466',\n // The model wrote it lowercase; the parse raises the first letter.\n description: 'Storewide assortment spanning the full product range',\n },\n {\n entityId: 'gid://shopify/Collection/348001501322',\n entityType: 'collection',\n entityUrl:\n 'web5://entity/collection/gid://shopify/Collection/348001501322',\n // Inline emphasis survives — descriptions keep their markdown.\n description: 'Artistic **Watercolor** candles with bright vessels',\n },\n ],\n },\n },\n {\n // Single collection — the full-width banner shape.\n markdown:\n '## Winter essentials\\n\\n- [Shop winter](web5://entity/collection/aB1cD2eF3gH4iJ5kL6mN7o) Layers for the cold months',\n expected: {\n title: 'Winter essentials',\n items: [\n {\n entityId: 'aB1cD2eF3gH4iJ5kL6mN7o',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/aB1cD2eF3gH4iJ5kL6mN7o',\n linkText: 'Shop winter',\n description: 'Layers for the cold months',\n },\n ],\n },\n },\n ];\n\n parse(parts: Part[], context?: ParseContext): EntityCompProps | null {\n const entityRefs = extractEntityRefs(parts);\n\n if (entityRefs.length === 0) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'entityCollection: no entity links found',\n );\n return null;\n }\n\n // Guard the pattern: anything that is not a collection means this block\n // belongs to the generic entity section, not here.\n if (entityRefs.some((e) => e.entityType !== COLLECTION_ENTITY_TYPE)) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'entityCollection: block mixes collections with other entity types',\n );\n return null;\n }\n\n const title = headingText(parts, 2) || 'Collections';\n const description = entitySectionBodyText(parts) || undefined;\n\n // Every entity link lives inside the list, so any top-level callout is\n // section-level by construction — per-item callouts are nested in the list\n // items and are picked up by extractEntityRefs instead.\n const callout = calloutFromParts(parts);\n\n const items: EntityItem[] = entityRefs.map((e) => ({\n entityId: e.entityId,\n entityType: e.entityType,\n entityUrl: e.entityUrl,\n linkText: e.linkText || undefined,\n description: e.description || undefined,\n imageUrl: e.markdownImageUrl,\n callout: e.callout,\n }));\n\n return { title, description, callout, items };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAcA,IAAAC,gBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA,MAAME,sBAAsB,GAAG,YA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AAK,CAAC;IAEvC,MAAMT,KAAmB,GAAGW,UAAU,CAACa,GAAG,CAAEN,CAAC,KAAM;MACjDjB,QAAQ,EAAEiB,CAAC,CAACjB,QAAQ;MACpBC,UAAU,EAAEgB,CAAC,CAAChB,UAAU;MACxBC,SAAS,EAAEe,CAAC,CAACf,SAAS;MACtBC,QAAQ,EAAEc,CAAC,CAACd,QAAQ,IAAIiB,SAAS;MACjCd,WAAW,EAAEW,CAAC,CAACX,WAAW,IAAIc,SAAS;MACvCI,QAAQ,EAAEP,CAAC,CAACQ,gBAAgB;MAC5BJ,OAAO,EAAEJ,CAAC,CAACI;IACb,CAAC,CAAC,CAAC;IAEH,OAAO;MAAEvB,KAAK;MAAEQ,WAAW;MAAEe,OAAO;MAAEtB;IAAM,CAAC;EAC/C;AACF;AAAC2B,OAAA,CAAAhC,iCAAA,GAAAA,iCAAA","ignoreList":[]}
|
|
@@ -35,8 +35,18 @@ function markdownOrText(p) {
|
|
|
35
35
|
var _p$meta;
|
|
36
36
|
return (((_p$meta = p.meta) == null || (_p$meta = _p$meta.markdown) == null ? void 0 : _p$meta.trim()) || str(p)).trim();
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The model does not reliably open an entity blurb with a capital, and a card
|
|
41
|
+
* leads with that line. Leading markdown and punctuation (`**`, `_`, `[`,
|
|
42
|
+
* quotes) are skipped so the first real letter is raised; a mixed-case first
|
|
43
|
+
* word (`iPhone`, `eBay`) is left alone, since raising it misspells a name.
|
|
44
|
+
*/
|
|
45
|
+
function capitalizeFirstLetter(text) {
|
|
46
|
+
return text.replace(/^([^\p{L}\p{N}]*)(\p{Ll})(\p{L}*)/u, (match, lead, first, rest) => /\p{Lu}/u.test(rest) ? match : `${lead}${first.toUpperCase()}${rest}`);
|
|
47
|
+
}
|
|
38
48
|
function normalizeEntityDescription(description) {
|
|
39
|
-
return description.replace(/^[\s\u2013\u2014-]+/, '').replace(/^[:\s]+/, '').trim();
|
|
49
|
+
return capitalizeFirstLetter(description.replace(/^[\s\u2013\u2014-]+/, '').replace(/^[:\s]+/, '').trim());
|
|
40
50
|
}
|
|
41
51
|
|
|
42
52
|
/** Strip basic markdown formatting to get plain text */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_parts","require","_entityLinkParser","_linkTypes","str","p","_p$content","content","trim","markdownOrText","_p$meta","meta","markdown","normalizeEntityDescription","description","replace","stripMarkdown","md","headingText","parts","level","heading","getHeading","headingMarkdown","_meta$markdown","bodyText","textParts","getPartsByType","richTextParts","map","filter","Boolean","join","inlineParagraphs","paragraphs","part","_part$meta","type","continuesNode","length","push","isLinkRow","paragraph","some","every","standaloneLinks","flat","paragraphsToMarkdown","inlinePartsToMarkdown","bodyMarkdown","proseBodyMarkdown","firstEntityLinkIndex","findIndex","_meta","isEntityHref","href","sectionParts","slice","entitySectionBodyText","_meta2","linksToHeroButtons","links","lists","flatMap","l","_l$meta","items","item","_item$meta","i","_l$content","id","text","variant","onClick","firstImageSrc","_img$meta","images","getImages","img","src","undefined","firstLink","_link$content","getLinks","link","blockquoteText","bqs","_p$meta2","calloutFromParts","_p$meta3","calloutParts","raw","parsed","parseCalloutTag","kind","listToMarkdown","lines","list","_list$meta","extractListItemText","parseEntityUrl","url","trimmedUrl","isWeb5EntityUrl","parseWeb5Url","Web5UrlType","ENTITY","entityType","entityId","parseTableValue","value","normalized","toLowerCase","parseKpiItem","trimmed","boldMatch","match","title","afterBold","indexOf","appendInlineToken","current","token","test","reduce","_part$meta2","_meta3","_part$content","label","_item$meta2","partsToMarkdown","inline","_part$meta3","_part$meta4","repeat","_list$meta2","_item$meta3","toUpperCase","generatePartId","Math","random","toString","extractNestedListItems","itemParts","nestedLists","features","nested","_list$meta3","extractEntityRefs","entities","_list$meta4","_item$meta4","entityLinks","_meta4","_link$content2","_images$","_p$content2","callout","_calloutParts$0$meta","parsed2","linkText","entityUrl","markdownImageUrl","markdownFeatures","topLinks","_l$meta2","e","_link$content3","linkIndex","j","_meta5","_p$content3","_meta6","_p$meta4","parsedCallout","_meta7"],"sources":["../../../../src/component/componentDefinitions/parse-utils.ts"],"sourcesContent":["import type {\n Part,\n ListPart,\n LinkPart,\n ListItemPart,\n ImagePart,\n} from '../../parts/parts';\nimport {\n getPartsByType,\n getHeading,\n getImages,\n getLinks,\n} from '../../parts/parts';\nimport { parseWeb5Url } from '../../utils/entityLinkParser';\nimport { Web5UrlType, isWeb5EntityUrl } from '../../types/link-types';\nimport type { Callout } from '../../types/callout';\nimport type { HeroButton } from '../types';\n\nfunction str(p: Part | undefined): string {\n return p?.content?.trim() ?? '';\n}\n\nfunction markdownOrText(p: Part): string {\n return ((p.meta?.markdown as string)?.trim() || str(p)).trim();\n}\n\nfunction normalizeEntityDescription(description: string): string {\n return description\n .replace(/^[\\s\\u2013\\u2014-]+/, '')\n .replace(/^[:\\s]+/, '')\n .trim();\n}\n\n/** Strip basic markdown formatting to get plain text */\nexport function stripMarkdown(md: string): string {\n return md\n .replace(/\\*\\*(.+?)\\*\\*/g, '$1')\n .replace(/__(.+?)__/g, '$1')\n .replace(/\\*(.+?)\\*/g, '$1')\n .replace(/_(.+?)_/g, '$1')\n .replace(/~~(.+?)~~/g, '$1')\n .replace(/`(.+?)`/g, '$1')\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1')\n .trim();\n}\n\nexport function headingText(parts: Part[], level?: number): string {\n const heading = getHeading(parts, level);\n return str(heading);\n}\n\n/** Like headingText but preserves inline markdown formatting (bold, italic, etc.) */\nexport function headingMarkdown(parts: Part[], level?: number): string {\n const heading = getHeading(parts, level);\n if (!heading) {\n return '';\n }\n const meta = heading.meta as Record<string, unknown>;\n return (meta?.markdown as string)?.trim() || str(heading);\n}\n\nexport function bodyText(parts: Part[]): string {\n const textParts = getPartsByType<Part>(parts, 'text');\n const richTextParts = getPartsByType<Part>(parts, 'richText');\n return [...textParts, ...richTextParts]\n .map(markdownOrText)\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Group a run of inline parts back into paragraphs.\n *\n * `astToParts` marks every part after the first of a given AST node with\n * `meta.continuesNode`, which is exactly \"same paragraph, keep going\". Parts\n * without it open a new paragraph.\n */\nfunction inlineParagraphs(parts: Part[]): Part[][] {\n const paragraphs: Part[][] = [];\n\n for (const part of parts) {\n if (\n part.type !== 'text' &&\n part.type !== 'richText' &&\n part.type !== 'link'\n ) {\n continue;\n }\n if (part.meta?.continuesNode && paragraphs.length > 0) {\n paragraphs[paragraphs.length - 1].push(part);\n } else {\n paragraphs.push([part]);\n }\n }\n\n return paragraphs;\n}\n\n/**\n * A paragraph that is nothing but links — the hero's button row under the h1,\n * the CTA after a comparison table. This is the one shape a section is entitled\n * to spend on a control instead of printing as copy, and its complement — a\n * link sharing its paragraph with a sentence — is body copy and nothing else.\n *\n * A blank part does not disqualify it. A hard line break between two links\n * (`[A](/a)··\\n[B](/b)`) leaves an empty `t` part behind, and an empty part is\n * not a sentence; without this the row is BOTH a button and a line of body\n * copy, which is the duplication the rule exists to prevent.\n */\nfunction isLinkRow(paragraph: Part[]): boolean {\n return (\n paragraph.some((part) => part.type === 'link') &&\n paragraph.every(\n (part) => part.type === 'link' || markdownOrText(part) === '',\n )\n );\n}\n\n/**\n * The links a section is entitled to render as its own control — a hero button\n * row, a CTA — as opposed to a link that is part of a sentence.\n *\n * The exact complement of what {@link proseBodyMarkdown} keeps, and that is the\n * point: between the two, every top-level link reaches the page exactly once.\n * `getLinks` is the wrong tool for a control slot — it takes EVERY top-level\n * link part, and a link inside a prose paragraph is a top-level part, so\n * `Email support@shop.example` (GFM autolinks a bare address, no author needed)\n * arrived as the hero's first and therefore PRIMARY button, displacing the real\n * call to action into the secondary slot and printing the address twice.\n */\nexport function standaloneLinks(parts: Part[]): LinkPart[] {\n return inlineParagraphs(parts)\n .filter(isLinkRow)\n .flat()\n .filter((part): part is LinkPart => part.type === 'link');\n}\n\nfunction paragraphsToMarkdown(paragraphs: Part[][]): string {\n return paragraphs\n .map(inlinePartsToMarkdown)\n .map((paragraph) => paragraph.trim())\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Body copy as markdown, with inline links intact and paragraph breaks kept.\n *\n * `bodyText` reads text parts only, so a paragraph carrying an inline link —\n * `Try narrowing to [men](web5://ask/…) instead` — arrives as `t + link + t`\n * and comes back as `\"Try narrowing to\\n\\ninstead\"`: label and url both\n * deleted, and the sentence broken in two at the gap. That is DL #134's list\n * bug in a different helper, and it is why an ask link in prose never reached\n * the page. A bare `support@shop.example` is the same bug with no author in\n * sight: GFM autolinks an email into a `link` node, so plain prose loses the\n * address.\n *\n * `inlinePartsToMarkdown` already rebuilds a run of inline parts with links\n * intact, but it flattens to one line, which is wrong for multi-paragraph\n * copy — hence `inlineParagraphs` first.\n *\n * This keeps EVERY link, including one standing alone as its own block. That\n * is right for `textBlock`, whose section consumes nothing but the copy. It is\n * wrong for a section that already spends its links elsewhere — see\n * {@link proseBodyMarkdown}.\n *\n * Kept separate from `bodyText` deliberately. Of the three callers still on\n * `bodyText`: `ErrorSectionDefinition` and `CtaBannerSectionDefinition` do\n * hand their result to a consumer that renders it raw (`ErrorSection` prints\n * the copy in a `<p>`, `CtaBannerSection` the same), so markdown there would\n * show a visitor a literal `[label](url)`. `FeatureSection9PlusDefinition` is\n * the odd one out: it has no registered renderer in either client bundle\n * (`createSdkRegistry` registers the definition with no component, and only\n * `createTestRegistry` gives it a stub), so its `description` reaches nothing\n * and there is no consumer to decide against. `FeatureCardsSectionDefinition`\n * used to be listed here as affected-but-unfixed; it now uses\n * {@link proseBodyMarkdown}.\n */\nexport function bodyMarkdown(parts: Part[]): string {\n return paragraphsToMarkdown(inlineParagraphs(parts));\n}\n\n/**\n * Body copy as markdown for a section that spends some of its links on another\n * slot — hero buttons, a comparison CTA, entity items.\n *\n * Same fix as {@link bodyMarkdown} for the case that matters — a link INSIDE a\n * sentence survives instead of being deleted with its label — but it drops the\n * two shapes those sections have already claimed, so nothing renders twice:\n *\n * - A paragraph that is nothing but links — {@link isLinkRow}.\n * `[Get started](/) [Learn more](/x)` under a hero h1 is the button row\n * `HeroSectionDefinition` turns into `buttons`; the trailing link after a\n * comparison table is its `ctaText` / `ctaHref`. Whole-paragraph is the right\n * test because a link that is part of a sentence always shares its paragraph\n * with the text around it. `HeroSectionDefinition` reads the same predicate\n * from the other side via {@link standaloneLinks}, so the two partition the\n * links rather than each deciding for itself.\n * - Everything from the first `web5://entity/…` link onward, which is item\n * copy rather than section copy — `HeroEntitySectionDefinition` reads those\n * links (and the text after each) into `items`. Same cut\n * {@link entitySectionBodyText} makes, for the same reason.\n *\n * Nothing is lost by either rule: the dropped links are exactly the ones the\n * section renders through some other prop.\n */\nexport function proseBodyMarkdown(parts: Part[]): string {\n const firstEntityLinkIndex = parts.findIndex(\n (p) => p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n const sectionParts =\n firstEntityLinkIndex >= 0 ? parts.slice(0, firstEntityLinkIndex) : parts;\n\n return paragraphsToMarkdown(\n inlineParagraphs(sectionParts).filter((paragraph) => !isLinkRow(paragraph)),\n );\n}\n\n/**\n * Entity sections may be authored as one paragraph per entity:\n * `[Product](web5://entity/...) - why it matches`.\n * In that shape, text after the first entity link is item copy rather than\n * section copy, so only keep prose that appears before the first entity link.\n */\nexport function entitySectionBodyText(parts: Part[]): string {\n const firstEntityLinkIndex = parts.findIndex(\n (p) => p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n const sectionParts =\n firstEntityLinkIndex >= 0 ? parts.slice(0, firstEntityLinkIndex) : parts;\n\n return sectionParts\n .filter((p) => p.type === 'text' || p.type === 'richText')\n .map(markdownOrText)\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Build HeroButton[] from link parts — aligned to HeroSection1Button shape.\n *\n * `standaloneLinks`, not `getLinks`, for the reason spelled out there: a link\n * in a sentence is body copy, not a button. Currently uncalled — kept on the\n * same rule as `HeroSectionDefinition` so wiring it up cannot reintroduce the\n * bug.\n */\nexport function linksToHeroButtons(parts: Part[]): HeroButton[] {\n let links: LinkPart[] = standaloneLinks(parts);\n if (!links.length) {\n const lists = getPartsByType<ListPart>(parts, 'list');\n links = lists.flatMap((l) =>\n (l.meta?.items ?? []).flatMap((item) =>\n ((item.meta?.parts ?? []) as Part[]).filter(\n (p): p is LinkPart => p.type === 'link',\n ),\n ),\n );\n }\n return links.map(\n (l, i): HeroButton => ({\n id: `btn-${i}`,\n text: l.content?.trim() || 'Learn more',\n variant: i === 0 ? 'primary' : 'secondary',\n onClick: l.meta.href,\n }),\n );\n}\n\n/** Return just the src URL string of the first image part */\nexport function firstImageSrc(parts: Part[]): string | undefined {\n const images = getImages(parts);\n const img = images[0];\n return img?.meta?.src || undefined;\n}\n\n/** Return the first link as { text, href } */\nexport function firstLink(\n parts: Part[],\n): { text: string; href: string } | undefined {\n const links = getLinks(parts);\n const link = links[0];\n if (!link) {\n return undefined;\n }\n return { text: link.content?.trim() || '', href: link.meta.href };\n}\n\n/** Extract text content from blockquote parts, preserving markdown formatting when available */\nexport function blockquoteText(parts: Part[]): string | undefined {\n const bqs = getPartsByType<Part>(parts, 'blockquote');\n if (bqs.length === 0) {\n return undefined;\n }\n const text = bqs\n .map((p) => (p.meta?.markdown as string)?.trim() || str(p))\n .filter(Boolean)\n .join('\\n');\n return text || undefined;\n}\n\n/** Extract first callout from parts as a Callout object */\nexport function calloutFromParts(parts: Part[]): Callout | undefined {\n const calloutParts = getPartsByType<Part>(parts, 'callout');\n if (calloutParts.length === 0) {\n return undefined;\n }\n const p = calloutParts[0];\n const raw = (p.meta?.markdown as string)?.trim() || str(p);\n const parsed = parseCalloutTag(raw);\n return parsed.text ? { text: parsed.text, kind: parsed.kind } : undefined;\n}\n\n/** Convert list parts to a markdown-like string */\nexport function listToMarkdown(parts: Part[]): string | undefined {\n const lists = getPartsByType<ListPart>(parts, 'list');\n if (lists.length === 0) {\n return undefined;\n }\n const lines: string[] = [];\n for (const list of lists) {\n const items = list.meta?.items ?? [];\n for (const item of items) {\n const text = extractListItemText(item);\n if (text) {\n lines.push(`- ${text}`);\n }\n }\n }\n return lines.length > 0 ? lines.join('\\n') : undefined;\n}\n\n/**\n * Parse a web5://entity/ URL into entityType and entityId.\n * Delegates to the central `parseWeb5Url` parser.\n */\nexport function parseEntityUrl(\n url: string,\n): { entityType: string; entityId: string } | null {\n const trimmedUrl = url?.trim();\n if (!trimmedUrl || !isWeb5EntityUrl(trimmedUrl)) {\n return null;\n }\n const parsed = parseWeb5Url(trimmedUrl);\n if (\n parsed?.type !== Web5UrlType.ENTITY ||\n !parsed.entityType ||\n !parsed.entityId\n ) {\n return null;\n }\n return { entityType: parsed.entityType, entityId: parsed.entityId };\n}\n\n/**\n * Parse a table cell value into boolean or string.\n * Ported from web50-server-ui comparisonSectionParser.tsx.\n */\nexport function parseTableValue(value: string): boolean | string {\n const normalized = value.trim().toLowerCase();\n\n if (\n normalized === 'true' ||\n normalized === 'yes' ||\n normalized === '✓' ||\n normalized === 'check' ||\n normalized === 'y'\n ) {\n return true;\n }\n if (\n normalized === 'false' ||\n normalized === 'no' ||\n normalized === '✗' ||\n normalized === 'x' ||\n normalized === 'n' ||\n normalized === ''\n ) {\n return false;\n }\n\n return value.trim();\n}\n\n/**\n * Parse a KPI item from markdown text.\n * The first **bold** segment becomes the title; everything after it (leading \":\" stripped) is the description.\n */\nexport function parseKpiItem(\n markdown: string,\n): { title: string; description: string } | null {\n const trimmed = markdown.trim();\n if (!trimmed) {\n return null;\n }\n const boldMatch = trimmed.match(/\\*\\*(.+?)\\*\\*/);\n if (!boldMatch) {\n return null;\n }\n const title = boldMatch[1].trim();\n const afterBold = trimmed.slice(\n trimmed.indexOf(boldMatch[0]) + boldMatch[0].length,\n );\n const description = afterBold.replace(/^[:\\s]+/, '').trim();\n return { title, description };\n}\n\n/** Join inline tokens the way prose reads: single spaces, none before punctuation. */\nfunction appendInlineToken(current: string, token: string): string {\n const trimmed = token.trim();\n if (!trimmed) {\n return current;\n }\n if (!current) {\n return trimmed;\n }\n if (/^[,.;:!?)]/.test(trimmed)) {\n return `${current}${trimmed}`;\n }\n return `${current} ${trimmed}`;\n}\n\n/**\n * Serialize a run of inline parts back to markdown, preserving links and\n * inline emphasis.\n *\n * Concatenating `part.content` alone silently deletes links: a `link` part\n * keeps its label in `content` and its url in `meta.href`, so a filter that\n * reads only text parts turns `Read the [pricing page](/pricing) first` into\n * `Read the first` — url and label both vanish, with nothing in the output to\n * show anything was lost.\n *\n * `content` is also the *plain* text of a text part — `nodesToParts` strips\n * inline formatting and keeps the original in `meta.markdown` whenever the two\n * differ. Reading `content` therefore drops emphasis the same way it used to\n * drop links: `The **4 oz size** is best` becomes `The 4 oz size is best`.\n * Prefer `meta.markdown`, which is exactly the segment's own markdown.\n */\nexport function inlinePartsToMarkdown(parts: Part[]): string {\n return parts.reduce((text, part) => {\n if (part.type === 'link') {\n const href = (part as LinkPart).meta?.href ?? '';\n const label = part.content?.trim() ?? '';\n return appendInlineToken(text, href ? `[${label}](${href})` : label);\n }\n return appendInlineToken(\n text,\n (part.meta?.markdown as string | undefined) ?? part.content ?? '',\n );\n }, '');\n}\n\nexport function extractListItemText(item: ListItemPart): string {\n if (item.content) {\n return item.content;\n }\n if (item.meta?.parts) {\n return (item.meta.parts as Part[])\n .map((p) => p.content)\n .filter(Boolean)\n .join(' ');\n }\n return '';\n}\n\n/**\n * Reconstruct markdown-like content from parts.\n *\n * `part.content` is the *plain* text — `nodesToParts` strips inline\n * formatting and preserves the original markdown (bold, italic, links) in\n * `part.meta.markdown` when they differ. Prefer it so markdown-rendering\n * consumers (e.g. the fallback section's ReactMarkdown) keep `**bold**`.\n */\nexport function partsToMarkdown(sectionParts: Part[]): string {\n const inline = (part: Part): string =>\n (part.meta?.markdown as string | undefined) ?? part.content;\n const lines: string[] = [];\n for (const part of sectionParts) {\n if (part.type === 'heading') {\n const level = (part.meta as { level: number })?.level ?? 2;\n lines.push(`${'#'.repeat(level)} ${inline(part)}`);\n } else if (part.type === 'text' || part.type === 'richText') {\n lines.push(inline(part));\n } else if (part.type === 'list') {\n const list = part as ListPart;\n for (const item of list.meta?.items ?? []) {\n lines.push(\n `- ${(item.meta?.markdown as string | undefined) ?? extractListItemText(item)}`,\n );\n }\n } else if (part.type === 'blockquote' || part.type === 'callout') {\n lines.push(`> ${inline(part)}`);\n }\n }\n return lines.join('\\n\\n');\n}\n\n/**\n * Extract callout kind tag from blockquote text.\n * Handles [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] GFM syntax.\n */\nexport function parseCalloutTag(text: string): { text: string; kind?: string } {\n const match = text.match(/^\\[!(\\w+)\\]\\s*(.*)/s);\n if (match) {\n return { kind: match[1].toUpperCase(), text: match[2].trim() };\n }\n return { text: text.trim() };\n}\n\n/** Generate a simple unique ID */\nexport function generatePartId(): string {\n return Math.random().toString(36).slice(2, 10);\n}\n\nfunction isEntityHref(href: string | undefined): boolean {\n return !!href && isWeb5EntityUrl(href);\n}\n\nexport interface EntityRef {\n entityId: string;\n entityType: string;\n linkText: string;\n entityUrl: string;\n description: string;\n markdownImageUrl?: string;\n markdownFeatures?: string[];\n callout?: Callout;\n}\n\n/**\n * Extract text from nested list items within a list item's parts.\n */\nfunction extractNestedListItems(itemParts: Part[]): string[] {\n const nestedLists = itemParts.filter((p): p is ListPart => p.type === 'list');\n const features: string[] = [];\n for (const list of nestedLists) {\n for (const nested of list.meta?.items ?? []) {\n const text = extractListItemText(nested);\n if (text) {\n features.push(text);\n }\n }\n }\n return features;\n}\n\n/**\n * Extract entity references from list items containing web5://entity/ links.\n * Also extracts markdownFeatures from nested list items within each entity item.\n */\nexport function extractEntityRefs(parts: Part[]): EntityRef[] {\n const entities: EntityRef[] = [];\n const lists = getPartsByType<ListPart>(parts, 'list');\n\n for (const list of lists) {\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const entityLinks = itemParts.filter(\n (p): p is LinkPart =>\n p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n\n for (const link of entityLinks) {\n const parsed = parseEntityUrl(link.meta.href);\n if (parsed) {\n const images = itemParts.filter(\n (p): p is ImagePart => p.type === 'image',\n );\n const textParts = itemParts.filter(\n (p) => p.type === 'text' && p.content?.trim(),\n );\n const description = normalizeEntityDescription(\n textParts.map(markdownOrText).join(' '),\n );\n const features = extractNestedListItems(itemParts);\n const calloutParts = itemParts.filter(\n (p) => p.type === 'callout' || p.type === 'blockquote',\n );\n let callout: Callout | undefined;\n if (calloutParts.length > 0) {\n const raw =\n (calloutParts[0].meta?.markdown as string)?.trim() ||\n str(calloutParts[0]);\n const parsed2 = parseCalloutTag(raw);\n if (parsed2.text) {\n callout = { text: parsed2.text, kind: parsed2.kind };\n }\n }\n entities.push({\n entityId: parsed.entityId,\n entityType: parsed.entityType,\n linkText: link.content?.trim() || '',\n entityUrl: link.meta.href,\n description,\n markdownImageUrl: images[0]?.meta?.src,\n markdownFeatures: features.length > 0 ? features : undefined,\n callout,\n });\n }\n }\n }\n }\n\n // Also check top-level links (with surrounding context for description/image/list)\n const topLinks = getLinks(parts).filter((l) => isEntityHref(l.meta?.href));\n for (const link of topLinks) {\n const parsed = parseEntityUrl(link.meta.href);\n if (parsed && !entities.some((e) => e.entityId === parsed.entityId)) {\n // Look for description text and image after this link in the parts array\n const linkIndex = parts.indexOf(link);\n let description = '';\n let markdownImageUrl: string | undefined;\n let callout: Callout | undefined;\n const features: string[] = [];\n\n if (linkIndex >= 0) {\n // Scan following parts for description, image, callout, and list items\n for (let j = linkIndex + 1; j < parts.length; j++) {\n const p = parts[j];\n // Stop at next entity link\n if (p.type === 'link' && isEntityHref((p as LinkPart).meta?.href)) {\n break;\n }\n if (p.type === 'text' && p.content?.trim()) {\n const text = markdownOrText(p);\n description = description\n ? `${description} ${text}`\n : text;\n } else if (p.type === 'image' && !markdownImageUrl) {\n markdownImageUrl = (p as ImagePart).meta?.src;\n } else if (\n (p.type === 'callout' || p.type === 'blockquote') &&\n !callout\n ) {\n const raw = (p.meta?.markdown as string)?.trim() || str(p);\n const parsedCallout = parseCalloutTag(raw);\n if (parsedCallout.text) {\n callout = { text: parsedCallout.text, kind: parsedCallout.kind };\n }\n } else if (p.type === 'list') {\n for (const item of (p as ListPart).meta?.items ?? []) {\n const text = extractListItemText(item);\n if (text) {\n features.push(text);\n }\n }\n }\n }\n }\n\n entities.push({\n entityId: parsed.entityId,\n entityType: parsed.entityType,\n linkText: link.content?.trim() || '',\n entityUrl: link.meta.href,\n description: normalizeEntityDescription(description),\n markdownImageUrl,\n markdownFeatures: features.length > 0 ? features : undefined,\n callout,\n });\n }\n }\n\n return entities;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAIA,SAASG,GAAGA,CAACC,CAAmB,EAAU;EAAA,IAAAC,UAAA;EACxC,OAAO,CAAAD,CAAC,aAAAC,UAAA,GAADD,CAAC,CAAEE,OAAO,qBAAVD,UAAA,CAAYE,IAAI,CAAC,CAAC,KAAI,EAAE;AACjC;AAEA,SAASC,cAAcA,CAACJ,CAAO,EAAU;EAAA,IAAAK,OAAA;EACvC,OAAO,CAAC,EAAAA,OAAA,GAACL,CAAC,CAACM,IAAI,cAAAD,OAAA,GAANA,OAAA,CAAQE,QAAQ,qBAAjBF,OAAA,CAA8BF,IAAI,CAAC,CAAC,KAAIJ,GAAG,CAACC,CAAC,CAAC,EAAEG,IAAI,CAAC,CAAC;AAChE;AAEA,SAASK,0BAA0BA,CAACC,WAAmB,EAAU;EAC/D,OAAOA,WAAW,CACfC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAClCA,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CACtBP,IAAI,CAAC,CAAC;AACX;;AAEA;AACO,SAASQ,aAAaA,CAACC,EAAU,EAAU;EAChD,OAAOA,EAAE,CACNF,OAAO,CAAC,gBAAgB,EAAE,I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AAC;QACpDqJ,gBAAgB;QAChBC,gBAAgB,EAAElB,QAAQ,CAAC3G,MAAM,GAAG,CAAC,GAAG2G,QAAQ,GAAGjE,SAAS;QAC5D6E;MACF,CAAC,CAAC;IACJ;EACF;EAEA,OAAOR,QAAQ;AACjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_parts","require","_entityLinkParser","_linkTypes","str","p","_p$content","content","trim","markdownOrText","_p$meta","meta","markdown","capitalizeFirstLetter","text","replace","match","lead","first","rest","test","toUpperCase","normalizeEntityDescription","description","stripMarkdown","md","headingText","parts","level","heading","getHeading","headingMarkdown","_meta$markdown","bodyText","textParts","getPartsByType","richTextParts","map","filter","Boolean","join","inlineParagraphs","paragraphs","part","_part$meta","type","continuesNode","length","push","isLinkRow","paragraph","some","every","standaloneLinks","flat","paragraphsToMarkdown","inlinePartsToMarkdown","bodyMarkdown","proseBodyMarkdown","firstEntityLinkIndex","findIndex","_meta","isEntityHref","href","sectionParts","slice","entitySectionBodyText","_meta2","linksToHeroButtons","links","lists","flatMap","l","_l$meta","items","item","_item$meta","i","_l$content","id","variant","onClick","firstImageSrc","_img$meta","images","getImages","img","src","undefined","firstLink","_link$content","getLinks","link","blockquoteText","bqs","_p$meta2","calloutFromParts","_p$meta3","calloutParts","raw","parsed","parseCalloutTag","kind","listToMarkdown","lines","list","_list$meta","extractListItemText","parseEntityUrl","url","trimmedUrl","isWeb5EntityUrl","parseWeb5Url","Web5UrlType","ENTITY","entityType","entityId","parseTableValue","value","normalized","toLowerCase","parseKpiItem","trimmed","boldMatch","title","afterBold","indexOf","appendInlineToken","current","token","reduce","_part$meta2","_meta3","_part$content","label","_item$meta2","partsToMarkdown","inline","_part$meta3","_part$meta4","repeat","_list$meta2","_item$meta3","generatePartId","Math","random","toString","extractNestedListItems","itemParts","nestedLists","features","nested","_list$meta3","extractEntityRefs","entities","_list$meta4","_item$meta4","entityLinks","_meta4","_link$content2","_images$","_p$content2","callout","_calloutParts$0$meta","parsed2","linkText","entityUrl","markdownImageUrl","markdownFeatures","topLinks","_l$meta2","e","_link$content3","linkIndex","j","_meta5","_p$content3","_meta6","_p$meta4","parsedCallout","_meta7"],"sources":["../../../../src/component/componentDefinitions/parse-utils.ts"],"sourcesContent":["import type {\n Part,\n ListPart,\n LinkPart,\n ListItemPart,\n ImagePart,\n} from '../../parts/parts';\nimport {\n getPartsByType,\n getHeading,\n getImages,\n getLinks,\n} from '../../parts/parts';\nimport { parseWeb5Url } from '../../utils/entityLinkParser';\nimport { Web5UrlType, isWeb5EntityUrl } from '../../types/link-types';\nimport type { Callout } from '../../types/callout';\nimport type { HeroButton } from '../types';\n\nfunction str(p: Part | undefined): string {\n return p?.content?.trim() ?? '';\n}\n\nfunction markdownOrText(p: Part): string {\n return ((p.meta?.markdown as string)?.trim() || str(p)).trim();\n}\n\n/**\n * The model does not reliably open an entity blurb with a capital, and a card\n * leads with that line. Leading markdown and punctuation (`**`, `_`, `[`,\n * quotes) are skipped so the first real letter is raised; a mixed-case first\n * word (`iPhone`, `eBay`) is left alone, since raising it misspells a name.\n */\nfunction capitalizeFirstLetter(text: string): string {\n return text.replace(\n /^([^\\p{L}\\p{N}]*)(\\p{Ll})(\\p{L}*)/u,\n (match, lead: string, first: string, rest: string) =>\n /\\p{Lu}/u.test(rest) ? match : `${lead}${first.toUpperCase()}${rest}`,\n );\n}\n\nfunction normalizeEntityDescription(description: string): string {\n return capitalizeFirstLetter(\n description\n .replace(/^[\\s\\u2013\\u2014-]+/, '')\n .replace(/^[:\\s]+/, '')\n .trim(),\n );\n}\n\n/** Strip basic markdown formatting to get plain text */\nexport function stripMarkdown(md: string): string {\n return md\n .replace(/\\*\\*(.+?)\\*\\*/g, '$1')\n .replace(/__(.+?)__/g, '$1')\n .replace(/\\*(.+?)\\*/g, '$1')\n .replace(/_(.+?)_/g, '$1')\n .replace(/~~(.+?)~~/g, '$1')\n .replace(/`(.+?)`/g, '$1')\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1')\n .trim();\n}\n\nexport function headingText(parts: Part[], level?: number): string {\n const heading = getHeading(parts, level);\n return str(heading);\n}\n\n/** Like headingText but preserves inline markdown formatting (bold, italic, etc.) */\nexport function headingMarkdown(parts: Part[], level?: number): string {\n const heading = getHeading(parts, level);\n if (!heading) {\n return '';\n }\n const meta = heading.meta as Record<string, unknown>;\n return (meta?.markdown as string)?.trim() || str(heading);\n}\n\nexport function bodyText(parts: Part[]): string {\n const textParts = getPartsByType<Part>(parts, 'text');\n const richTextParts = getPartsByType<Part>(parts, 'richText');\n return [...textParts, ...richTextParts]\n .map(markdownOrText)\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Group a run of inline parts back into paragraphs.\n *\n * `astToParts` marks every part after the first of a given AST node with\n * `meta.continuesNode`, which is exactly \"same paragraph, keep going\". Parts\n * without it open a new paragraph.\n */\nfunction inlineParagraphs(parts: Part[]): Part[][] {\n const paragraphs: Part[][] = [];\n\n for (const part of parts) {\n if (\n part.type !== 'text' &&\n part.type !== 'richText' &&\n part.type !== 'link'\n ) {\n continue;\n }\n if (part.meta?.continuesNode && paragraphs.length > 0) {\n paragraphs[paragraphs.length - 1].push(part);\n } else {\n paragraphs.push([part]);\n }\n }\n\n return paragraphs;\n}\n\n/**\n * A paragraph that is nothing but links — the hero's button row under the h1,\n * the CTA after a comparison table. This is the one shape a section is entitled\n * to spend on a control instead of printing as copy, and its complement — a\n * link sharing its paragraph with a sentence — is body copy and nothing else.\n *\n * A blank part does not disqualify it. A hard line break between two links\n * (`[A](/a)··\\n[B](/b)`) leaves an empty `t` part behind, and an empty part is\n * not a sentence; without this the row is BOTH a button and a line of body\n * copy, which is the duplication the rule exists to prevent.\n */\nfunction isLinkRow(paragraph: Part[]): boolean {\n return (\n paragraph.some((part) => part.type === 'link') &&\n paragraph.every(\n (part) => part.type === 'link' || markdownOrText(part) === '',\n )\n );\n}\n\n/**\n * The links a section is entitled to render as its own control — a hero button\n * row, a CTA — as opposed to a link that is part of a sentence.\n *\n * The exact complement of what {@link proseBodyMarkdown} keeps, and that is the\n * point: between the two, every top-level link reaches the page exactly once.\n * `getLinks` is the wrong tool for a control slot — it takes EVERY top-level\n * link part, and a link inside a prose paragraph is a top-level part, so\n * `Email support@shop.example` (GFM autolinks a bare address, no author needed)\n * arrived as the hero's first and therefore PRIMARY button, displacing the real\n * call to action into the secondary slot and printing the address twice.\n */\nexport function standaloneLinks(parts: Part[]): LinkPart[] {\n return inlineParagraphs(parts)\n .filter(isLinkRow)\n .flat()\n .filter((part): part is LinkPart => part.type === 'link');\n}\n\nfunction paragraphsToMarkdown(paragraphs: Part[][]): string {\n return paragraphs\n .map(inlinePartsToMarkdown)\n .map((paragraph) => paragraph.trim())\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Body copy as markdown, with inline links intact and paragraph breaks kept.\n *\n * `bodyText` reads text parts only, so a paragraph carrying an inline link —\n * `Try narrowing to [men](web5://ask/…) instead` — arrives as `t + link + t`\n * and comes back as `\"Try narrowing to\\n\\ninstead\"`: label and url both\n * deleted, and the sentence broken in two at the gap. That is DL #134's list\n * bug in a different helper, and it is why an ask link in prose never reached\n * the page. A bare `support@shop.example` is the same bug with no author in\n * sight: GFM autolinks an email into a `link` node, so plain prose loses the\n * address.\n *\n * `inlinePartsToMarkdown` already rebuilds a run of inline parts with links\n * intact, but it flattens to one line, which is wrong for multi-paragraph\n * copy — hence `inlineParagraphs` first.\n *\n * This keeps EVERY link, including one standing alone as its own block. That\n * is right for `textBlock`, whose section consumes nothing but the copy. It is\n * wrong for a section that already spends its links elsewhere — see\n * {@link proseBodyMarkdown}.\n *\n * Kept separate from `bodyText` deliberately. Of the three callers still on\n * `bodyText`: `ErrorSectionDefinition` and `CtaBannerSectionDefinition` do\n * hand their result to a consumer that renders it raw (`ErrorSection` prints\n * the copy in a `<p>`, `CtaBannerSection` the same), so markdown there would\n * show a visitor a literal `[label](url)`. `FeatureSection9PlusDefinition` is\n * the odd one out: it has no registered renderer in either client bundle\n * (`createSdkRegistry` registers the definition with no component, and only\n * `createTestRegistry` gives it a stub), so its `description` reaches nothing\n * and there is no consumer to decide against. `FeatureCardsSectionDefinition`\n * used to be listed here as affected-but-unfixed; it now uses\n * {@link proseBodyMarkdown}.\n */\nexport function bodyMarkdown(parts: Part[]): string {\n return paragraphsToMarkdown(inlineParagraphs(parts));\n}\n\n/**\n * Body copy as markdown for a section that spends some of its links on another\n * slot — hero buttons, a comparison CTA, entity items.\n *\n * Same fix as {@link bodyMarkdown} for the case that matters — a link INSIDE a\n * sentence survives instead of being deleted with its label — but it drops the\n * two shapes those sections have already claimed, so nothing renders twice:\n *\n * - A paragraph that is nothing but links — {@link isLinkRow}.\n * `[Get started](/) [Learn more](/x)` under a hero h1 is the button row\n * `HeroSectionDefinition` turns into `buttons`; the trailing link after a\n * comparison table is its `ctaText` / `ctaHref`. Whole-paragraph is the right\n * test because a link that is part of a sentence always shares its paragraph\n * with the text around it. `HeroSectionDefinition` reads the same predicate\n * from the other side via {@link standaloneLinks}, so the two partition the\n * links rather than each deciding for itself.\n * - Everything from the first `web5://entity/…` link onward, which is item\n * copy rather than section copy — `HeroEntitySectionDefinition` reads those\n * links (and the text after each) into `items`. Same cut\n * {@link entitySectionBodyText} makes, for the same reason.\n *\n * Nothing is lost by either rule: the dropped links are exactly the ones the\n * section renders through some other prop.\n */\nexport function proseBodyMarkdown(parts: Part[]): string {\n const firstEntityLinkIndex = parts.findIndex(\n (p) => p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n const sectionParts =\n firstEntityLinkIndex >= 0 ? parts.slice(0, firstEntityLinkIndex) : parts;\n\n return paragraphsToMarkdown(\n inlineParagraphs(sectionParts).filter((paragraph) => !isLinkRow(paragraph)),\n );\n}\n\n/**\n * Entity sections may be authored as one paragraph per entity:\n * `[Product](web5://entity/...) - why it matches`.\n * In that shape, text after the first entity link is item copy rather than\n * section copy, so only keep prose that appears before the first entity link.\n */\nexport function entitySectionBodyText(parts: Part[]): string {\n const firstEntityLinkIndex = parts.findIndex(\n (p) => p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n const sectionParts =\n firstEntityLinkIndex >= 0 ? parts.slice(0, firstEntityLinkIndex) : parts;\n\n return sectionParts\n .filter((p) => p.type === 'text' || p.type === 'richText')\n .map(markdownOrText)\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Build HeroButton[] from link parts — aligned to HeroSection1Button shape.\n *\n * `standaloneLinks`, not `getLinks`, for the reason spelled out there: a link\n * in a sentence is body copy, not a button. Currently uncalled — kept on the\n * same rule as `HeroSectionDefinition` so wiring it up cannot reintroduce the\n * bug.\n */\nexport function linksToHeroButtons(parts: Part[]): HeroButton[] {\n let links: LinkPart[] = standaloneLinks(parts);\n if (!links.length) {\n const lists = getPartsByType<ListPart>(parts, 'list');\n links = lists.flatMap((l) =>\n (l.meta?.items ?? []).flatMap((item) =>\n ((item.meta?.parts ?? []) as Part[]).filter(\n (p): p is LinkPart => p.type === 'link',\n ),\n ),\n );\n }\n return links.map(\n (l, i): HeroButton => ({\n id: `btn-${i}`,\n text: l.content?.trim() || 'Learn more',\n variant: i === 0 ? 'primary' : 'secondary',\n onClick: l.meta.href,\n }),\n );\n}\n\n/** Return just the src URL string of the first image part */\nexport function firstImageSrc(parts: Part[]): string | undefined {\n const images = getImages(parts);\n const img = images[0];\n return img?.meta?.src || undefined;\n}\n\n/** Return the first link as { text, href } */\nexport function firstLink(\n parts: Part[],\n): { text: string; href: string } | undefined {\n const links = getLinks(parts);\n const link = links[0];\n if (!link) {\n return undefined;\n }\n return { text: link.content?.trim() || '', href: link.meta.href };\n}\n\n/** Extract text content from blockquote parts, preserving markdown formatting when available */\nexport function blockquoteText(parts: Part[]): string | undefined {\n const bqs = getPartsByType<Part>(parts, 'blockquote');\n if (bqs.length === 0) {\n return undefined;\n }\n const text = bqs\n .map((p) => (p.meta?.markdown as string)?.trim() || str(p))\n .filter(Boolean)\n .join('\\n');\n return text || undefined;\n}\n\n/** Extract first callout from parts as a Callout object */\nexport function calloutFromParts(parts: Part[]): Callout | undefined {\n const calloutParts = getPartsByType<Part>(parts, 'callout');\n if (calloutParts.length === 0) {\n return undefined;\n }\n const p = calloutParts[0];\n const raw = (p.meta?.markdown as string)?.trim() || str(p);\n const parsed = parseCalloutTag(raw);\n return parsed.text ? { text: parsed.text, kind: parsed.kind } : undefined;\n}\n\n/** Convert list parts to a markdown-like string */\nexport function listToMarkdown(parts: Part[]): string | undefined {\n const lists = getPartsByType<ListPart>(parts, 'list');\n if (lists.length === 0) {\n return undefined;\n }\n const lines: string[] = [];\n for (const list of lists) {\n const items = list.meta?.items ?? [];\n for (const item of items) {\n const text = extractListItemText(item);\n if (text) {\n lines.push(`- ${text}`);\n }\n }\n }\n return lines.length > 0 ? lines.join('\\n') : undefined;\n}\n\n/**\n * Parse a web5://entity/ URL into entityType and entityId.\n * Delegates to the central `parseWeb5Url` parser.\n */\nexport function parseEntityUrl(\n url: string,\n): { entityType: string; entityId: string } | null {\n const trimmedUrl = url?.trim();\n if (!trimmedUrl || !isWeb5EntityUrl(trimmedUrl)) {\n return null;\n }\n const parsed = parseWeb5Url(trimmedUrl);\n if (\n parsed?.type !== Web5UrlType.ENTITY ||\n !parsed.entityType ||\n !parsed.entityId\n ) {\n return null;\n }\n return { entityType: parsed.entityType, entityId: parsed.entityId };\n}\n\n/**\n * Parse a table cell value into boolean or string.\n * Ported from web50-server-ui comparisonSectionParser.tsx.\n */\nexport function parseTableValue(value: string): boolean | string {\n const normalized = value.trim().toLowerCase();\n\n if (\n normalized === 'true' ||\n normalized === 'yes' ||\n normalized === '✓' ||\n normalized === 'check' ||\n normalized === 'y'\n ) {\n return true;\n }\n if (\n normalized === 'false' ||\n normalized === 'no' ||\n normalized === '✗' ||\n normalized === 'x' ||\n normalized === 'n' ||\n normalized === ''\n ) {\n return false;\n }\n\n return value.trim();\n}\n\n/**\n * Parse a KPI item from markdown text.\n * The first **bold** segment becomes the title; everything after it (leading \":\" stripped) is the description.\n */\nexport function parseKpiItem(\n markdown: string,\n): { title: string; description: string } | null {\n const trimmed = markdown.trim();\n if (!trimmed) {\n return null;\n }\n const boldMatch = trimmed.match(/\\*\\*(.+?)\\*\\*/);\n if (!boldMatch) {\n return null;\n }\n const title = boldMatch[1].trim();\n const afterBold = trimmed.slice(\n trimmed.indexOf(boldMatch[0]) + boldMatch[0].length,\n );\n const description = afterBold.replace(/^[:\\s]+/, '').trim();\n return { title, description };\n}\n\n/** Join inline tokens the way prose reads: single spaces, none before punctuation. */\nfunction appendInlineToken(current: string, token: string): string {\n const trimmed = token.trim();\n if (!trimmed) {\n return current;\n }\n if (!current) {\n return trimmed;\n }\n if (/^[,.;:!?)]/.test(trimmed)) {\n return `${current}${trimmed}`;\n }\n return `${current} ${trimmed}`;\n}\n\n/**\n * Serialize a run of inline parts back to markdown, preserving links and\n * inline emphasis.\n *\n * Concatenating `part.content` alone silently deletes links: a `link` part\n * keeps its label in `content` and its url in `meta.href`, so a filter that\n * reads only text parts turns `Read the [pricing page](/pricing) first` into\n * `Read the first` — url and label both vanish, with nothing in the output to\n * show anything was lost.\n *\n * `content` is also the *plain* text of a text part — `nodesToParts` strips\n * inline formatting and keeps the original in `meta.markdown` whenever the two\n * differ. Reading `content` therefore drops emphasis the same way it used to\n * drop links: `The **4 oz size** is best` becomes `The 4 oz size is best`.\n * Prefer `meta.markdown`, which is exactly the segment's own markdown.\n */\nexport function inlinePartsToMarkdown(parts: Part[]): string {\n return parts.reduce((text, part) => {\n if (part.type === 'link') {\n const href = (part as LinkPart).meta?.href ?? '';\n const label = part.content?.trim() ?? '';\n return appendInlineToken(text, href ? `[${label}](${href})` : label);\n }\n return appendInlineToken(\n text,\n (part.meta?.markdown as string | undefined) ?? part.content ?? '',\n );\n }, '');\n}\n\nexport function extractListItemText(item: ListItemPart): string {\n if (item.content) {\n return item.content;\n }\n if (item.meta?.parts) {\n return (item.meta.parts as Part[])\n .map((p) => p.content)\n .filter(Boolean)\n .join(' ');\n }\n return '';\n}\n\n/**\n * Reconstruct markdown-like content from parts.\n *\n * `part.content` is the *plain* text — `nodesToParts` strips inline\n * formatting and preserves the original markdown (bold, italic, links) in\n * `part.meta.markdown` when they differ. Prefer it so markdown-rendering\n * consumers (e.g. the fallback section's ReactMarkdown) keep `**bold**`.\n */\nexport function partsToMarkdown(sectionParts: Part[]): string {\n const inline = (part: Part): string =>\n (part.meta?.markdown as string | undefined) ?? part.content;\n const lines: string[] = [];\n for (const part of sectionParts) {\n if (part.type === 'heading') {\n const level = (part.meta as { level: number })?.level ?? 2;\n lines.push(`${'#'.repeat(level)} ${inline(part)}`);\n } else if (part.type === 'text' || part.type === 'richText') {\n lines.push(inline(part));\n } else if (part.type === 'list') {\n const list = part as ListPart;\n for (const item of list.meta?.items ?? []) {\n lines.push(\n `- ${(item.meta?.markdown as string | undefined) ?? extractListItemText(item)}`,\n );\n }\n } else if (part.type === 'blockquote' || part.type === 'callout') {\n lines.push(`> ${inline(part)}`);\n }\n }\n return lines.join('\\n\\n');\n}\n\n/**\n * Extract callout kind tag from blockquote text.\n * Handles [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] GFM syntax.\n */\nexport function parseCalloutTag(text: string): { text: string; kind?: string } {\n const match = text.match(/^\\[!(\\w+)\\]\\s*(.*)/s);\n if (match) {\n return { kind: match[1].toUpperCase(), text: match[2].trim() };\n }\n return { text: text.trim() };\n}\n\n/** Generate a simple unique ID */\nexport function generatePartId(): string {\n return Math.random().toString(36).slice(2, 10);\n}\n\nfunction isEntityHref(href: string | undefined): boolean {\n return !!href && isWeb5EntityUrl(href);\n}\n\nexport interface EntityRef {\n entityId: string;\n entityType: string;\n linkText: string;\n entityUrl: string;\n description: string;\n markdownImageUrl?: string;\n markdownFeatures?: string[];\n callout?: Callout;\n}\n\n/**\n * Extract text from nested list items within a list item's parts.\n */\nfunction extractNestedListItems(itemParts: Part[]): string[] {\n const nestedLists = itemParts.filter((p): p is ListPart => p.type === 'list');\n const features: string[] = [];\n for (const list of nestedLists) {\n for (const nested of list.meta?.items ?? []) {\n const text = extractListItemText(nested);\n if (text) {\n features.push(text);\n }\n }\n }\n return features;\n}\n\n/**\n * Extract entity references from list items containing web5://entity/ links.\n * Also extracts markdownFeatures from nested list items within each entity item.\n */\nexport function extractEntityRefs(parts: Part[]): EntityRef[] {\n const entities: EntityRef[] = [];\n const lists = getPartsByType<ListPart>(parts, 'list');\n\n for (const list of lists) {\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const entityLinks = itemParts.filter(\n (p): p is LinkPart =>\n p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n\n for (const link of entityLinks) {\n const parsed = parseEntityUrl(link.meta.href);\n if (parsed) {\n const images = itemParts.filter(\n (p): p is ImagePart => p.type === 'image',\n );\n const textParts = itemParts.filter(\n (p) => p.type === 'text' && p.content?.trim(),\n );\n const description = normalizeEntityDescription(\n textParts.map(markdownOrText).join(' '),\n );\n const features = extractNestedListItems(itemParts);\n const calloutParts = itemParts.filter(\n (p) => p.type === 'callout' || p.type === 'blockquote',\n );\n let callout: Callout | undefined;\n if (calloutParts.length > 0) {\n const raw =\n (calloutParts[0].meta?.markdown as string)?.trim() ||\n str(calloutParts[0]);\n const parsed2 = parseCalloutTag(raw);\n if (parsed2.text) {\n callout = { text: parsed2.text, kind: parsed2.kind };\n }\n }\n entities.push({\n entityId: parsed.entityId,\n entityType: parsed.entityType,\n linkText: link.content?.trim() || '',\n entityUrl: link.meta.href,\n description,\n markdownImageUrl: images[0]?.meta?.src,\n markdownFeatures: features.length > 0 ? features : undefined,\n callout,\n });\n }\n }\n }\n }\n\n // Also check top-level links (with surrounding context for description/image/list)\n const topLinks = getLinks(parts).filter((l) => isEntityHref(l.meta?.href));\n for (const link of topLinks) {\n const parsed = parseEntityUrl(link.meta.href);\n if (parsed && !entities.some((e) => e.entityId === parsed.entityId)) {\n // Look for description text and image after this link in the parts array\n const linkIndex = parts.indexOf(link);\n let description = '';\n let markdownImageUrl: string | undefined;\n let callout: Callout | undefined;\n const features: string[] = [];\n\n if (linkIndex >= 0) {\n // Scan following parts for description, image, callout, and list items\n for (let j = linkIndex + 1; j < parts.length; j++) {\n const p = parts[j];\n // Stop at next entity link\n if (p.type === 'link' && isEntityHref((p as LinkPart).meta?.href)) {\n break;\n }\n if (p.type === 'text' && p.content?.trim()) {\n const text = markdownOrText(p);\n description = description\n ? `${description} ${text}`\n : text;\n } else if (p.type === 'image' && !markdownImageUrl) {\n markdownImageUrl = (p as ImagePart).meta?.src;\n } else if (\n (p.type === 'callout' || p.type === 'blockquote') &&\n !callout\n ) {\n const raw = (p.meta?.markdown as string)?.trim() || str(p);\n const parsedCallout = parseCalloutTag(raw);\n if (parsedCallout.text) {\n callout = { text: parsedCallout.text, kind: parsedCallout.kind };\n }\n } else if (p.type === 'list') {\n for (const item of (p as ListPart).meta?.items ?? []) {\n const text = extractListItemText(item);\n if (text) {\n features.push(text);\n }\n }\n }\n }\n }\n\n entities.push({\n entityId: parsed.entityId,\n entityType: parsed.entityType,\n linkText: link.content?.trim() || '',\n entityUrl: link.meta.href,\n description: normalizeEntityDescription(description),\n markdownImageUrl,\n markdownFeatures: features.length > 0 ? features : undefined,\n callout,\n });\n }\n }\n\n return entities;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAIA,SAASG,GAAGA,CAACC,CAAmB,EAAU;EAAA,IAAAC,UAAA;EACxC,OAAO,CAAAD,CAAC,aAAAC,UAAA,GAADD,CAAC,CAAEE,OAAO,qBAAVD,UAAA,CAAYE,IAAI,CAAC,CAAC,KAAI,EAAE;AACjC;AAEA,SAASC,cAAcA,CAACJ,CAAO,EAAU;EAAA,IAAAK,OAAA;EACvC,OAAO,CAAC,EAAAA,OAAA,GAACL,CAAC,CAACM,IAAI,cAAAD,OAAA,GAAN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wF,IAAI,EAAE6E,aAAa,CAAC7E;cAAK,CAAC;YAClE;UACF,CAAC,MAAM,IAAIjG,CAAC,CAACwC,IAAI,KAAK,MAAM,EAAE;YAC5B,KAAK,MAAM8B,IAAI,IAAI,EAAAyG,MAAA,GAAC/K,CAAC,CAAcM,IAAI,qBAApByK,MAAA,CAAsB1G,KAAK,KAAI,EAAE,EAAE;cAAA,IAAA0G,MAAA;cACpD,MAAMtK,IAAI,GAAG6F,mBAAmB,CAAChC,IAAI,CAAC;cACtC,IAAI7D,IAAI,EAAE;gBACRwI,QAAQ,CAACtG,IAAI,CAAClC,IAAI,CAAC;cACrB;YACF;UACF;QACF;MACF;MAEA4I,QAAQ,CAAC1G,IAAI,CAAC;QACZoE,QAAQ,EAAEhB,MAAM,CAACgB,QAAQ;QACzBD,UAAU,EAAEf,MAAM,CAACe,UAAU;QAC7BkD,QAAQ,EAAE,EAAAO,cAAA,GAAAhF,IAAI,CAACrF,OAAO,qBAAZqK,cAAA,CAAcpK,IAAI,CAAC,CAAC,KAAI,EAAE;QACpC8J,SAAS,EAAE1E,IAAI,CAACjF,IAAI,CAACoD,IAAI;QACzBxC,WAAW,EAAED,0BAA0B,CAACC,WAAW,CAAC;QACpDgJ,gBAAgB;QAChBC,gBAAgB,EAAElB,QAAQ,CAACvG,MAAM,GAAG,CAAC,GAAGuG,QAAQ,GAAG9D,SAAS;QAC5D0E;MACF,CAAC,CAAC;IACJ;EACF;EAEA,OAAOR,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -90,13 +90,14 @@ export class EntityCollectionSectionDefinition {
|
|
|
90
90
|
entityId: 'gid://shopify/Collection/347895267466',
|
|
91
91
|
entityType: 'collection',
|
|
92
92
|
entityUrl: 'web5://entity/collection/gid://shopify/Collection/347895267466',
|
|
93
|
-
|
|
93
|
+
// The model wrote it lowercase; the parse raises the first letter.
|
|
94
|
+
description: 'Storewide assortment spanning the full product range'
|
|
94
95
|
}, {
|
|
95
96
|
entityId: 'gid://shopify/Collection/348001501322',
|
|
96
97
|
entityType: 'collection',
|
|
97
98
|
entityUrl: 'web5://entity/collection/gid://shopify/Collection/348001501322',
|
|
98
99
|
// Inline emphasis survives — descriptions keep their markdown.
|
|
99
|
-
description: '
|
|
100
|
+
description: 'Artistic **Watercolor** candles with bright vessels'
|
|
100
101
|
}]
|
|
101
102
|
}
|
|
102
103
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["headingText","entitySectionBodyText","extractEntityRefs","calloutFromParts","DIAGNOSTIC_TYPES","COLLECTION_ENTITY_TYPE","EntityCollectionSectionDefinition","constructor","_defineProperty","title","items","entityId","entityType","entityUrl","linkText","markdown","expected","description","parse","parts","context","entityRefs","length","reportDiagnostic","SECTION_REJECTED","some","e","undefined","callout","map","imageUrl","markdownImageUrl"],"sources":["../../../../src/component/componentDefinitions/EntityCollectionSectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n entitySectionBodyText,\n extractEntityRefs,\n calloutFromParts,\n} from './parse-utils';\nimport type { Part } from '../../parts/parts';\nimport type {\n EntityCompProps,\n EntityItem,\n EntitySectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition, ParseContext } from '../section-definition';\nimport { DIAGNOSTIC_TYPES } from '../diagnosticTypes';\n\n/**\n * The semantic entity type this definition claims — the `<type>` segment of\n * `web5://entity/<type>/<id>` (see the client `entityConfig.entityTypes` map).\n */\nconst COLLECTION_ENTITY_TYPE = 'collection';\n\n/**\n * Entity section restricted to **collection** entities\n * (`web5://entity/collection/<id>`).\n *\n * Same markdown shapes as {@link EntitySectionDefinition} — an `h2`, optional\n * intro/callout, then entity links either at the top level or as list items —\n * but every entity link must be a collection. That makes it a strictly narrower\n * match, so it MUST be registered **before** `EntitySectionDefinition` (which\n * claims any `link[entityType]`, i.e. product and article sections too). Once\n * `EntitySectionDefinition` matches, the block is consumed and no later\n * definition is consulted.\n *\n * Mixed blocks (a collection next to a product or an article) fall through:\n * the patterns only cover consecutive collection links, and `parse()` returns\n * `null` when a non-collection entity slipped into the matched slice, handing\n * the block to `EntitySectionDefinition`.\n *\n * Props are the shared {@link EntityCompProps} shape, so a client renders it\n * with a dedicated `EntityCollectionSection` component while product/article\n * sections keep using their own components under `EntitySectionDefinition`.\n */\nexport class EntityCollectionSectionDefinition\n implements SectionDefinition<EntitySectionComponent>\n{\n sectionType = 'entityCollection' as const;\n /**\n * One pattern, matching the shape the orchestrator actually emits for a\n * collections block:\n *\n * <!-- section:entities, semantic:items -->\n * ## Curated collections by theme\n * - [](web5://entity/collection/<id>) description\n *\n * The head absorbs the section descriptor and any intro copy or ECHO\n * callout; each list item is a collection link, an optional markdown image,\n * then its description and optional per-item callout. A trailing\n * section-level callout is intentionally left outside the pattern so it\n * falls through to the downstream CalloutSection.\n *\n * Deliberately narrow: anything else (collection links at the top level\n * rather than in a list, a block mixing entity types) falls through to\n * `EntitySectionDefinition`, which is what handled it before this\n * definition existed.\n */\n patterns = [\n 'html_comment* > h2 > (html_comment | t | callout)* > list{item[1-]:link[entityType=\"collection\"] > image? > (t | callout)*}',\n ];\n\n defaults: EntityCompProps = {\n title: 'Collections',\n items: [\n {\n entityId: 'example-1',\n entityType: COLLECTION_ENTITY_TYPE,\n entityUrl: 'web5://entity/collection/example-1',\n linkText: 'Example collection',\n },\n ],\n };\n\n fixtures: SectionFixture<EntityCompProps>[] = [\n {\n markdown:\n '## Shop the collections\\n\\nCurated edits for the season.\\n\\n- [Running](web5://entity/collection/pUx3mVQ1TmyN2mVYQqQ8Jg) Shoes and kit built for the road\\n- [Trail](web5://entity/collection/Rr8kQyO0S1uH2nQ0mQ2AqQ) Grip and protection off-road',\n expected: {\n title: 'Shop the collections',\n description: 'Curated edits for the season.',\n items: [\n {\n entityId: 'pUx3mVQ1TmyN2mVYQqQ8Jg',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/pUx3mVQ1TmyN2mVYQqQ8Jg',\n linkText: 'Running',\n description: 'Shoes and kit built for the road',\n },\n {\n entityId: 'Rr8kQyO0S1uH2nQ0mQ2AqQ',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/Rr8kQyO0S1uH2nQ0mQ2AqQ',\n linkText: 'Trail',\n description: 'Grip and protection off-road',\n },\n ],\n },\n },\n {\n // The shape the orchestrator emits: a section descriptor, empty link\n // text, and a Shopify gid (which is itself a `://` url) as the entity id.\n markdown:\n '<!-- section:entities, semantic:items -->\\n## Curated collections by theme\\n- [](web5://entity/collection/gid://shopify/Collection/347895267466) storewide assortment spanning the full product range\\n- [](web5://entity/collection/gid://shopify/Collection/348001501322) artistic **Watercolor** candles with bright vessels',\n expected: {\n title: 'Curated collections by theme',\n items: [\n {\n entityId: 'gid://shopify/Collection/347895267466',\n entityType: 'collection',\n entityUrl:\n 'web5://entity/collection/gid://shopify/Collection/347895267466',\n description: 'storewide assortment spanning the full product range',\n },\n {\n entityId: 'gid://shopify/Collection/348001501322',\n entityType: 'collection',\n entityUrl:\n 'web5://entity/collection/gid://shopify/Collection/348001501322',\n // Inline emphasis survives — descriptions keep their markdown.\n description: 'artistic **Watercolor** candles with bright vessels',\n },\n ],\n },\n },\n {\n // Single collection — the full-width banner shape.\n markdown:\n '## Winter essentials\\n\\n- [Shop winter](web5://entity/collection/aB1cD2eF3gH4iJ5kL6mN7o) Layers for the cold months',\n expected: {\n title: 'Winter essentials',\n items: [\n {\n entityId: 'aB1cD2eF3gH4iJ5kL6mN7o',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/aB1cD2eF3gH4iJ5kL6mN7o',\n linkText: 'Shop winter',\n description: 'Layers for the cold months',\n },\n ],\n },\n },\n ];\n\n parse(parts: Part[], context?: ParseContext): EntityCompProps | null {\n const entityRefs = extractEntityRefs(parts);\n\n if (entityRefs.length === 0) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'entityCollection: no entity links found',\n );\n return null;\n }\n\n // Guard the pattern: anything that is not a collection means this block\n // belongs to the generic entity section, not here.\n if (entityRefs.some((e) => e.entityType !== COLLECTION_ENTITY_TYPE)) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'entityCollection: block mixes collections with other entity types',\n );\n return null;\n }\n\n const title = headingText(parts, 2) || 'Collections';\n const description = entitySectionBodyText(parts) || undefined;\n\n // Every entity link lives inside the list, so any top-level callout is\n // section-level by construction — per-item callouts are nested in the list\n // items and are picked up by extractEntityRefs instead.\n const callout = calloutFromParts(parts);\n\n const items: EntityItem[] = entityRefs.map((e) => ({\n entityId: e.entityId,\n entityType: e.entityType,\n entityUrl: e.entityUrl,\n linkText: e.linkText || undefined,\n description: e.description || undefined,\n imageUrl: e.markdownImageUrl,\n callout: e.callout,\n }));\n\n return { title, description, callout, items };\n }\n}\n"],"mappings":";AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,iBAAiB,EACjBC,gBAAgB,QACX,eAAe;AAStB,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAG,YAAY;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iCAAiC,CAE9C;EAAAC,YAAA;IAAAC,eAAA,sBACgB,kBAAkB;IAChC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAlBEA,eAAA,mBAmBW,CACT,6HAA6H,CAC9H;IAAAA,eAAA,mBAE2B;MAC1BC,KAAK,EAAE,aAAa;MACpBC,KAAK,EAAE,CACL;QACEC,QAAQ,EAAE,WAAW;QACrBC,UAAU,EAAEP,sBAAsB;QAClCQ,SAAS,EAAE,oCAAoC;QAC/CC,QAAQ,EAAE;MACZ,CAAC;IAEL,CAAC;IAAAN,eAAA,mBAE6C,CAC5C;MACEO,QAAQ,EACN,oPAAoP;MACtPC,QAAQ,EAAE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gBAAgB,CACvBnB,gBAAgB,CAACoB,gBAAgB,EACjC,yCACF,CAAC;MACD,OAAO,IAAI;IACb;;IAEA;IACA;IACA,IAAIH,UAAU,CAACI,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACd,UAAU,KAAKP,sBAAsB,CAAC,EAAE;MACnEe,OAAO,YAAPA,OAAO,CAAEG,gBAAgB,YAAzBH,OAAO,CAAEG,gBAAgB,CACvBnB,gBAAgB,CAACoB,gBAAgB,EACjC,mEACF,CAAC;MACD,OAAO,IAAI;IACb;IAEA,MAAMf,KAAK,GAAGT,WAAW,CAACmB,KAAK,EAAE,CAAC,CAAC,IAAI,aAAa;IACpD,MAAMF,WAAW,GAAGhB,qBAAqB,CAACkB,KAAK,CAAC,IAAIQ,SAAS;;IAE7D;IACA;IACA;IACA,MAAMC,OAAO,GAAGzB,gBAAgB,CAACgB,KAAK,CAAC;IAEvC,MAAMT,KAAmB,GAAGW,UAAU,CAACQ,GAAG,CAAEH,CAAC,KAAM;MACjDf,QAAQ,EAAEe,CAAC,CAACf,QAAQ;MACpBC,UAAU,EAAEc,CAAC,CAACd,UAAU;MACxBC,SAAS,EAAEa,CAAC,CAACb,SAAS;MACtBC,QAAQ,EAAEY,CAAC,CAACZ,QAAQ,IAAIa,SAAS;MACjCV,WAAW,EAAES,CAAC,CAACT,WAAW,IAAIU,SAAS;MACvCG,QAAQ,EAAEJ,CAAC,CAACK,gBAAgB;MAC5BH,OAAO,EAAEF,CAAC,CAACE;IACb,CAAC,CAAC,CAAC;IAEH,OAAO;MAAEnB,KAAK;MAAEQ,WAAW;MAAEW,OAAO;MAAElB;IAAM,CAAC;EAC/C;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["headingText","entitySectionBodyText","extractEntityRefs","calloutFromParts","DIAGNOSTIC_TYPES","COLLECTION_ENTITY_TYPE","EntityCollectionSectionDefinition","constructor","_defineProperty","title","items","entityId","entityType","entityUrl","linkText","markdown","expected","description","parse","parts","context","entityRefs","length","reportDiagnostic","SECTION_REJECTED","some","e","undefined","callout","map","imageUrl","markdownImageUrl"],"sources":["../../../../src/component/componentDefinitions/EntityCollectionSectionDefinition.ts"],"sourcesContent":["import {\n headingText,\n entitySectionBodyText,\n extractEntityRefs,\n calloutFromParts,\n} from './parse-utils';\nimport type { Part } from '../../parts/parts';\nimport type {\n EntityCompProps,\n EntityItem,\n EntitySectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition, ParseContext } from '../section-definition';\nimport { DIAGNOSTIC_TYPES } from '../diagnosticTypes';\n\n/**\n * The semantic entity type this definition claims — the `<type>` segment of\n * `web5://entity/<type>/<id>` (see the client `entityConfig.entityTypes` map).\n */\nconst COLLECTION_ENTITY_TYPE = 'collection';\n\n/**\n * Entity section restricted to **collection** entities\n * (`web5://entity/collection/<id>`).\n *\n * Same markdown shapes as {@link EntitySectionDefinition} — an `h2`, optional\n * intro/callout, then entity links either at the top level or as list items —\n * but every entity link must be a collection. That makes it a strictly narrower\n * match, so it MUST be registered **before** `EntitySectionDefinition` (which\n * claims any `link[entityType]`, i.e. product and article sections too). Once\n * `EntitySectionDefinition` matches, the block is consumed and no later\n * definition is consulted.\n *\n * Mixed blocks (a collection next to a product or an article) fall through:\n * the patterns only cover consecutive collection links, and `parse()` returns\n * `null` when a non-collection entity slipped into the matched slice, handing\n * the block to `EntitySectionDefinition`.\n *\n * Props are the shared {@link EntityCompProps} shape, so a client renders it\n * with a dedicated `EntityCollectionSection` component while product/article\n * sections keep using their own components under `EntitySectionDefinition`.\n */\nexport class EntityCollectionSectionDefinition\n implements SectionDefinition<EntitySectionComponent>\n{\n sectionType = 'entityCollection' as const;\n /**\n * One pattern, matching the shape the orchestrator actually emits for a\n * collections block:\n *\n * <!-- section:entities, semantic:items -->\n * ## Curated collections by theme\n * - [](web5://entity/collection/<id>) description\n *\n * The head absorbs the section descriptor and any intro copy or ECHO\n * callout; each list item is a collection link, an optional markdown image,\n * then its description and optional per-item callout. A trailing\n * section-level callout is intentionally left outside the pattern so it\n * falls through to the downstream CalloutSection.\n *\n * Deliberately narrow: anything else (collection links at the top level\n * rather than in a list, a block mixing entity types) falls through to\n * `EntitySectionDefinition`, which is what handled it before this\n * definition existed.\n */\n patterns = [\n 'html_comment* > h2 > (html_comment | t | callout)* > list{item[1-]:link[entityType=\"collection\"] > image? > (t | callout)*}',\n ];\n\n defaults: EntityCompProps = {\n title: 'Collections',\n items: [\n {\n entityId: 'example-1',\n entityType: COLLECTION_ENTITY_TYPE,\n entityUrl: 'web5://entity/collection/example-1',\n linkText: 'Example collection',\n },\n ],\n };\n\n fixtures: SectionFixture<EntityCompProps>[] = [\n {\n markdown:\n '## Shop the collections\\n\\nCurated edits for the season.\\n\\n- [Running](web5://entity/collection/pUx3mVQ1TmyN2mVYQqQ8Jg) Shoes and kit built for the road\\n- [Trail](web5://entity/collection/Rr8kQyO0S1uH2nQ0mQ2AqQ) Grip and protection off-road',\n expected: {\n title: 'Shop the collections',\n description: 'Curated edits for the season.',\n items: [\n {\n entityId: 'pUx3mVQ1TmyN2mVYQqQ8Jg',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/pUx3mVQ1TmyN2mVYQqQ8Jg',\n linkText: 'Running',\n description: 'Shoes and kit built for the road',\n },\n {\n entityId: 'Rr8kQyO0S1uH2nQ0mQ2AqQ',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/Rr8kQyO0S1uH2nQ0mQ2AqQ',\n linkText: 'Trail',\n description: 'Grip and protection off-road',\n },\n ],\n },\n },\n {\n // The shape the orchestrator emits: a section descriptor, empty link\n // text, and a Shopify gid (which is itself a `://` url) as the entity id.\n markdown:\n '<!-- section:entities, semantic:items -->\\n## Curated collections by theme\\n- [](web5://entity/collection/gid://shopify/Collection/347895267466) storewide assortment spanning the full product range\\n- [](web5://entity/collection/gid://shopify/Collection/348001501322) artistic **Watercolor** candles with bright vessels',\n expected: {\n title: 'Curated collections by theme',\n items: [\n {\n entityId: 'gid://shopify/Collection/347895267466',\n entityType: 'collection',\n entityUrl:\n 'web5://entity/collection/gid://shopify/Collection/347895267466',\n // The model wrote it lowercase; the parse raises the first letter.\n description: 'Storewide assortment spanning the full product range',\n },\n {\n entityId: 'gid://shopify/Collection/348001501322',\n entityType: 'collection',\n entityUrl:\n 'web5://entity/collection/gid://shopify/Collection/348001501322',\n // Inline emphasis survives — descriptions keep their markdown.\n description: 'Artistic **Watercolor** candles with bright vessels',\n },\n ],\n },\n },\n {\n // Single collection — the full-width banner shape.\n markdown:\n '## Winter essentials\\n\\n- [Shop winter](web5://entity/collection/aB1cD2eF3gH4iJ5kL6mN7o) Layers for the cold months',\n expected: {\n title: 'Winter essentials',\n items: [\n {\n entityId: 'aB1cD2eF3gH4iJ5kL6mN7o',\n entityType: 'collection',\n entityUrl: 'web5://entity/collection/aB1cD2eF3gH4iJ5kL6mN7o',\n linkText: 'Shop winter',\n description: 'Layers for the cold months',\n },\n ],\n },\n },\n ];\n\n parse(parts: Part[], context?: ParseContext): EntityCompProps | null {\n const entityRefs = extractEntityRefs(parts);\n\n if (entityRefs.length === 0) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'entityCollection: no entity links found',\n );\n return null;\n }\n\n // Guard the pattern: anything that is not a collection means this block\n // belongs to the generic entity section, not here.\n if (entityRefs.some((e) => e.entityType !== COLLECTION_ENTITY_TYPE)) {\n context?.reportDiagnostic?.(\n DIAGNOSTIC_TYPES.SECTION_REJECTED,\n 'entityCollection: block mixes collections with other entity types',\n );\n return null;\n }\n\n const title = headingText(parts, 2) || 'Collections';\n const description = entitySectionBodyText(parts) || undefined;\n\n // Every entity link lives inside the list, so any top-level callout is\n // section-level by construction — per-item callouts are nested in the list\n // items and are picked up by extractEntityRefs instead.\n const callout = calloutFromParts(parts);\n\n const items: EntityItem[] = entityRefs.map((e) => ({\n entityId: e.entityId,\n entityType: e.entityType,\n entityUrl: e.entityUrl,\n linkText: e.linkText || undefined,\n description: e.description || undefined,\n imageUrl: e.markdownImageUrl,\n callout: e.callout,\n }));\n\n return { title, description, callout, items };\n }\n}\n"],"mappings":";AAAA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,iBAAiB,EACjBC,gBAAgB,QACX,eAAe;AAStB,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAG,YAAY;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iCAAiC,CAE9C;EAAAC,YAAA;IAAAC,eAAA,sBACgB,kBAAkB;IAChC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAlBEA,eAAA,mBAmBW,CACT,6HAA6H,CAC9H;IAAAA,eAAA,mBAE2B;MAC1BC,KAAK,EAAE,aAAa;MACpBC,KAAK,EAAE,CACL;QACEC,QAAQ,EAAE,WAAW;QACrBC,UAAU,EAAEP,sBAAsB;QAClCQ,SAAS,EAAE,oCAAoC;QAC/CC,QAAQ,EAAE;MACZ,CAAC;IAEL,CAAC;IAAAN,eAAA,mBAE6C,CAC5C;MACEO,QAAQ,EACN,oPAAoP;MACtPC,QAAQ,EAAE;QACRP,KAAK,EAAE,sBAAsB;QAC7BQ,WAAW,EAAE,+BAA+B;QAC5CP,KAAK,EAAE,CACL;UACEC,QAAQ,EAAE,wBAAwB;UAClCC,UAAU,EAAE,YAAY;UACxBC,SAAS,EAAE,iDAAiD;UAC5DC,QAAQ,EAAE,SAAS;UACnBG,WAAW,EAAE;QACf,CAAC,EACD;UACEN,QAAQ,EAAE,wBAAwB;UAClCC,UAAU,EAAE,YAAY;UACxBC,SAAS,EAAE,iDAAiD;UAC5DC,QAAQ,EAAE,OAAO;UACjBG,WAAW,EAAE;QACf,CAAC;MAEL;IACF,CAAC,EACD;MACE;MACA;MACAF,QAAQ,EACN,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IACpD,MAAMF,WAAW,GAAGhB,qBAAqB,CAACkB,KAAK,CAAC,IAAIQ,SAAS;;IAE7D;IACA;IACA;IACA,MAAMC,OAAO,GAAGzB,gBAAgB,CAACgB,KAAK,CAAC;IAEvC,MAAMT,KAAmB,GAAGW,UAAU,CAACQ,GAAG,CAAEH,CAAC,KAAM;MACjDf,QAAQ,EAAEe,CAAC,CAACf,QAAQ;MACpBC,UAAU,EAAEc,CAAC,CAACd,UAAU;MACxBC,SAAS,EAAEa,CAAC,CAACb,SAAS;MACtBC,QAAQ,EAAEY,CAAC,CAACZ,QAAQ,IAAIa,SAAS;MACjCV,WAAW,EAAES,CAAC,CAACT,WAAW,IAAIU,SAAS;MACvCG,QAAQ,EAAEJ,CAAC,CAACK,gBAAgB;MAC5BH,OAAO,EAAEF,CAAC,CAACE;IACb,CAAC,CAAC,CAAC;IAEH,OAAO;MAAEnB,KAAK;MAAEQ,WAAW;MAAEW,OAAO;MAAElB;IAAM,CAAC;EAC/C;AACF","ignoreList":[]}
|
|
@@ -9,8 +9,18 @@ function markdownOrText(p) {
|
|
|
9
9
|
var _p$meta;
|
|
10
10
|
return (((_p$meta = p.meta) == null || (_p$meta = _p$meta.markdown) == null ? void 0 : _p$meta.trim()) || str(p)).trim();
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The model does not reliably open an entity blurb with a capital, and a card
|
|
15
|
+
* leads with that line. Leading markdown and punctuation (`**`, `_`, `[`,
|
|
16
|
+
* quotes) are skipped so the first real letter is raised; a mixed-case first
|
|
17
|
+
* word (`iPhone`, `eBay`) is left alone, since raising it misspells a name.
|
|
18
|
+
*/
|
|
19
|
+
function capitalizeFirstLetter(text) {
|
|
20
|
+
return text.replace(/^([^\p{L}\p{N}]*)(\p{Ll})(\p{L}*)/u, (match, lead, first, rest) => /\p{Lu}/u.test(rest) ? match : `${lead}${first.toUpperCase()}${rest}`);
|
|
21
|
+
}
|
|
12
22
|
function normalizeEntityDescription(description) {
|
|
13
|
-
return description.replace(/^[\s\u2013\u2014-]+/, '').replace(/^[:\s]+/, '').trim();
|
|
23
|
+
return capitalizeFirstLetter(description.replace(/^[\s\u2013\u2014-]+/, '').replace(/^[:\s]+/, '').trim());
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
/** Strip basic markdown formatting to get plain text */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getPartsByType","getHeading","getImages","getLinks","parseWeb5Url","Web5UrlType","isWeb5EntityUrl","str","p","_p$content","content","trim","markdownOrText","_p$meta","meta","markdown","normalizeEntityDescription","description","replace","stripMarkdown","md","headingText","parts","level","heading","headingMarkdown","_meta$markdown","bodyText","textParts","richTextParts","map","filter","Boolean","join","inlineParagraphs","paragraphs","part","_part$meta","type","continuesNode","length","push","isLinkRow","paragraph","some","every","standaloneLinks","flat","paragraphsToMarkdown","inlinePartsToMarkdown","bodyMarkdown","proseBodyMarkdown","firstEntityLinkIndex","findIndex","_meta","isEntityHref","href","sectionParts","slice","entitySectionBodyText","_meta2","linksToHeroButtons","links","lists","flatMap","l","_l$meta","items","item","_item$meta","i","_l$content","id","text","variant","onClick","firstImageSrc","_img$meta","images","img","src","undefined","firstLink","_link$content","link","blockquoteText","bqs","_p$meta2","calloutFromParts","_p$meta3","calloutParts","raw","parsed","parseCalloutTag","kind","listToMarkdown","lines","list","_list$meta","extractListItemText","parseEntityUrl","url","trimmedUrl","ENTITY","entityType","entityId","parseTableValue","value","normalized","toLowerCase","parseKpiItem","trimmed","boldMatch","match","title","afterBold","indexOf","appendInlineToken","current","token","test","reduce","_part$meta2","_meta3","_part$content","label","_item$meta2","partsToMarkdown","inline","_part$meta3","_part$meta4","repeat","_list$meta2","_item$meta3","toUpperCase","generatePartId","Math","random","toString","extractNestedListItems","itemParts","nestedLists","features","nested","_list$meta3","extractEntityRefs","entities","_list$meta4","_item$meta4","entityLinks","_meta4","_link$content2","_images$","_p$content2","callout","_calloutParts$0$meta","parsed2","linkText","entityUrl","markdownImageUrl","markdownFeatures","topLinks","_l$meta2","e","_link$content3","linkIndex","j","_meta5","_p$content3","_meta6","_p$meta4","parsedCallout","_meta7"],"sources":["../../../../src/component/componentDefinitions/parse-utils.ts"],"sourcesContent":["import type {\n Part,\n ListPart,\n LinkPart,\n ListItemPart,\n ImagePart,\n} from '../../parts/parts';\nimport {\n getPartsByType,\n getHeading,\n getImages,\n getLinks,\n} from '../../parts/parts';\nimport { parseWeb5Url } from '../../utils/entityLinkParser';\nimport { Web5UrlType, isWeb5EntityUrl } from '../../types/link-types';\nimport type { Callout } from '../../types/callout';\nimport type { HeroButton } from '../types';\n\nfunction str(p: Part | undefined): string {\n return p?.content?.trim() ?? '';\n}\n\nfunction markdownOrText(p: Part): string {\n return ((p.meta?.markdown as string)?.trim() || str(p)).trim();\n}\n\nfunction normalizeEntityDescription(description: string): string {\n return description\n .replace(/^[\\s\\u2013\\u2014-]+/, '')\n .replace(/^[:\\s]+/, '')\n .trim();\n}\n\n/** Strip basic markdown formatting to get plain text */\nexport function stripMarkdown(md: string): string {\n return md\n .replace(/\\*\\*(.+?)\\*\\*/g, '$1')\n .replace(/__(.+?)__/g, '$1')\n .replace(/\\*(.+?)\\*/g, '$1')\n .replace(/_(.+?)_/g, '$1')\n .replace(/~~(.+?)~~/g, '$1')\n .replace(/`(.+?)`/g, '$1')\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1')\n .trim();\n}\n\nexport function headingText(parts: Part[], level?: number): string {\n const heading = getHeading(parts, level);\n return str(heading);\n}\n\n/** Like headingText but preserves inline markdown formatting (bold, italic, etc.) */\nexport function headingMarkdown(parts: Part[], level?: number): string {\n const heading = getHeading(parts, level);\n if (!heading) {\n return '';\n }\n const meta = heading.meta as Record<string, unknown>;\n return (meta?.markdown as string)?.trim() || str(heading);\n}\n\nexport function bodyText(parts: Part[]): string {\n const textParts = getPartsByType<Part>(parts, 'text');\n const richTextParts = getPartsByType<Part>(parts, 'richText');\n return [...textParts, ...richTextParts]\n .map(markdownOrText)\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Group a run of inline parts back into paragraphs.\n *\n * `astToParts` marks every part after the first of a given AST node with\n * `meta.continuesNode`, which is exactly \"same paragraph, keep going\". Parts\n * without it open a new paragraph.\n */\nfunction inlineParagraphs(parts: Part[]): Part[][] {\n const paragraphs: Part[][] = [];\n\n for (const part of parts) {\n if (\n part.type !== 'text' &&\n part.type !== 'richText' &&\n part.type !== 'link'\n ) {\n continue;\n }\n if (part.meta?.continuesNode && paragraphs.length > 0) {\n paragraphs[paragraphs.length - 1].push(part);\n } else {\n paragraphs.push([part]);\n }\n }\n\n return paragraphs;\n}\n\n/**\n * A paragraph that is nothing but links — the hero's button row under the h1,\n * the CTA after a comparison table. This is the one shape a section is entitled\n * to spend on a control instead of printing as copy, and its complement — a\n * link sharing its paragraph with a sentence — is body copy and nothing else.\n *\n * A blank part does not disqualify it. A hard line break between two links\n * (`[A](/a)··\\n[B](/b)`) leaves an empty `t` part behind, and an empty part is\n * not a sentence; without this the row is BOTH a button and a line of body\n * copy, which is the duplication the rule exists to prevent.\n */\nfunction isLinkRow(paragraph: Part[]): boolean {\n return (\n paragraph.some((part) => part.type === 'link') &&\n paragraph.every(\n (part) => part.type === 'link' || markdownOrText(part) === '',\n )\n );\n}\n\n/**\n * The links a section is entitled to render as its own control — a hero button\n * row, a CTA — as opposed to a link that is part of a sentence.\n *\n * The exact complement of what {@link proseBodyMarkdown} keeps, and that is the\n * point: between the two, every top-level link reaches the page exactly once.\n * `getLinks` is the wrong tool for a control slot — it takes EVERY top-level\n * link part, and a link inside a prose paragraph is a top-level part, so\n * `Email support@shop.example` (GFM autolinks a bare address, no author needed)\n * arrived as the hero's first and therefore PRIMARY button, displacing the real\n * call to action into the secondary slot and printing the address twice.\n */\nexport function standaloneLinks(parts: Part[]): LinkPart[] {\n return inlineParagraphs(parts)\n .filter(isLinkRow)\n .flat()\n .filter((part): part is LinkPart => part.type === 'link');\n}\n\nfunction paragraphsToMarkdown(paragraphs: Part[][]): string {\n return paragraphs\n .map(inlinePartsToMarkdown)\n .map((paragraph) => paragraph.trim())\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Body copy as markdown, with inline links intact and paragraph breaks kept.\n *\n * `bodyText` reads text parts only, so a paragraph carrying an inline link —\n * `Try narrowing to [men](web5://ask/…) instead` — arrives as `t + link + t`\n * and comes back as `\"Try narrowing to\\n\\ninstead\"`: label and url both\n * deleted, and the sentence broken in two at the gap. That is DL #134's list\n * bug in a different helper, and it is why an ask link in prose never reached\n * the page. A bare `support@shop.example` is the same bug with no author in\n * sight: GFM autolinks an email into a `link` node, so plain prose loses the\n * address.\n *\n * `inlinePartsToMarkdown` already rebuilds a run of inline parts with links\n * intact, but it flattens to one line, which is wrong for multi-paragraph\n * copy — hence `inlineParagraphs` first.\n *\n * This keeps EVERY link, including one standing alone as its own block. That\n * is right for `textBlock`, whose section consumes nothing but the copy. It is\n * wrong for a section that already spends its links elsewhere — see\n * {@link proseBodyMarkdown}.\n *\n * Kept separate from `bodyText` deliberately. Of the three callers still on\n * `bodyText`: `ErrorSectionDefinition` and `CtaBannerSectionDefinition` do\n * hand their result to a consumer that renders it raw (`ErrorSection` prints\n * the copy in a `<p>`, `CtaBannerSection` the same), so markdown there would\n * show a visitor a literal `[label](url)`. `FeatureSection9PlusDefinition` is\n * the odd one out: it has no registered renderer in either client bundle\n * (`createSdkRegistry` registers the definition with no component, and only\n * `createTestRegistry` gives it a stub), so its `description` reaches nothing\n * and there is no consumer to decide against. `FeatureCardsSectionDefinition`\n * used to be listed here as affected-but-unfixed; it now uses\n * {@link proseBodyMarkdown}.\n */\nexport function bodyMarkdown(parts: Part[]): string {\n return paragraphsToMarkdown(inlineParagraphs(parts));\n}\n\n/**\n * Body copy as markdown for a section that spends some of its links on another\n * slot — hero buttons, a comparison CTA, entity items.\n *\n * Same fix as {@link bodyMarkdown} for the case that matters — a link INSIDE a\n * sentence survives instead of being deleted with its label — but it drops the\n * two shapes those sections have already claimed, so nothing renders twice:\n *\n * - A paragraph that is nothing but links — {@link isLinkRow}.\n * `[Get started](/) [Learn more](/x)` under a hero h1 is the button row\n * `HeroSectionDefinition` turns into `buttons`; the trailing link after a\n * comparison table is its `ctaText` / `ctaHref`. Whole-paragraph is the right\n * test because a link that is part of a sentence always shares its paragraph\n * with the text around it. `HeroSectionDefinition` reads the same predicate\n * from the other side via {@link standaloneLinks}, so the two partition the\n * links rather than each deciding for itself.\n * - Everything from the first `web5://entity/…` link onward, which is item\n * copy rather than section copy — `HeroEntitySectionDefinition` reads those\n * links (and the text after each) into `items`. Same cut\n * {@link entitySectionBodyText} makes, for the same reason.\n *\n * Nothing is lost by either rule: the dropped links are exactly the ones the\n * section renders through some other prop.\n */\nexport function proseBodyMarkdown(parts: Part[]): string {\n const firstEntityLinkIndex = parts.findIndex(\n (p) => p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n const sectionParts =\n firstEntityLinkIndex >= 0 ? parts.slice(0, firstEntityLinkIndex) : parts;\n\n return paragraphsToMarkdown(\n inlineParagraphs(sectionParts).filter((paragraph) => !isLinkRow(paragraph)),\n );\n}\n\n/**\n * Entity sections may be authored as one paragraph per entity:\n * `[Product](web5://entity/...) - why it matches`.\n * In that shape, text after the first entity link is item copy rather than\n * section copy, so only keep prose that appears before the first entity link.\n */\nexport function entitySectionBodyText(parts: Part[]): string {\n const firstEntityLinkIndex = parts.findIndex(\n (p) => p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n const sectionParts =\n firstEntityLinkIndex >= 0 ? parts.slice(0, firstEntityLinkIndex) : parts;\n\n return sectionParts\n .filter((p) => p.type === 'text' || p.type === 'richText')\n .map(markdownOrText)\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Build HeroButton[] from link parts — aligned to HeroSection1Button shape.\n *\n * `standaloneLinks`, not `getLinks`, for the reason spelled out there: a link\n * in a sentence is body copy, not a button. Currently uncalled — kept on the\n * same rule as `HeroSectionDefinition` so wiring it up cannot reintroduce the\n * bug.\n */\nexport function linksToHeroButtons(parts: Part[]): HeroButton[] {\n let links: LinkPart[] = standaloneLinks(parts);\n if (!links.length) {\n const lists = getPartsByType<ListPart>(parts, 'list');\n links = lists.flatMap((l) =>\n (l.meta?.items ?? []).flatMap((item) =>\n ((item.meta?.parts ?? []) as Part[]).filter(\n (p): p is LinkPart => p.type === 'link',\n ),\n ),\n );\n }\n return links.map(\n (l, i): HeroButton => ({\n id: `btn-${i}`,\n text: l.content?.trim() || 'Learn more',\n variant: i === 0 ? 'primary' : 'secondary',\n onClick: l.meta.href,\n }),\n );\n}\n\n/** Return just the src URL string of the first image part */\nexport function firstImageSrc(parts: Part[]): string | undefined {\n const images = getImages(parts);\n const img = images[0];\n return img?.meta?.src || undefined;\n}\n\n/** Return the first link as { text, href } */\nexport function firstLink(\n parts: Part[],\n): { text: string; href: string } | undefined {\n const links = getLinks(parts);\n const link = links[0];\n if (!link) {\n return undefined;\n }\n return { text: link.content?.trim() || '', href: link.meta.href };\n}\n\n/** Extract text content from blockquote parts, preserving markdown formatting when available */\nexport function blockquoteText(parts: Part[]): string | undefined {\n const bqs = getPartsByType<Part>(parts, 'blockquote');\n if (bqs.length === 0) {\n return undefined;\n }\n const text = bqs\n .map((p) => (p.meta?.markdown as string)?.trim() || str(p))\n .filter(Boolean)\n .join('\\n');\n return text || undefined;\n}\n\n/** Extract first callout from parts as a Callout object */\nexport function calloutFromParts(parts: Part[]): Callout | undefined {\n const calloutParts = getPartsByType<Part>(parts, 'callout');\n if (calloutParts.length === 0) {\n return undefined;\n }\n const p = calloutParts[0];\n const raw = (p.meta?.markdown as string)?.trim() || str(p);\n const parsed = parseCalloutTag(raw);\n return parsed.text ? { text: parsed.text, kind: parsed.kind } : undefined;\n}\n\n/** Convert list parts to a markdown-like string */\nexport function listToMarkdown(parts: Part[]): string | undefined {\n const lists = getPartsByType<ListPart>(parts, 'list');\n if (lists.length === 0) {\n return undefined;\n }\n const lines: string[] = [];\n for (const list of lists) {\n const items = list.meta?.items ?? [];\n for (const item of items) {\n const text = extractListItemText(item);\n if (text) {\n lines.push(`- ${text}`);\n }\n }\n }\n return lines.length > 0 ? lines.join('\\n') : undefined;\n}\n\n/**\n * Parse a web5://entity/ URL into entityType and entityId.\n * Delegates to the central `parseWeb5Url` parser.\n */\nexport function parseEntityUrl(\n url: string,\n): { entityType: string; entityId: string } | null {\n const trimmedUrl = url?.trim();\n if (!trimmedUrl || !isWeb5EntityUrl(trimmedUrl)) {\n return null;\n }\n const parsed = parseWeb5Url(trimmedUrl);\n if (\n parsed?.type !== Web5UrlType.ENTITY ||\n !parsed.entityType ||\n !parsed.entityId\n ) {\n return null;\n }\n return { entityType: parsed.entityType, entityId: parsed.entityId };\n}\n\n/**\n * Parse a table cell value into boolean or string.\n * Ported from web50-server-ui comparisonSectionParser.tsx.\n */\nexport function parseTableValue(value: string): boolean | string {\n const normalized = value.trim().toLowerCase();\n\n if (\n normalized === 'true' ||\n normalized === 'yes' ||\n normalized === '✓' ||\n normalized === 'check' ||\n normalized === 'y'\n ) {\n return true;\n }\n if (\n normalized === 'false' ||\n normalized === 'no' ||\n normalized === '✗' ||\n normalized === 'x' ||\n normalized === 'n' ||\n normalized === ''\n ) {\n return false;\n }\n\n return value.trim();\n}\n\n/**\n * Parse a KPI item from markdown text.\n * The first **bold** segment becomes the title; everything after it (leading \":\" stripped) is the description.\n */\nexport function parseKpiItem(\n markdown: string,\n): { title: string; description: string } | null {\n const trimmed = markdown.trim();\n if (!trimmed) {\n return null;\n }\n const boldMatch = trimmed.match(/\\*\\*(.+?)\\*\\*/);\n if (!boldMatch) {\n return null;\n }\n const title = boldMatch[1].trim();\n const afterBold = trimmed.slice(\n trimmed.indexOf(boldMatch[0]) + boldMatch[0].length,\n );\n const description = afterBold.replace(/^[:\\s]+/, '').trim();\n return { title, description };\n}\n\n/** Join inline tokens the way prose reads: single spaces, none before punctuation. */\nfunction appendInlineToken(current: string, token: string): string {\n const trimmed = token.trim();\n if (!trimmed) {\n return current;\n }\n if (!current) {\n return trimmed;\n }\n if (/^[,.;:!?)]/.test(trimmed)) {\n return `${current}${trimmed}`;\n }\n return `${current} ${trimmed}`;\n}\n\n/**\n * Serialize a run of inline parts back to markdown, preserving links and\n * inline emphasis.\n *\n * Concatenating `part.content` alone silently deletes links: a `link` part\n * keeps its label in `content` and its url in `meta.href`, so a filter that\n * reads only text parts turns `Read the [pricing page](/pricing) first` into\n * `Read the first` — url and label both vanish, with nothing in the output to\n * show anything was lost.\n *\n * `content` is also the *plain* text of a text part — `nodesToParts` strips\n * inline formatting and keeps the original in `meta.markdown` whenever the two\n * differ. Reading `content` therefore drops emphasis the same way it used to\n * drop links: `The **4 oz size** is best` becomes `The 4 oz size is best`.\n * Prefer `meta.markdown`, which is exactly the segment's own markdown.\n */\nexport function inlinePartsToMarkdown(parts: Part[]): string {\n return parts.reduce((text, part) => {\n if (part.type === 'link') {\n const href = (part as LinkPart).meta?.href ?? '';\n const label = part.content?.trim() ?? '';\n return appendInlineToken(text, href ? `[${label}](${href})` : label);\n }\n return appendInlineToken(\n text,\n (part.meta?.markdown as string | undefined) ?? part.content ?? '',\n );\n }, '');\n}\n\nexport function extractListItemText(item: ListItemPart): string {\n if (item.content) {\n return item.content;\n }\n if (item.meta?.parts) {\n return (item.meta.parts as Part[])\n .map((p) => p.content)\n .filter(Boolean)\n .join(' ');\n }\n return '';\n}\n\n/**\n * Reconstruct markdown-like content from parts.\n *\n * `part.content` is the *plain* text — `nodesToParts` strips inline\n * formatting and preserves the original markdown (bold, italic, links) in\n * `part.meta.markdown` when they differ. Prefer it so markdown-rendering\n * consumers (e.g. the fallback section's ReactMarkdown) keep `**bold**`.\n */\nexport function partsToMarkdown(sectionParts: Part[]): string {\n const inline = (part: Part): string =>\n (part.meta?.markdown as string | undefined) ?? part.content;\n const lines: string[] = [];\n for (const part of sectionParts) {\n if (part.type === 'heading') {\n const level = (part.meta as { level: number })?.level ?? 2;\n lines.push(`${'#'.repeat(level)} ${inline(part)}`);\n } else if (part.type === 'text' || part.type === 'richText') {\n lines.push(inline(part));\n } else if (part.type === 'list') {\n const list = part as ListPart;\n for (const item of list.meta?.items ?? []) {\n lines.push(\n `- ${(item.meta?.markdown as string | undefined) ?? extractListItemText(item)}`,\n );\n }\n } else if (part.type === 'blockquote' || part.type === 'callout') {\n lines.push(`> ${inline(part)}`);\n }\n }\n return lines.join('\\n\\n');\n}\n\n/**\n * Extract callout kind tag from blockquote text.\n * Handles [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] GFM syntax.\n */\nexport function parseCalloutTag(text: string): { text: string; kind?: string } {\n const match = text.match(/^\\[!(\\w+)\\]\\s*(.*)/s);\n if (match) {\n return { kind: match[1].toUpperCase(), text: match[2].trim() };\n }\n return { text: text.trim() };\n}\n\n/** Generate a simple unique ID */\nexport function generatePartId(): string {\n return Math.random().toString(36).slice(2, 10);\n}\n\nfunction isEntityHref(href: string | undefined): boolean {\n return !!href && isWeb5EntityUrl(href);\n}\n\nexport interface EntityRef {\n entityId: string;\n entityType: string;\n linkText: string;\n entityUrl: string;\n description: string;\n markdownImageUrl?: string;\n markdownFeatures?: string[];\n callout?: Callout;\n}\n\n/**\n * Extract text from nested list items within a list item's parts.\n */\nfunction extractNestedListItems(itemParts: Part[]): string[] {\n const nestedLists = itemParts.filter((p): p is ListPart => p.type === 'list');\n const features: string[] = [];\n for (const list of nestedLists) {\n for (const nested of list.meta?.items ?? []) {\n const text = extractListItemText(nested);\n if (text) {\n features.push(text);\n }\n }\n }\n return features;\n}\n\n/**\n * Extract entity references from list items containing web5://entity/ links.\n * Also extracts markdownFeatures from nested list items within each entity item.\n */\nexport function extractEntityRefs(parts: Part[]): EntityRef[] {\n const entities: EntityRef[] = [];\n const lists = getPartsByType<ListPart>(parts, 'list');\n\n for (const list of lists) {\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const entityLinks = itemParts.filter(\n (p): p is LinkPart =>\n p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n\n for (const link of entityLinks) {\n const parsed = parseEntityUrl(link.meta.href);\n if (parsed) {\n const images = itemParts.filter(\n (p): p is ImagePart => p.type === 'image',\n );\n const textParts = itemParts.filter(\n (p) => p.type === 'text' && p.content?.trim(),\n );\n const description = normalizeEntityDescription(\n textParts.map(markdownOrText).join(' '),\n );\n const features = extractNestedListItems(itemParts);\n const calloutParts = itemParts.filter(\n (p) => p.type === 'callout' || p.type === 'blockquote',\n );\n let callout: Callout | undefined;\n if (calloutParts.length > 0) {\n const raw =\n (calloutParts[0].meta?.markdown as string)?.trim() ||\n str(calloutParts[0]);\n const parsed2 = parseCalloutTag(raw);\n if (parsed2.text) {\n callout = { text: parsed2.text, kind: parsed2.kind };\n }\n }\n entities.push({\n entityId: parsed.entityId,\n entityType: parsed.entityType,\n linkText: link.content?.trim() || '',\n entityUrl: link.meta.href,\n description,\n markdownImageUrl: images[0]?.meta?.src,\n markdownFeatures: features.length > 0 ? features : undefined,\n callout,\n });\n }\n }\n }\n }\n\n // Also check top-level links (with surrounding context for description/image/list)\n const topLinks = getLinks(parts).filter((l) => isEntityHref(l.meta?.href));\n for (const link of topLinks) {\n const parsed = parseEntityUrl(link.meta.href);\n if (parsed && !entities.some((e) => e.entityId === parsed.entityId)) {\n // Look for description text and image after this link in the parts array\n const linkIndex = parts.indexOf(link);\n let description = '';\n let markdownImageUrl: string | undefined;\n let callout: Callout | undefined;\n const features: string[] = [];\n\n if (linkIndex >= 0) {\n // Scan following parts for description, image, callout, and list items\n for (let j = linkIndex + 1; j < parts.length; j++) {\n const p = parts[j];\n // Stop at next entity link\n if (p.type === 'link' && isEntityHref((p as LinkPart).meta?.href)) {\n break;\n }\n if (p.type === 'text' && p.content?.trim()) {\n const text = markdownOrText(p);\n description = description\n ? `${description} ${text}`\n : text;\n } else if (p.type === 'image' && !markdownImageUrl) {\n markdownImageUrl = (p as ImagePart).meta?.src;\n } else if (\n (p.type === 'callout' || p.type === 'blockquote') &&\n !callout\n ) {\n const raw = (p.meta?.markdown as string)?.trim() || str(p);\n const parsedCallout = parseCalloutTag(raw);\n if (parsedCallout.text) {\n callout = { text: parsedCallout.text, kind: parsedCallout.kind };\n }\n } else if (p.type === 'list') {\n for (const item of (p as ListPart).meta?.items ?? []) {\n const text = extractListItemText(item);\n if (text) {\n features.push(text);\n }\n }\n }\n }\n }\n\n entities.push({\n entityId: parsed.entityId,\n entityType: parsed.entityType,\n linkText: link.content?.trim() || '',\n entityUrl: link.meta.href,\n description: normalizeEntityDescription(description),\n markdownImageUrl,\n markdownFeatures: features.length > 0 ? features : undefined,\n callout,\n });\n }\n }\n\n return entities;\n}\n"],"mappings":"AAOA,SACEA,cAAc,EACdC,UAAU,EACVC,SAAS,EACTC,QAAQ,QACH,mBAAmB;AAC1B,SAASC,YAAY,QAAQ,8BAA8B;AAC3D,SAASC,WAAW,EAAEC,eAAe,QAAQ,wBAAwB;AAIrE,SAASC,GAAGA,CAACC,CAAmB,EAAU;EAAA,IAAAC,UAAA;EACxC,OAAO,CAAAD,CAAC,aAAAC,UAAA,GAADD,CAAC,CAAEE,OAAO,qBAAVD,UAAA,CAAYE,IAAI,CAAC,CAAC,KAAI,EAAE;AACjC;AAEA,SAASC,cAAcA,CAACJ,CAAO,EAAU;EAAA,IAAAK,OAAA;EACvC,OAAO,CAAC,EAAAA,OAAA,GAACL,CAAC,CAACM,IAAI,cAAAD,OAAA,GAANA,OAAA,CAAQE,QAAQ,qBAAjBF,OAAA,CAA8BF,IAAI,CAAC,CAAC,KAAIJ,GAAG,CAACC,CAAC,CAAC,EAAEG,IAAI,CAAC,CAAC;AAChE;AAEA,SAASK,0BAA0BA,CAACC,WAAmB,EAAU;EAC/D,OAAOA,WAAW,CACfC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAClCA,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CACtBP,IAAI,CAAC,CAAC;AACX;;AAEA;AACA,OAAO,SAAS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,IAAI,CAAC,CAAC,KAAI,EAAE;QACpCmJ,SAAS,EAAE1E,IAAI,CAACtE,IAAI,CAAC0C,IAAI;QACzBvC,WAAW,EAAED,0BAA0B,CAACC,WAAW,CAAC;QACpD8I,gBAAgB;QAChBC,gBAAgB,EAAElB,QAAQ,CAACtG,MAAM,GAAG,CAAC,GAAGsG,QAAQ,GAAG7D,SAAS;QAC5DyE;MACF,CAAC,CAAC;IACJ;EACF;EAEA,OAAOR,QAAQ;AACjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["getPartsByType","getHeading","getImages","getLinks","parseWeb5Url","Web5UrlType","isWeb5EntityUrl","str","p","_p$content","content","trim","markdownOrText","_p$meta","meta","markdown","capitalizeFirstLetter","text","replace","match","lead","first","rest","test","toUpperCase","normalizeEntityDescription","description","stripMarkdown","md","headingText","parts","level","heading","headingMarkdown","_meta$markdown","bodyText","textParts","richTextParts","map","filter","Boolean","join","inlineParagraphs","paragraphs","part","_part$meta","type","continuesNode","length","push","isLinkRow","paragraph","some","every","standaloneLinks","flat","paragraphsToMarkdown","inlinePartsToMarkdown","bodyMarkdown","proseBodyMarkdown","firstEntityLinkIndex","findIndex","_meta","isEntityHref","href","sectionParts","slice","entitySectionBodyText","_meta2","linksToHeroButtons","links","lists","flatMap","l","_l$meta","items","item","_item$meta","i","_l$content","id","variant","onClick","firstImageSrc","_img$meta","images","img","src","undefined","firstLink","_link$content","link","blockquoteText","bqs","_p$meta2","calloutFromParts","_p$meta3","calloutParts","raw","parsed","parseCalloutTag","kind","listToMarkdown","lines","list","_list$meta","extractListItemText","parseEntityUrl","url","trimmedUrl","ENTITY","entityType","entityId","parseTableValue","value","normalized","toLowerCase","parseKpiItem","trimmed","boldMatch","title","afterBold","indexOf","appendInlineToken","current","token","reduce","_part$meta2","_meta3","_part$content","label","_item$meta2","partsToMarkdown","inline","_part$meta3","_part$meta4","repeat","_list$meta2","_item$meta3","generatePartId","Math","random","toString","extractNestedListItems","itemParts","nestedLists","features","nested","_list$meta3","extractEntityRefs","entities","_list$meta4","_item$meta4","entityLinks","_meta4","_link$content2","_images$","_p$content2","callout","_calloutParts$0$meta","parsed2","linkText","entityUrl","markdownImageUrl","markdownFeatures","topLinks","_l$meta2","e","_link$content3","linkIndex","j","_meta5","_p$content3","_meta6","_p$meta4","parsedCallout","_meta7"],"sources":["../../../../src/component/componentDefinitions/parse-utils.ts"],"sourcesContent":["import type {\n Part,\n ListPart,\n LinkPart,\n ListItemPart,\n ImagePart,\n} from '../../parts/parts';\nimport {\n getPartsByType,\n getHeading,\n getImages,\n getLinks,\n} from '../../parts/parts';\nimport { parseWeb5Url } from '../../utils/entityLinkParser';\nimport { Web5UrlType, isWeb5EntityUrl } from '../../types/link-types';\nimport type { Callout } from '../../types/callout';\nimport type { HeroButton } from '../types';\n\nfunction str(p: Part | undefined): string {\n return p?.content?.trim() ?? '';\n}\n\nfunction markdownOrText(p: Part): string {\n return ((p.meta?.markdown as string)?.trim() || str(p)).trim();\n}\n\n/**\n * The model does not reliably open an entity blurb with a capital, and a card\n * leads with that line. Leading markdown and punctuation (`**`, `_`, `[`,\n * quotes) are skipped so the first real letter is raised; a mixed-case first\n * word (`iPhone`, `eBay`) is left alone, since raising it misspells a name.\n */\nfunction capitalizeFirstLetter(text: string): string {\n return text.replace(\n /^([^\\p{L}\\p{N}]*)(\\p{Ll})(\\p{L}*)/u,\n (match, lead: string, first: string, rest: string) =>\n /\\p{Lu}/u.test(rest) ? match : `${lead}${first.toUpperCase()}${rest}`,\n );\n}\n\nfunction normalizeEntityDescription(description: string): string {\n return capitalizeFirstLetter(\n description\n .replace(/^[\\s\\u2013\\u2014-]+/, '')\n .replace(/^[:\\s]+/, '')\n .trim(),\n );\n}\n\n/** Strip basic markdown formatting to get plain text */\nexport function stripMarkdown(md: string): string {\n return md\n .replace(/\\*\\*(.+?)\\*\\*/g, '$1')\n .replace(/__(.+?)__/g, '$1')\n .replace(/\\*(.+?)\\*/g, '$1')\n .replace(/_(.+?)_/g, '$1')\n .replace(/~~(.+?)~~/g, '$1')\n .replace(/`(.+?)`/g, '$1')\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1')\n .trim();\n}\n\nexport function headingText(parts: Part[], level?: number): string {\n const heading = getHeading(parts, level);\n return str(heading);\n}\n\n/** Like headingText but preserves inline markdown formatting (bold, italic, etc.) */\nexport function headingMarkdown(parts: Part[], level?: number): string {\n const heading = getHeading(parts, level);\n if (!heading) {\n return '';\n }\n const meta = heading.meta as Record<string, unknown>;\n return (meta?.markdown as string)?.trim() || str(heading);\n}\n\nexport function bodyText(parts: Part[]): string {\n const textParts = getPartsByType<Part>(parts, 'text');\n const richTextParts = getPartsByType<Part>(parts, 'richText');\n return [...textParts, ...richTextParts]\n .map(markdownOrText)\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Group a run of inline parts back into paragraphs.\n *\n * `astToParts` marks every part after the first of a given AST node with\n * `meta.continuesNode`, which is exactly \"same paragraph, keep going\". Parts\n * without it open a new paragraph.\n */\nfunction inlineParagraphs(parts: Part[]): Part[][] {\n const paragraphs: Part[][] = [];\n\n for (const part of parts) {\n if (\n part.type !== 'text' &&\n part.type !== 'richText' &&\n part.type !== 'link'\n ) {\n continue;\n }\n if (part.meta?.continuesNode && paragraphs.length > 0) {\n paragraphs[paragraphs.length - 1].push(part);\n } else {\n paragraphs.push([part]);\n }\n }\n\n return paragraphs;\n}\n\n/**\n * A paragraph that is nothing but links — the hero's button row under the h1,\n * the CTA after a comparison table. This is the one shape a section is entitled\n * to spend on a control instead of printing as copy, and its complement — a\n * link sharing its paragraph with a sentence — is body copy and nothing else.\n *\n * A blank part does not disqualify it. A hard line break between two links\n * (`[A](/a)··\\n[B](/b)`) leaves an empty `t` part behind, and an empty part is\n * not a sentence; without this the row is BOTH a button and a line of body\n * copy, which is the duplication the rule exists to prevent.\n */\nfunction isLinkRow(paragraph: Part[]): boolean {\n return (\n paragraph.some((part) => part.type === 'link') &&\n paragraph.every(\n (part) => part.type === 'link' || markdownOrText(part) === '',\n )\n );\n}\n\n/**\n * The links a section is entitled to render as its own control — a hero button\n * row, a CTA — as opposed to a link that is part of a sentence.\n *\n * The exact complement of what {@link proseBodyMarkdown} keeps, and that is the\n * point: between the two, every top-level link reaches the page exactly once.\n * `getLinks` is the wrong tool for a control slot — it takes EVERY top-level\n * link part, and a link inside a prose paragraph is a top-level part, so\n * `Email support@shop.example` (GFM autolinks a bare address, no author needed)\n * arrived as the hero's first and therefore PRIMARY button, displacing the real\n * call to action into the secondary slot and printing the address twice.\n */\nexport function standaloneLinks(parts: Part[]): LinkPart[] {\n return inlineParagraphs(parts)\n .filter(isLinkRow)\n .flat()\n .filter((part): part is LinkPart => part.type === 'link');\n}\n\nfunction paragraphsToMarkdown(paragraphs: Part[][]): string {\n return paragraphs\n .map(inlinePartsToMarkdown)\n .map((paragraph) => paragraph.trim())\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Body copy as markdown, with inline links intact and paragraph breaks kept.\n *\n * `bodyText` reads text parts only, so a paragraph carrying an inline link —\n * `Try narrowing to [men](web5://ask/…) instead` — arrives as `t + link + t`\n * and comes back as `\"Try narrowing to\\n\\ninstead\"`: label and url both\n * deleted, and the sentence broken in two at the gap. That is DL #134's list\n * bug in a different helper, and it is why an ask link in prose never reached\n * the page. A bare `support@shop.example` is the same bug with no author in\n * sight: GFM autolinks an email into a `link` node, so plain prose loses the\n * address.\n *\n * `inlinePartsToMarkdown` already rebuilds a run of inline parts with links\n * intact, but it flattens to one line, which is wrong for multi-paragraph\n * copy — hence `inlineParagraphs` first.\n *\n * This keeps EVERY link, including one standing alone as its own block. That\n * is right for `textBlock`, whose section consumes nothing but the copy. It is\n * wrong for a section that already spends its links elsewhere — see\n * {@link proseBodyMarkdown}.\n *\n * Kept separate from `bodyText` deliberately. Of the three callers still on\n * `bodyText`: `ErrorSectionDefinition` and `CtaBannerSectionDefinition` do\n * hand their result to a consumer that renders it raw (`ErrorSection` prints\n * the copy in a `<p>`, `CtaBannerSection` the same), so markdown there would\n * show a visitor a literal `[label](url)`. `FeatureSection9PlusDefinition` is\n * the odd one out: it has no registered renderer in either client bundle\n * (`createSdkRegistry` registers the definition with no component, and only\n * `createTestRegistry` gives it a stub), so its `description` reaches nothing\n * and there is no consumer to decide against. `FeatureCardsSectionDefinition`\n * used to be listed here as affected-but-unfixed; it now uses\n * {@link proseBodyMarkdown}.\n */\nexport function bodyMarkdown(parts: Part[]): string {\n return paragraphsToMarkdown(inlineParagraphs(parts));\n}\n\n/**\n * Body copy as markdown for a section that spends some of its links on another\n * slot — hero buttons, a comparison CTA, entity items.\n *\n * Same fix as {@link bodyMarkdown} for the case that matters — a link INSIDE a\n * sentence survives instead of being deleted with its label — but it drops the\n * two shapes those sections have already claimed, so nothing renders twice:\n *\n * - A paragraph that is nothing but links — {@link isLinkRow}.\n * `[Get started](/) [Learn more](/x)` under a hero h1 is the button row\n * `HeroSectionDefinition` turns into `buttons`; the trailing link after a\n * comparison table is its `ctaText` / `ctaHref`. Whole-paragraph is the right\n * test because a link that is part of a sentence always shares its paragraph\n * with the text around it. `HeroSectionDefinition` reads the same predicate\n * from the other side via {@link standaloneLinks}, so the two partition the\n * links rather than each deciding for itself.\n * - Everything from the first `web5://entity/…` link onward, which is item\n * copy rather than section copy — `HeroEntitySectionDefinition` reads those\n * links (and the text after each) into `items`. Same cut\n * {@link entitySectionBodyText} makes, for the same reason.\n *\n * Nothing is lost by either rule: the dropped links are exactly the ones the\n * section renders through some other prop.\n */\nexport function proseBodyMarkdown(parts: Part[]): string {\n const firstEntityLinkIndex = parts.findIndex(\n (p) => p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n const sectionParts =\n firstEntityLinkIndex >= 0 ? parts.slice(0, firstEntityLinkIndex) : parts;\n\n return paragraphsToMarkdown(\n inlineParagraphs(sectionParts).filter((paragraph) => !isLinkRow(paragraph)),\n );\n}\n\n/**\n * Entity sections may be authored as one paragraph per entity:\n * `[Product](web5://entity/...) - why it matches`.\n * In that shape, text after the first entity link is item copy rather than\n * section copy, so only keep prose that appears before the first entity link.\n */\nexport function entitySectionBodyText(parts: Part[]): string {\n const firstEntityLinkIndex = parts.findIndex(\n (p) => p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n const sectionParts =\n firstEntityLinkIndex >= 0 ? parts.slice(0, firstEntityLinkIndex) : parts;\n\n return sectionParts\n .filter((p) => p.type === 'text' || p.type === 'richText')\n .map(markdownOrText)\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/**\n * Build HeroButton[] from link parts — aligned to HeroSection1Button shape.\n *\n * `standaloneLinks`, not `getLinks`, for the reason spelled out there: a link\n * in a sentence is body copy, not a button. Currently uncalled — kept on the\n * same rule as `HeroSectionDefinition` so wiring it up cannot reintroduce the\n * bug.\n */\nexport function linksToHeroButtons(parts: Part[]): HeroButton[] {\n let links: LinkPart[] = standaloneLinks(parts);\n if (!links.length) {\n const lists = getPartsByType<ListPart>(parts, 'list');\n links = lists.flatMap((l) =>\n (l.meta?.items ?? []).flatMap((item) =>\n ((item.meta?.parts ?? []) as Part[]).filter(\n (p): p is LinkPart => p.type === 'link',\n ),\n ),\n );\n }\n return links.map(\n (l, i): HeroButton => ({\n id: `btn-${i}`,\n text: l.content?.trim() || 'Learn more',\n variant: i === 0 ? 'primary' : 'secondary',\n onClick: l.meta.href,\n }),\n );\n}\n\n/** Return just the src URL string of the first image part */\nexport function firstImageSrc(parts: Part[]): string | undefined {\n const images = getImages(parts);\n const img = images[0];\n return img?.meta?.src || undefined;\n}\n\n/** Return the first link as { text, href } */\nexport function firstLink(\n parts: Part[],\n): { text: string; href: string } | undefined {\n const links = getLinks(parts);\n const link = links[0];\n if (!link) {\n return undefined;\n }\n return { text: link.content?.trim() || '', href: link.meta.href };\n}\n\n/** Extract text content from blockquote parts, preserving markdown formatting when available */\nexport function blockquoteText(parts: Part[]): string | undefined {\n const bqs = getPartsByType<Part>(parts, 'blockquote');\n if (bqs.length === 0) {\n return undefined;\n }\n const text = bqs\n .map((p) => (p.meta?.markdown as string)?.trim() || str(p))\n .filter(Boolean)\n .join('\\n');\n return text || undefined;\n}\n\n/** Extract first callout from parts as a Callout object */\nexport function calloutFromParts(parts: Part[]): Callout | undefined {\n const calloutParts = getPartsByType<Part>(parts, 'callout');\n if (calloutParts.length === 0) {\n return undefined;\n }\n const p = calloutParts[0];\n const raw = (p.meta?.markdown as string)?.trim() || str(p);\n const parsed = parseCalloutTag(raw);\n return parsed.text ? { text: parsed.text, kind: parsed.kind } : undefined;\n}\n\n/** Convert list parts to a markdown-like string */\nexport function listToMarkdown(parts: Part[]): string | undefined {\n const lists = getPartsByType<ListPart>(parts, 'list');\n if (lists.length === 0) {\n return undefined;\n }\n const lines: string[] = [];\n for (const list of lists) {\n const items = list.meta?.items ?? [];\n for (const item of items) {\n const text = extractListItemText(item);\n if (text) {\n lines.push(`- ${text}`);\n }\n }\n }\n return lines.length > 0 ? lines.join('\\n') : undefined;\n}\n\n/**\n * Parse a web5://entity/ URL into entityType and entityId.\n * Delegates to the central `parseWeb5Url` parser.\n */\nexport function parseEntityUrl(\n url: string,\n): { entityType: string; entityId: string } | null {\n const trimmedUrl = url?.trim();\n if (!trimmedUrl || !isWeb5EntityUrl(trimmedUrl)) {\n return null;\n }\n const parsed = parseWeb5Url(trimmedUrl);\n if (\n parsed?.type !== Web5UrlType.ENTITY ||\n !parsed.entityType ||\n !parsed.entityId\n ) {\n return null;\n }\n return { entityType: parsed.entityType, entityId: parsed.entityId };\n}\n\n/**\n * Parse a table cell value into boolean or string.\n * Ported from web50-server-ui comparisonSectionParser.tsx.\n */\nexport function parseTableValue(value: string): boolean | string {\n const normalized = value.trim().toLowerCase();\n\n if (\n normalized === 'true' ||\n normalized === 'yes' ||\n normalized === '✓' ||\n normalized === 'check' ||\n normalized === 'y'\n ) {\n return true;\n }\n if (\n normalized === 'false' ||\n normalized === 'no' ||\n normalized === '✗' ||\n normalized === 'x' ||\n normalized === 'n' ||\n normalized === ''\n ) {\n return false;\n }\n\n return value.trim();\n}\n\n/**\n * Parse a KPI item from markdown text.\n * The first **bold** segment becomes the title; everything after it (leading \":\" stripped) is the description.\n */\nexport function parseKpiItem(\n markdown: string,\n): { title: string; description: string } | null {\n const trimmed = markdown.trim();\n if (!trimmed) {\n return null;\n }\n const boldMatch = trimmed.match(/\\*\\*(.+?)\\*\\*/);\n if (!boldMatch) {\n return null;\n }\n const title = boldMatch[1].trim();\n const afterBold = trimmed.slice(\n trimmed.indexOf(boldMatch[0]) + boldMatch[0].length,\n );\n const description = afterBold.replace(/^[:\\s]+/, '').trim();\n return { title, description };\n}\n\n/** Join inline tokens the way prose reads: single spaces, none before punctuation. */\nfunction appendInlineToken(current: string, token: string): string {\n const trimmed = token.trim();\n if (!trimmed) {\n return current;\n }\n if (!current) {\n return trimmed;\n }\n if (/^[,.;:!?)]/.test(trimmed)) {\n return `${current}${trimmed}`;\n }\n return `${current} ${trimmed}`;\n}\n\n/**\n * Serialize a run of inline parts back to markdown, preserving links and\n * inline emphasis.\n *\n * Concatenating `part.content` alone silently deletes links: a `link` part\n * keeps its label in `content` and its url in `meta.href`, so a filter that\n * reads only text parts turns `Read the [pricing page](/pricing) first` into\n * `Read the first` — url and label both vanish, with nothing in the output to\n * show anything was lost.\n *\n * `content` is also the *plain* text of a text part — `nodesToParts` strips\n * inline formatting and keeps the original in `meta.markdown` whenever the two\n * differ. Reading `content` therefore drops emphasis the same way it used to\n * drop links: `The **4 oz size** is best` becomes `The 4 oz size is best`.\n * Prefer `meta.markdown`, which is exactly the segment's own markdown.\n */\nexport function inlinePartsToMarkdown(parts: Part[]): string {\n return parts.reduce((text, part) => {\n if (part.type === 'link') {\n const href = (part as LinkPart).meta?.href ?? '';\n const label = part.content?.trim() ?? '';\n return appendInlineToken(text, href ? `[${label}](${href})` : label);\n }\n return appendInlineToken(\n text,\n (part.meta?.markdown as string | undefined) ?? part.content ?? '',\n );\n }, '');\n}\n\nexport function extractListItemText(item: ListItemPart): string {\n if (item.content) {\n return item.content;\n }\n if (item.meta?.parts) {\n return (item.meta.parts as Part[])\n .map((p) => p.content)\n .filter(Boolean)\n .join(' ');\n }\n return '';\n}\n\n/**\n * Reconstruct markdown-like content from parts.\n *\n * `part.content` is the *plain* text — `nodesToParts` strips inline\n * formatting and preserves the original markdown (bold, italic, links) in\n * `part.meta.markdown` when they differ. Prefer it so markdown-rendering\n * consumers (e.g. the fallback section's ReactMarkdown) keep `**bold**`.\n */\nexport function partsToMarkdown(sectionParts: Part[]): string {\n const inline = (part: Part): string =>\n (part.meta?.markdown as string | undefined) ?? part.content;\n const lines: string[] = [];\n for (const part of sectionParts) {\n if (part.type === 'heading') {\n const level = (part.meta as { level: number })?.level ?? 2;\n lines.push(`${'#'.repeat(level)} ${inline(part)}`);\n } else if (part.type === 'text' || part.type === 'richText') {\n lines.push(inline(part));\n } else if (part.type === 'list') {\n const list = part as ListPart;\n for (const item of list.meta?.items ?? []) {\n lines.push(\n `- ${(item.meta?.markdown as string | undefined) ?? extractListItemText(item)}`,\n );\n }\n } else if (part.type === 'blockquote' || part.type === 'callout') {\n lines.push(`> ${inline(part)}`);\n }\n }\n return lines.join('\\n\\n');\n}\n\n/**\n * Extract callout kind tag from blockquote text.\n * Handles [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] GFM syntax.\n */\nexport function parseCalloutTag(text: string): { text: string; kind?: string } {\n const match = text.match(/^\\[!(\\w+)\\]\\s*(.*)/s);\n if (match) {\n return { kind: match[1].toUpperCase(), text: match[2].trim() };\n }\n return { text: text.trim() };\n}\n\n/** Generate a simple unique ID */\nexport function generatePartId(): string {\n return Math.random().toString(36).slice(2, 10);\n}\n\nfunction isEntityHref(href: string | undefined): boolean {\n return !!href && isWeb5EntityUrl(href);\n}\n\nexport interface EntityRef {\n entityId: string;\n entityType: string;\n linkText: string;\n entityUrl: string;\n description: string;\n markdownImageUrl?: string;\n markdownFeatures?: string[];\n callout?: Callout;\n}\n\n/**\n * Extract text from nested list items within a list item's parts.\n */\nfunction extractNestedListItems(itemParts: Part[]): string[] {\n const nestedLists = itemParts.filter((p): p is ListPart => p.type === 'list');\n const features: string[] = [];\n for (const list of nestedLists) {\n for (const nested of list.meta?.items ?? []) {\n const text = extractListItemText(nested);\n if (text) {\n features.push(text);\n }\n }\n }\n return features;\n}\n\n/**\n * Extract entity references from list items containing web5://entity/ links.\n * Also extracts markdownFeatures from nested list items within each entity item.\n */\nexport function extractEntityRefs(parts: Part[]): EntityRef[] {\n const entities: EntityRef[] = [];\n const lists = getPartsByType<ListPart>(parts, 'list');\n\n for (const list of lists) {\n for (const item of list.meta?.items ?? []) {\n const itemParts = (item.meta?.parts ?? []) as Part[];\n const entityLinks = itemParts.filter(\n (p): p is LinkPart =>\n p.type === 'link' && isEntityHref((p as LinkPart).meta?.href),\n );\n\n for (const link of entityLinks) {\n const parsed = parseEntityUrl(link.meta.href);\n if (parsed) {\n const images = itemParts.filter(\n (p): p is ImagePart => p.type === 'image',\n );\n const textParts = itemParts.filter(\n (p) => p.type === 'text' && p.content?.trim(),\n );\n const description = normalizeEntityDescription(\n textParts.map(markdownOrText).join(' '),\n );\n const features = extractNestedListItems(itemParts);\n const calloutParts = itemParts.filter(\n (p) => p.type === 'callout' || p.type === 'blockquote',\n );\n let callout: Callout | undefined;\n if (calloutParts.length > 0) {\n const raw =\n (calloutParts[0].meta?.markdown as string)?.trim() ||\n str(calloutParts[0]);\n const parsed2 = parseCalloutTag(raw);\n if (parsed2.text) {\n callout = { text: parsed2.text, kind: parsed2.kind };\n }\n }\n entities.push({\n entityId: parsed.entityId,\n entityType: parsed.entityType,\n linkText: link.content?.trim() || '',\n entityUrl: link.meta.href,\n description,\n markdownImageUrl: images[0]?.meta?.src,\n markdownFeatures: features.length > 0 ? features : undefined,\n callout,\n });\n }\n }\n }\n }\n\n // Also check top-level links (with surrounding context for description/image/list)\n const topLinks = getLinks(parts).filter((l) => isEntityHref(l.meta?.href));\n for (const link of topLinks) {\n const parsed = parseEntityUrl(link.meta.href);\n if (parsed && !entities.some((e) => e.entityId === parsed.entityId)) {\n // Look for description text and image after this link in the parts array\n const linkIndex = parts.indexOf(link);\n let description = '';\n let markdownImageUrl: string | undefined;\n let callout: Callout | undefined;\n const features: string[] = [];\n\n if (linkIndex >= 0) {\n // Scan following parts for description, image, callout, and list items\n for (let j = linkIndex + 1; j < parts.length; j++) {\n const p = parts[j];\n // Stop at next entity link\n if (p.type === 'link' && isEntityHref((p as LinkPart).meta?.href)) {\n break;\n }\n if (p.type === 'text' && p.content?.trim()) {\n const text = markdownOrText(p);\n description = description\n ? `${description} ${text}`\n : text;\n } else if (p.type === 'image' && !markdownImageUrl) {\n markdownImageUrl = (p as ImagePart).meta?.src;\n } else if (\n (p.type === 'callout' || p.type === 'blockquote') &&\n !callout\n ) {\n const raw = (p.meta?.markdown as string)?.trim() || str(p);\n const parsedCallout = parseCalloutTag(raw);\n if (parsedCallout.text) {\n callout = { text: parsedCallout.text, kind: parsedCallout.kind };\n }\n } else if (p.type === 'list') {\n for (const item of (p as ListPart).meta?.items ?? []) {\n const text = extractListItemText(item);\n if (text) {\n features.push(text);\n }\n }\n }\n }\n }\n\n entities.push({\n entityId: parsed.entityId,\n entityType: parsed.entityType,\n linkText: link.content?.trim() || '',\n entityUrl: link.meta.href,\n description: normalizeEntityDescription(description),\n markdownImageUrl,\n markdownFeatures: features.length > 0 ? features : undefined,\n callout,\n });\n }\n }\n\n return entities;\n}\n"],"mappings":"AAOA,SACEA,cAAc,EACdC,UAAU,EACVC,SAAS,EACTC,QAAQ,QACH,mBAAmB;AAC1B,SAASC,YAAY,QAAQ,8BAA8B;AAC3D,SAASC,WAAW,EAAEC,eAAe,QAAQ,wBAAwB;AAIrE,SAASC,GAAGA,CAACC,CAAmB,EAAU;EAAA,IAAAC,UAAA;EACxC,OAAO,CAAAD,CAAC,aAAAC,UAAA,GAADD,CAAC,CAAEE,OAAO,qBAAVD,UAAA,CAAYE,IAAI,CAAC,CAAC,KAAI,EAAE;AACjC;A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,CAACC,CAAC,CAAC;YAC1D,MAAMuK,aAAa,GAAG3E,eAAe,CAACF,GAAG,CAAC;YAC1C,IAAI6E,aAAa,CAAC9J,IAAI,EAAE;cACtB6I,OAAO,GAAG;gBAAE7I,IAAI,EAAE8J,aAAa,CAAC9J,IAAI;gBAAEoF,IAAI,EAAE0E,aAAa,CAAC1E;cAAK,CAAC;YAClE;UACF,CAAC,MAAM,IAAI7F,CAAC,CAACsC,IAAI,KAAK,MAAM,EAAE;YAC5B,KAAK,MAAM8B,IAAI,IAAI,EAAAoG,MAAA,GAACxK,CAAC,CAAcM,IAAI,qBAApBkK,MAAA,CAAsBrG,KAAK,KAAI,EAAE,EAAE;cAAA,IAAAqG,MAAA;cACpD,MAAM/J,IAAI,GAAGyF,mBAAmB,CAAC9B,IAAI,CAAC;cACtC,IAAI3D,IAAI,EAAE;gBACRiI,QAAQ,CAACjG,IAAI,CAAChC,IAAI,CAAC;cACrB;YACF;UACF;QACF;MACF;MAEAqI,QAAQ,CAACrG,IAAI,CAAC;QACZ+D,QAAQ,EAAEb,MAAM,CAACa,QAAQ;QACzBD,UAAU,EAAEZ,MAAM,CAACY,UAAU;QAC7BkD,QAAQ,EAAE,EAAAO,cAAA,GAAA7E,IAAI,CAACjF,OAAO,qBAAZ8J,cAAA,CAAc7J,IAAI,CAAC,CAAC,KAAI,EAAE;QACpCuJ,SAAS,EAAEvE,IAAI,CAAC7E,IAAI,CAACkD,IAAI;QACzBtC,WAAW,EAAED,0BAA0B,CAACC,WAAW,CAAC;QACpDyI,gBAAgB;QAChBC,gBAAgB,EAAElB,QAAQ,CAAClG,MAAM,GAAG,CAAC,GAAGkG,QAAQ,GAAG1D,SAAS;QAC5DsE;MACF,CAAC,CAAC;IACJ;EACF;EAEA,OAAOR,QAAQ;AACjB","ignoreList":[]}
|
package/dist/types/component/componentDefinitions/EntityCollectionSectionDefinition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityCollectionSectionDefinition.d.ts","sourceRoot":"","sources":["../../../../src/component/componentDefinitions/EntityCollectionSectionDefinition.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EACV,eAAe,EAEf,sBAAsB,EACtB,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAS7E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,iCACX,YAAW,iBAAiB,CAAC,sBAAsB,CAAC;IAEpD,WAAW,qBAA+B;IAC1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,WAEN;IAEF,QAAQ,EAAE,eAAe,CAUvB;IAEF,QAAQ,EAAE,cAAc,CAAC,eAAe,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"EntityCollectionSectionDefinition.d.ts","sourceRoot":"","sources":["../../../../src/component/componentDefinitions/EntityCollectionSectionDefinition.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EACV,eAAe,EAEf,sBAAsB,EACtB,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAS7E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,iCACX,YAAW,iBAAiB,CAAC,sBAAsB,CAAC;IAEpD,WAAW,qBAA+B;IAC1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,WAEN;IAEF,QAAQ,EAAE,eAAe,CAUvB;IAEF,QAAQ,EAAE,cAAc,CAAC,eAAe,CAAC,EAAE,CAqEzC;IAEF,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,eAAe,GAAG,IAAI;CAyCrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-utils.d.ts","sourceRoot":"","sources":["../../../../src/component/componentDefinitions/parse-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EAEJ,QAAQ,EACR,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-utils.d.ts","sourceRoot":"","sources":["../../../../src/component/componentDefinitions/parse-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EAEJ,QAAQ,EACR,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAiC3C,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAGjE;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAOrE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAO9C;AAkDD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,CAKzD;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAElD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iB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AAE,IAAI,EAAE,GAAG,MAAM,CAY3D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAW9D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,IAAI,EAAE,GAAG,MAAM,CAsB5D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAM7E;AAED,kCAAkC;AAClC,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAMD,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAmBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,CAkH5D"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/web5-core",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.63.
|
|
4
|
+
"version": "1.63.41",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tsachis",
|
|
7
7
|
"email": "tsachis@wix.com"
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"wallaby": {
|
|
101
101
|
"autoDetect": true
|
|
102
102
|
},
|
|
103
|
-
"falconPackageHash": "
|
|
103
|
+
"falconPackageHash": "e7f27290f0e50355820890145626fc8dabe58e16f2ad521272d70849"
|
|
104
104
|
}
|