@wix/web5-core 1.63.29 → 1.63.31
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/ComparisonSectionDefinition.js +1 -1
- package/dist/cjs/component/componentDefinitions/ComparisonSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js +1 -1
- package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js +1 -1
- package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/NextStepsSectionDefinition.js +2 -2
- package/dist/cjs/component/componentDefinitions/NextStepsSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/parse-utils.js +87 -30
- package/dist/cjs/component/componentDefinitions/parse-utils.js.map +1 -1
- package/dist/cjs/entity/defaultExtractor.js +2 -1
- package/dist/cjs/entity/defaultExtractor.js.map +1 -1
- package/dist/cjs/entity/enrichEntitiesFromPayload.js +4 -2
- package/dist/cjs/entity/enrichEntitiesFromPayload.js.map +1 -1
- package/dist/cjs/entity/entityFamily.js +27 -0
- package/dist/cjs/entity/entityFamily.js.map +1 -1
- package/dist/cjs/entity/entityTypeDefaults.js +68 -0
- package/dist/cjs/entity/entityTypeDefaults.js.map +1 -0
- package/dist/cjs/entity/index.js +7 -3
- package/dist/cjs/entity/index.js.map +1 -1
- package/dist/cjs/index.js +7 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/component/componentDefinitions/ComparisonSectionDefinition.js +2 -2
- package/dist/esm/component/componentDefinitions/ComparisonSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js +2 -2
- package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js +2 -2
- package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/NextStepsSectionDefinition.js +3 -3
- package/dist/esm/component/componentDefinitions/NextStepsSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/parse-utils.js +86 -30
- package/dist/esm/component/componentDefinitions/parse-utils.js.map +1 -1
- package/dist/esm/entity/defaultExtractor.js +2 -1
- package/dist/esm/entity/defaultExtractor.js.map +1 -1
- package/dist/esm/entity/enrichEntitiesFromPayload.js +4 -2
- package/dist/esm/entity/enrichEntitiesFromPayload.js.map +1 -1
- package/dist/esm/entity/entityFamily.js +26 -0
- package/dist/esm/entity/entityFamily.js.map +1 -1
- package/dist/esm/entity/entityTypeDefaults.js +63 -0
- package/dist/esm/entity/entityTypeDefaults.js.map +1 -0
- package/dist/esm/entity/index.js +2 -1
- package/dist/esm/entity/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/component/componentDefinitions/parse-utils.d.ts +41 -7
- package/dist/types/component/componentDefinitions/parse-utils.d.ts.map +1 -1
- package/dist/types/entity/defaultExtractor.d.ts.map +1 -1
- package/dist/types/entity/enrichEntitiesFromPayload.d.ts +2 -1
- package/dist/types/entity/enrichEntitiesFromPayload.d.ts.map +1 -1
- package/dist/types/entity/entityFamily.d.ts +7 -0
- package/dist/types/entity/entityFamily.d.ts.map +1 -1
- package/dist/types/entity/entityTypeDefaults.d.ts +38 -0
- package/dist/types/entity/entityTypeDefaults.d.ts.map +1 -0
- package/dist/types/entity/index.d.ts +2 -1
- package/dist/types/entity/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -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","bodyMarkdown","paragraphs","part","_part$meta","type","continuesNode","length","push","inlinePartsToMarkdown","paragraph","entitySectionBodyText","firstEntityLinkIndex","findIndex","_meta","isEntityHref","href","sectionParts","slice","linksToHeroButtons","links","getLinks","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","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","_meta2","_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","_meta3","_link$content2","_images$","_p$content2","callout","_calloutParts$0$meta","parsed2","linkText","entityUrl","markdownImageUrl","markdownFeatures","topLinks","_l$meta2","some","e","_link$content3","linkIndex","j","_meta4","_p$content3","_meta5","_p$meta4","parsedCallout","_meta6"],"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 * 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.\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. So group first: `astToParts` marks every part after the first of a\n * given AST node with `meta.continuesNode`, which is exactly \"same paragraph,\n * keep going\". Parts without it open a new paragraph.\n *\n * Kept separate from `bodyText` deliberately — the other seven callers hand\n * their result to consumers that do not render markdown, and would show a\n * visitor a raw `[label](url)`.\n */\nexport function bodyMarkdown(parts: Part[]): string {\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 .map(inlinePartsToMarkdown)\n .map((paragraph) => paragraph.trim())\n .filter(Boolean)\n .join('\\n\\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/** Build HeroButton[] from link parts — aligned to HeroSection1Button shape */\nexport function linksToHeroButtons(parts: Part[]): HeroButton[] {\n let links = getLinks(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;\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G2B,mBAAmB,CAAChC,IAAI,CAAC;cACtC,IAAIK,IAAI,EAAE;gBACRyE,QAAQ,CAACjG,IAAI,CAACwB,IAAI,CAAC;cACrB;YACF;UACF;QACF;MACF;MAEA6E,QAAQ,CAACrG,IAAI,CAAC;QACZ4D,QAAQ,EAAEhB,MAAM,CAACgB,QAAQ;QACzBD,UAAU,EAAEf,MAAM,CAACe,UAAU;QAC7BqD,QAAQ,EAAE,EAAAQ,cAAA,GAAApF,IAAI,CAACrE,OAAO,qBAAZyJ,cAAA,CAAcxJ,IAAI,CAAC,CAAC,KAAI,EAAE;QACpCiJ,SAAS,EAAE7E,IAAI,CAACjE,IAAI,CAACqC,IAAI;QACzBlC,WAAW,EAAED,0BAA0B,CAACC,WAAW,CAAC;QACpD4I,gBAAgB;QAChBC,gBAAgB,EAAElB,QAAQ,CAAClG,MAAM,GAAG,CAAC,GAAGkG,QAAQ,GAAGhE,SAAS;QAC5D4E;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","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","paragraphsToMarkdown","inlinePartsToMarkdown","paragraph","bodyMarkdown","proseBodyMarkdown","firstEntityLinkIndex","findIndex","_meta","isEntityHref","href","sectionParts","slice","every","entitySectionBodyText","_meta2","linksToHeroButtons","links","getLinks","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","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","some","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\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, but not for the reason this\n * comment used to give. Of the four callers still on `bodyText`:\n * `ErrorSectionDefinition` and `CtaBannerSectionDefinition` do hand their\n * result to a consumer that renders it raw (`ErrorSection` prints the copy in\n * a `<p>`, `CtaBannerSection` the same), so markdown there would show a\n * visitor a literal `[label](url)`. `FeatureCardsSectionDefinition` does NOT —\n * both `FeatureCardsSection` renderers in this repo put `card.description`\n * through `MarkdownText`, so it loses inline links exactly like the sections\n * fixed here; it is left alone only because its callers were not verified end\n * to end. `FeatureSection9PlusDefinition` has no registered renderer at all.\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. `[Get started](/) [Learn more](/x)`\n * under a hero h1 is the button row `HeroSectionDefinition` turns into\n * `buttons`; the trailing link after a comparison table is its `ctaText` /\n * `ctaHref`. Whole-paragraph is the right test because a link that is part\n * of a sentence always shares its paragraph with the text around it.\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(\n (paragraph) => !paragraph.every((part) => part.type === 'link'),\n ),\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/** Build HeroButton[] from link parts — aligned to HeroSection1Button shape */\nexport function linksToHeroButtons(parts: Part[]): HeroButton[] {\n let links = getLinks(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;EACx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W,EAAED,0BAA0B,CAACC,WAAW,CAAC;QACpDiJ,gBAAgB;QAChBC,gBAAgB,EAAElB,QAAQ,CAACvG,MAAM,GAAG,CAAC,GAAGuG,QAAQ,GAAGhE,SAAS;QAC5D4E;MACF,CAAC,CAAC;IACJ;EACF;EAEA,OAAOR,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ exports.defaultExtractor = void 0;
|
|
|
5
5
|
exports.transformToBlogPostEntityData = transformToBlogPostEntityData;
|
|
6
6
|
exports.transformToGenericEntityData = transformToGenericEntityData;
|
|
7
7
|
exports.transformToSolutionEntityData = transformToSolutionEntityData;
|
|
8
|
+
var _entityTypeDefaults = require("./entityTypeDefaults");
|
|
8
9
|
var _linkTypes = require("../types/link-types");
|
|
9
10
|
var _entityLinkParser = require("../utils/entityLinkParser");
|
|
10
11
|
var _matchedVariant = require("./matchedVariant");
|
|
@@ -49,7 +50,7 @@ function matchesUrl(payloadItem, entityId, config) {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
function findEntityInPayload(entityType, entityId, payload, entityConfig) {
|
|
52
|
-
const typeConfig = entityConfig
|
|
53
|
+
const typeConfig = (0, _entityTypeDefaults.resolveEntityTypeConfig)(entityConfig, entityType);
|
|
53
54
|
if (!typeConfig) {
|
|
54
55
|
return null;
|
|
55
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_linkTypes","require","_entityLinkParser","_matchedVariant","extractEntityIdFromUrl","entityUrl","trimmedUrl","trim","isWeb5EntityUrl","parsed","parseWeb5Url","type","Web5UrlType","ENTITY","entityType","entityId","matchesUrl","payloadItem","config","id","urlValue","urlMatchProperty","pattern","urlMatchPattern","endsWith","includes","findEntityInPayload","payload","entityConfig","typeConfig","entityTypes","matchedItem","find","item","transformToSolutionEntityData","transformToGenericEntityData","formatEntityDate","timestamp","_parts$find","_parts$find2","_parts$find3","date","Date","isNaN","getTime","undefined","formatter","Intl","DateTimeFormat","day","month","timeZone","year","parts","formatToParts","part","value","transformToBlogPostEntityData","_payloadItem$labels","_payloadItem$tags","imageUrl","publishTimestamp","publishDate","published_at","img","imgAlreadyAbsolute","startsWith","imageBaseUrl","currency","readCurrencyCode","priceCurrency","url","title","description","excerpt","matchedOptions","toMatchedOptions","options","variantId","price","formatPriceField","priceMin","priceMax","update_ts","author","authorName","cmsItemId","cms_item_id","usage","tags","labels","length","defaultExtractor","exports"],"sources":["../../../src/entity/defaultExtractor.ts"],"sourcesContent":["import type { SolutionEntityData, BlogEntityData, EntityItemData } from '../component/types';\nimport type {\n ApiPayloadItem,\n EntityConfig,\n EntityTypeConfig,\n} from '../types/entity';\nimport type { EntityExtractor } from './types';\nimport { Web5UrlType, isWeb5EntityUrl } from '../types/link-types';\nimport { parseWeb5Url } from '../utils/entityLinkParser';\nimport {\n formatPriceField,\n readCurrencyCode,\n toMatchedOptions,\n} from './matchedVariant';\n\n/**\n * Extract entity type and ID from a web5://entity/ URL.\n * Delegates to the central `parseWeb5Url` parser.\n */\nfunction extractEntityIdFromUrl(\n entityUrl: string,\n): { entityType: string; entityId: string } | null {\n const trimmedUrl = entityUrl?.trim();\n if (!trimmedUrl || !isWeb5EntityUrl(trimmedUrl)) {\n return null;\n }\n const parsed = parseWeb5Url(trimmedUrl);\n if (parsed?.type !== Web5UrlType.ENTITY || !parsed.entityType || !parsed.entityId) {\n return null;\n }\n return { entityType: parsed.entityType, entityId: parsed.entityId };\n}\n\nfunction matchesUrl(\n payloadItem: ApiPayloadItem,\n entityId: string,\n config: EntityTypeConfig,\n): boolean {\n // Entities resolve by `entityId` (the `<id>` in `web5://entity/<type>/<id>`).\n // Accept a direct `id` match, then fall back to the configured url strategy.\n if (payloadItem.id === entityId) {\n return true;\n }\n\n const urlValue = payloadItem[config.urlMatchProperty as keyof ApiPayloadItem];\n\n if (typeof urlValue !== 'string') {\n return false;\n }\n\n const pattern = config.urlMatchPattern || 'endsWith';\n\n switch (pattern) {\n case 'endsWith':\n return urlValue.endsWith(`/${entityId}`);\n case 'contains':\n return urlValue.includes(entityId);\n case 'equals':\n return urlValue === entityId;\n default:\n return urlValue.endsWith(`/${entityId}`);\n }\n}\n\nfunction findEntityInPayload(\n entityType: string,\n entityId: string,\n payload: ApiPayloadItem[],\n entityConfig: EntityConfig,\n): ApiPayloadItem | null {\n const typeConfig = entityConfig.entityTypes[entityType];\n\n if (!typeConfig) {\n return null;\n }\n\n // Resolution keys off `entityId` (not the type): find the payload item whose\n // id/url matches, using the type's configured url strategy.\n const matchedItem = payload.find((item) =>\n matchesUrl(item, entityId, typeConfig),\n );\n\n return matchedItem || null;\n}\n\n/** @deprecated Use transformToGenericEntityData */\nexport function transformToSolutionEntityData(\n payloadItem: ApiPayloadItem,\n config: EntityTypeConfig,\n): SolutionEntityData {\n return transformToGenericEntityData(payloadItem, config);\n}\n\nfunction formatEntityDate(timestamp: string): string | undefined {\n const date = new Date(timestamp);\n if (isNaN(date.getTime())) {\n return undefined;\n }\n const formatter = new Intl.DateTimeFormat('en-US', {\n day: 'numeric',\n month: 'short',\n timeZone: 'Europe/Kiev',\n year: 'numeric',\n });\n const parts = formatter.formatToParts(date);\n const day = parts.find((part) => part.type === 'day')?.value;\n const month = parts.find((part) => part.type === 'month')?.value;\n const year = parts.find((part) => part.type === 'year')?.value;\n\n if (!day || !month || !year) {\n return undefined;\n }\n\n return `${day} ${month} ${year}`;\n}\n\n/** @deprecated Use transformToGenericEntityData */\nexport function transformToBlogPostEntityData(\n payloadItem: ApiPayloadItem,\n config: EntityTypeConfig,\n): BlogEntityData {\n return transformToGenericEntityData(payloadItem, config);\n}\n\nexport function transformToGenericEntityData(\n payloadItem: ApiPayloadItem,\n config: EntityTypeConfig,\n): EntityItemData {\n let imageUrl: string | undefined;\n const publishTimestamp = payloadItem.publishDate || payloadItem.published_at;\n\n if (payloadItem.img) {\n const imgAlreadyAbsolute = payloadItem.img.startsWith('http');\n imageUrl = config.imageBaseUrl && !imgAlreadyAbsolute\n ? `${config.imageBaseUrl}${payloadItem.img}`\n : payloadItem.img;\n }\n\n // A document that retrieval narrowed to one child arrives with that child's\n // presentation fields already overlaid (`url`, `img`, `price`) plus the pairs\n // that identify it and the span its parent covers. The overlay is done\n // server-side; all that is left here is to shape those two for display.\n const currency = readCurrencyCode(\n payloadItem.currency,\n payloadItem.priceCurrency,\n );\n\n return {\n url: payloadItem.url,\n title: payloadItem.title,\n type: payloadItem.type,\n description: payloadItem.description,\n excerpt: payloadItem.excerpt,\n imageUrl,\n matchedOptions: toMatchedOptions(payloadItem.options),\n // Which child the row is wearing. Carried through so the live enricher\n // prices THAT variant (`mergeShopifyEntityData` keeps the turn's value)\n // rather than falling back to the product's default.\n variantId: payloadItem.variantId,\n price: formatPriceField(payloadItem.price, currency),\n priceMin: formatPriceField(payloadItem.priceMin, currency),\n priceMax: formatPriceField(payloadItem.priceMax, currency),\n date: payloadItem.update_ts\n ? formatEntityDate(payloadItem.update_ts)\n : undefined,\n publishDate: publishTimestamp\n ? formatEntityDate(publishTimestamp)\n : undefined,\n author: payloadItem.author || payloadItem.authorName,\n cmsItemId: payloadItem.cms_item_id,\n usage: payloadItem.usage,\n tags: payloadItem.labels?.length\n ? payloadItem.labels\n : payloadItem.tags?.length\n ? payloadItem.tags\n : undefined,\n };\n}\n\n/**\n * Default entity extractor - config-driven extraction for any client.\n * Uses entityConfig from client JSON to resolve web5://entity/ URLs against API payload.\n */\nexport const defaultExtractor: EntityExtractor = {\n extractEntityIdFromUrl,\n findEntityInPayload,\n};\n"],"mappings":";;;;;;;AAOA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAMA;AACA;AACA;AACA;AACA,SAASG,sBAAsBA,CAC7BC,SAAiB,EACgC;EACjD,MAAMC,UAAU,GAAGD,SAAS,oBAATA,SAAS,CAAEE,IAAI,CAAC,CAAC;EACpC,IAAI,CAACD,UAAU,IAAI,CAAC,IAAAE,0BAAe,EAACF,UA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AE7D,WAAW,CAAC6D,SAAS;IAChCC,KAAK,EAAE,IAAAC,gCAAgB,EAAC/D,WAAW,CAAC8D,KAAK,EAAEX,QAAQ,CAAC;IACpDa,QAAQ,EAAE,IAAAD,gCAAgB,EAAC/D,WAAW,CAACgE,QAAQ,EAAEb,QAAQ,CAAC;IAC1Dc,QAAQ,EAAE,IAAAF,gCAAgB,EAAC/D,WAAW,CAACiE,QAAQ,EAAEd,QAAQ,CAAC;IAC1D3B,IAAI,EAAExB,WAAW,CAACkE,SAAS,GACvB/C,gBAAgB,CAACnB,WAAW,CAACkE,SAAS,CAAC,GACvCtC,SAAS;IACbiB,WAAW,EAAED,gBAAgB,GACzBzB,gBAAgB,CAACyB,gBAAgB,CAAC,GAClChB,SAAS;IACbuC,MAAM,EAAEnE,WAAW,CAACmE,MAAM,IAAInE,WAAW,CAACoE,UAAU;IACpDC,SAAS,EAAErE,WAAW,CAACsE,WAAW;IAClCC,KAAK,EAAEvE,WAAW,CAACuE,KAAK;IACxBC,IAAI,EAAE,CAAA/B,mBAAA,GAAAzC,WAAW,CAACyE,MAAM,aAAlBhC,mBAAA,CAAoBiC,MAAM,GAC5B1E,WAAW,CAACyE,MAAM,GAClB,CAAA/B,iBAAA,GAAA1C,WAAW,CAACwE,IAAI,aAAhB9B,iBAAA,CAAkBgC,MAAM,GACxB1E,WAAW,CAACwE,IAAI,GAChB5C;EACN,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACO,MAAM+C,gBAAiC,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC/CxF,sBAAsB;EACtBsB;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_entityTypeDefaults","require","_linkTypes","_entityLinkParser","_matchedVariant","extractEntityIdFromUrl","entityUrl","trimmedUrl","trim","isWeb5EntityUrl","parsed","parseWeb5Url","type","Web5UrlType","ENTITY","entityType","entityId","matchesUrl","payloadItem","config","id","urlValue","urlMatchProperty","pattern","urlMatchPattern","endsWith","includes","findEntityInPayload","payload","entityConfig","typeConfig","resolveEntityTypeConfig","matchedItem","find","item","transformToSolutionEntityData","transformToGenericEntityData","formatEntityDate","timestamp","_parts$find","_parts$find2","_parts$find3","date","Date","isNaN","getTime","undefined","formatter","Intl","DateTimeFormat","day","month","timeZone","year","parts","formatToParts","part","value","transformToBlogPostEntityData","_payloadItem$labels","_payloadItem$tags","imageUrl","publishTimestamp","publishDate","published_at","img","imgAlreadyAbsolute","startsWith","imageBaseUrl","currency","readCurrencyCode","priceCurrency","url","title","description","excerpt","matchedOptions","toMatchedOptions","options","variantId","price","formatPriceField","priceMin","priceMax","update_ts","author","authorName","cmsItemId","cms_item_id","usage","tags","labels","length","defaultExtractor","exports"],"sources":["../../../src/entity/defaultExtractor.ts"],"sourcesContent":["import type { SolutionEntityData, BlogEntityData, EntityItemData } from '../component/types';\nimport type {\n ApiPayloadItem,\n EntityConfig,\n EntityTypeConfig,\n} from '../types/entity';\nimport type { EntityExtractor } from './types';\nimport { resolveEntityTypeConfig } from './entityTypeDefaults';\nimport { Web5UrlType, isWeb5EntityUrl } from '../types/link-types';\nimport { parseWeb5Url } from '../utils/entityLinkParser';\nimport {\n formatPriceField,\n readCurrencyCode,\n toMatchedOptions,\n} from './matchedVariant';\n\n/**\n * Extract entity type and ID from a web5://entity/ URL.\n * Delegates to the central `parseWeb5Url` parser.\n */\nfunction extractEntityIdFromUrl(\n entityUrl: string,\n): { entityType: string; entityId: string } | null {\n const trimmedUrl = entityUrl?.trim();\n if (!trimmedUrl || !isWeb5EntityUrl(trimmedUrl)) {\n return null;\n }\n const parsed = parseWeb5Url(trimmedUrl);\n if (parsed?.type !== Web5UrlType.ENTITY || !parsed.entityType || !parsed.entityId) {\n return null;\n }\n return { entityType: parsed.entityType, entityId: parsed.entityId };\n}\n\nfunction matchesUrl(\n payloadItem: ApiPayloadItem,\n entityId: string,\n config: EntityTypeConfig,\n): boolean {\n // Entities resolve by `entityId` (the `<id>` in `web5://entity/<type>/<id>`).\n // Accept a direct `id` match, then fall back to the configured url strategy.\n if (payloadItem.id === entityId) {\n return true;\n }\n\n const urlValue = payloadItem[config.urlMatchProperty as keyof ApiPayloadItem];\n\n if (typeof urlValue !== 'string') {\n return false;\n }\n\n const pattern = config.urlMatchPattern || 'endsWith';\n\n switch (pattern) {\n case 'endsWith':\n return urlValue.endsWith(`/${entityId}`);\n case 'contains':\n return urlValue.includes(entityId);\n case 'equals':\n return urlValue === entityId;\n default:\n return urlValue.endsWith(`/${entityId}`);\n }\n}\n\nfunction findEntityInPayload(\n entityType: string,\n entityId: string,\n payload: ApiPayloadItem[],\n entityConfig: EntityConfig,\n): ApiPayloadItem | null {\n const typeConfig = resolveEntityTypeConfig(entityConfig, entityType);\n\n if (!typeConfig) {\n return null;\n }\n\n // Resolution keys off `entityId` (not the type): find the payload item whose\n // id/url matches, using the type's configured url strategy.\n const matchedItem = payload.find((item) =>\n matchesUrl(item, entityId, typeConfig),\n );\n\n return matchedItem || null;\n}\n\n/** @deprecated Use transformToGenericEntityData */\nexport function transformToSolutionEntityData(\n payloadItem: ApiPayloadItem,\n config: EntityTypeConfig,\n): SolutionEntityData {\n return transformToGenericEntityData(payloadItem, config);\n}\n\nfunction formatEntityDate(timestamp: string): string | undefined {\n const date = new Date(timestamp);\n if (isNaN(date.getTime())) {\n return undefined;\n }\n const formatter = new Intl.DateTimeFormat('en-US', {\n day: 'numeric',\n month: 'short',\n timeZone: 'Europe/Kiev',\n year: 'numeric',\n });\n const parts = formatter.formatToParts(date);\n const day = parts.find((part) => part.type === 'day')?.value;\n const month = parts.find((part) => part.type === 'month')?.value;\n const year = parts.find((part) => part.type === 'year')?.value;\n\n if (!day || !month || !year) {\n return undefined;\n }\n\n return `${day} ${month} ${year}`;\n}\n\n/** @deprecated Use transformToGenericEntityData */\nexport function transformToBlogPostEntityData(\n payloadItem: ApiPayloadItem,\n config: EntityTypeConfig,\n): BlogEntityData {\n return transformToGenericEntityData(payloadItem, config);\n}\n\nexport function transformToGenericEntityData(\n payloadItem: ApiPayloadItem,\n config: EntityTypeConfig,\n): EntityItemData {\n let imageUrl: string | undefined;\n const publishTimestamp = payloadItem.publishDate || payloadItem.published_at;\n\n if (payloadItem.img) {\n const imgAlreadyAbsolute = payloadItem.img.startsWith('http');\n imageUrl = config.imageBaseUrl && !imgAlreadyAbsolute\n ? `${config.imageBaseUrl}${payloadItem.img}`\n : payloadItem.img;\n }\n\n // A document that retrieval narrowed to one child arrives with that child's\n // presentation fields already overlaid (`url`, `img`, `price`) plus the pairs\n // that identify it and the span its parent covers. The overlay is done\n // server-side; all that is left here is to shape those two for display.\n const currency = readCurrencyCode(\n payloadItem.currency,\n payloadItem.priceCurrency,\n );\n\n return {\n url: payloadItem.url,\n title: payloadItem.title,\n type: payloadItem.type,\n description: payloadItem.description,\n excerpt: payloadItem.excerpt,\n imageUrl,\n matchedOptions: toMatchedOptions(payloadItem.options),\n // Which child the row is wearing. Carried through so the live enricher\n // prices THAT variant (`mergeShopifyEntityData` keeps the turn's value)\n // rather than falling back to the product's default.\n variantId: payloadItem.variantId,\n price: formatPriceField(payloadItem.price, currency),\n priceMin: formatPriceField(payloadItem.priceMin, currency),\n priceMax: formatPriceField(payloadItem.priceMax, currency),\n date: payloadItem.update_ts\n ? formatEntityDate(payloadItem.update_ts)\n : undefined,\n publishDate: publishTimestamp\n ? formatEntityDate(publishTimestamp)\n : undefined,\n author: payloadItem.author || payloadItem.authorName,\n cmsItemId: payloadItem.cms_item_id,\n usage: payloadItem.usage,\n tags: payloadItem.labels?.length\n ? payloadItem.labels\n : payloadItem.tags?.length\n ? payloadItem.tags\n : undefined,\n };\n}\n\n/**\n * Default entity extractor - config-driven extraction for any client.\n * Uses entityConfig from client JSON to resolve web5://entity/ URLs against API payload.\n */\nexport const defaultExtractor: EntityExtractor = {\n extractEntityIdFromUrl,\n findEntityInPayload,\n};\n"],"mappings":";;;;;;;AAOA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE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AACF,CAAC","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.enrichEntitiesFromPayload = enrichEntitiesFromPayload;
|
|
5
|
+
var _entityTypeDefaults = require("./entityTypeDefaults");
|
|
5
6
|
/**
|
|
6
7
|
* Pure helper — given a list of entity refs, a payload, an entity config, an
|
|
7
8
|
* extractor, and a per-type transform, return a new array where any entity
|
|
@@ -14,7 +15,8 @@ exports.enrichEntitiesFromPayload = enrichEntitiesFromPayload;
|
|
|
14
15
|
* Skips an entity when:
|
|
15
16
|
* - it already has `.data` (caller-provided wins),
|
|
16
17
|
* - the URL doesn't parse as a `web5://entity/…` URL,
|
|
17
|
-
* - the parsed `entityType` has no config row
|
|
18
|
+
* - the parsed `entityType` has no config row — neither the client's own nor
|
|
19
|
+
* the platform floor in `PLATFORM_ENTITY_TYPES`,
|
|
18
20
|
* - no payload item matches.
|
|
19
21
|
*
|
|
20
22
|
* Returns the same array shape as the input; entities without a match are
|
|
@@ -26,7 +28,7 @@ function enrichEntitiesFromPayload(entities, payload, entityConfig, extractor, t
|
|
|
26
28
|
if (entity.data) return entity;
|
|
27
29
|
const parsed = extractor.extractEntityIdFromUrl(entity.entityUrl);
|
|
28
30
|
if (!parsed) return entity;
|
|
29
|
-
const typeConfig = entityConfig
|
|
31
|
+
const typeConfig = (0, _entityTypeDefaults.resolveEntityTypeConfig)(entityConfig, parsed.entityType);
|
|
30
32
|
if (!typeConfig) return entity;
|
|
31
33
|
const payloadItem = extractor.findEntityInPayload(parsed.entityType, parsed.entityId, payload, entityConfig);
|
|
32
34
|
if (!payloadItem) return entity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["enrichEntitiesFromPayload","entities","payload","entityConfig","extractor","transform","length","map","entity","data","parsed","extractEntityIdFromUrl","entityUrl","typeConfig","
|
|
1
|
+
{"version":3,"names":["_entityTypeDefaults","require","enrichEntitiesFromPayload","entities","payload","entityConfig","extractor","transform","length","map","entity","data","parsed","extractEntityIdFromUrl","entityUrl","typeConfig","resolveEntityTypeConfig","entityType","payloadItem","findEntityInPayload","entityId"],"sources":["../../../src/entity/enrichEntitiesFromPayload.ts"],"sourcesContent":["import type {\n ApiPayloadItem,\n EntityConfig,\n EntityTypeConfig,\n} from '../types/entity';\nimport { resolveEntityTypeConfig } from './entityTypeDefaults';\nimport type { EntityExtractor } from './types';\n\n/**\n * Pure helper — given a list of entity refs, a payload, an entity config, an\n * extractor, and a per-type transform, return a new array where any entity\n * whose `entityUrl` resolves to a payload item has its `.data` populated.\n *\n * Pure / framework-free so both the main app's React hook\n * (`useResolveGenericEntityData`, Step 1) and the placement bundle's\n * resolver (DL #099 PR 4) can share it.\n *\n * Skips an entity when:\n * - it already has `.data` (caller-provided wins),\n * - the URL doesn't parse as a `web5://entity/…` URL,\n * - the parsed `entityType` has no config row — neither the client's own nor\n * the platform floor in `PLATFORM_ENTITY_TYPES`,\n * - no payload item matches.\n *\n * Returns the same array shape as the input; entities without a match are\n * passed through by reference so React memoization upstream stays cheap.\n */\nexport function enrichEntitiesFromPayload<\n TEntity extends {\n entityId: string;\n entityUrl: string;\n entityType: string;\n data?: TEntityData;\n },\n TEntityData,\n>(\n entities: TEntity[],\n payload: ApiPayloadItem[],\n entityConfig: EntityConfig,\n extractor: EntityExtractor,\n transform: (raw: ApiPayloadItem, config: EntityTypeConfig) => TEntityData,\n): TEntity[] {\n if (!payload.length) return entities;\n\n return entities.map((entity) => {\n if (entity.data) return entity;\n\n const parsed = extractor.extractEntityIdFromUrl(entity.entityUrl);\n if (!parsed) return entity;\n\n const typeConfig = resolveEntityTypeConfig(entityConfig, parsed.entityType);\n if (!typeConfig) return entity;\n\n const payloadItem = extractor.findEntityInPayload(\n parsed.entityType,\n parsed.entityId,\n payload,\n entityConfig,\n );\n if (!payloadItem) return entity;\n\n return { ...entity, data: transform(payloadItem, typeConfig) };\n });\n}\n"],"mappings":";;;;AAKA,IAAAA,mBAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CASvCC,QAAmB,EACnBC,OAAyB,EACzBC,YAA0B,EAC1BC,SAA0B,EAC1BC,SAAyE,EAC9D;EACX,IAAI,CAACH,OAAO,CAACI,MAAM,EAAE,OAAOL,QAAQ;EAEpC,OAAOA,QAAQ,CAACM,GAAG,CAAEC,MAAM,IAAK;IAC9B,IAAIA,MAAM,CAACC,IAAI,EAAE,OAAOD,MAAM;IAE9B,MAAME,MAAM,GAAGN,SAAS,CAACO,sBAAsB,CAACH,MAAM,CAACI,SAAS,CAAC;IACjE,IAAI,CAACF,MAAM,EAAE,OAAOF,MAAM;IAE1B,MAAMK,UAAU,GAAG,IAAAC,2CAAuB,EAACX,YAAY,EAAEO,MAAM,CAACK,UAAU,CAAC;IAC3E,IAAI,CAACF,UAAU,EAAE,OAAOL,MAAM;IAE9B,MAAMQ,WAAW,GAAGZ,SAAS,CAACa,mBAAmB,CAC/CP,MAAM,CAACK,UAAU,EACjBL,MAAM,CAACQ,QAAQ,EACfhB,OAAO,EACPC,YACF,CAAC;IACD,IAAI,CAACa,WAAW,EAAE,OAAOR,MAAM;IAE/B,OAAO;MAAE,GAAGA,MAAM;MAAEC,IAAI,EAAEJ,SAAS,CAACW,WAAW,EAAEH,UAAU;IAAE,CAAC;EAChE,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
+
exports.isDocumentFamilyEntityType = isDocumentFamilyEntityType;
|
|
4
5
|
exports.isProductFamilyEntityType = isProductFamilyEntityType;
|
|
5
6
|
/**
|
|
6
7
|
* Which entity types a PRODUCT surface may draw.
|
|
@@ -34,4 +35,30 @@ const PRODUCT_FAMILY = new Set(['product', 'variant']);
|
|
|
34
35
|
function isProductFamilyEntityType(entityType) {
|
|
35
36
|
return PRODUCT_FAMILY.has((entityType ?? '').trim().toLowerCase());
|
|
36
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Which entity types a DOCUMENT surface may draw.
|
|
41
|
+
*
|
|
42
|
+
* A `page` (a static storefront page) and a `policy` (refund, shipping,
|
|
43
|
+
* privacy, terms) are the same shape as each other and a different shape to
|
|
44
|
+
* everything else a turn can link: a title and a URL, and no image, no price
|
|
45
|
+
* and no variant. A product card has nothing to draw them with, and an article
|
|
46
|
+
* card would promise an author and a publish date neither one has.
|
|
47
|
+
*
|
|
48
|
+
* This lives beside `isProductFamilyEntityType` and for the same reason — a
|
|
49
|
+
* surface that routes by type and has never heard of `policy` does not fail
|
|
50
|
+
* loudly, it renders nothing and leaves the shopper an answer with no way to
|
|
51
|
+
* read the policy it just summarised.
|
|
52
|
+
*/
|
|
53
|
+
const DOCUMENT_FAMILY = new Set(['page', 'policy']);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* `true` for the entity types a title-and-link document card can render.
|
|
57
|
+
*
|
|
58
|
+
* Case-insensitive on the trimmed value, like the product predicate: the type
|
|
59
|
+
* is the verbatim `doc_domain` a site's mapping schema chose.
|
|
60
|
+
*/
|
|
61
|
+
function isDocumentFamilyEntityType(entityType) {
|
|
62
|
+
return DOCUMENT_FAMILY.has((entityType ?? '').trim().toLowerCase());
|
|
63
|
+
}
|
|
37
64
|
//# sourceMappingURL=entityFamily.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PRODUCT_FAMILY","Set","isProductFamilyEntityType","entityType","has","trim","toLowerCase"],"sources":["../../../src/entity/entityFamily.ts"],"sourcesContent":["/**\n * Which entity types a PRODUCT surface may draw.\n *\n * Every client re-implemented this as `entityType === 'product'`, and that held\n * for as long as a product was the only purchasable thing a turn could return.\n * It stopped holding when retrieval learned to ENUMERATE an option dimension:\n * asked to see the range of an option (\"all the colours of X\") rather than to\n * filter by one value of it, a turn answers with one row per colourway, and\n * each row is a `variant`.\n *\n * A variant is not a different KIND of thing to a card. It is one purchasable\n * child of a product, carrying its own image, its own price and a\n * `?variant=`-bearing link — everything a product card draws. What it is not is\n * an article or a collection, which are different cards entirely.\n *\n * This lives in core because getting it wrong is silent: the row resolves\n * perfectly, then the product surface filters it out, and the page renders the\n * prose with a hole where the cards belong. That shipped to production once\n * already.\n */\nconst PRODUCT_FAMILY: ReadonlySet<string> = new Set(['product', 'variant']);\n\n/**\n * `true` for the entity types a product card can render.\n *\n * Compares case-insensitively on the trimmed value, because the type is the\n * verbatim `doc_domain` a site's mapping schema chose and nothing normalizes it\n * on the way here.\n */\nexport function isProductFamilyEntityType(entityType: string | undefined): boolean {\n return PRODUCT_FAMILY.has((entityType ?? '').trim().toLowerCase());\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["PRODUCT_FAMILY","Set","isProductFamilyEntityType","entityType","has","trim","toLowerCase","DOCUMENT_FAMILY","isDocumentFamilyEntityType"],"sources":["../../../src/entity/entityFamily.ts"],"sourcesContent":["/**\n * Which entity types a PRODUCT surface may draw.\n *\n * Every client re-implemented this as `entityType === 'product'`, and that held\n * for as long as a product was the only purchasable thing a turn could return.\n * It stopped holding when retrieval learned to ENUMERATE an option dimension:\n * asked to see the range of an option (\"all the colours of X\") rather than to\n * filter by one value of it, a turn answers with one row per colourway, and\n * each row is a `variant`.\n *\n * A variant is not a different KIND of thing to a card. It is one purchasable\n * child of a product, carrying its own image, its own price and a\n * `?variant=`-bearing link — everything a product card draws. What it is not is\n * an article or a collection, which are different cards entirely.\n *\n * This lives in core because getting it wrong is silent: the row resolves\n * perfectly, then the product surface filters it out, and the page renders the\n * prose with a hole where the cards belong. That shipped to production once\n * already.\n */\nconst PRODUCT_FAMILY: ReadonlySet<string> = new Set(['product', 'variant']);\n\n/**\n * `true` for the entity types a product card can render.\n *\n * Compares case-insensitively on the trimmed value, because the type is the\n * verbatim `doc_domain` a site's mapping schema chose and nothing normalizes it\n * on the way here.\n */\nexport function isProductFamilyEntityType(entityType: string | undefined): boolean {\n return PRODUCT_FAMILY.has((entityType ?? '').trim().toLowerCase());\n}\n\n/**\n * Which entity types a DOCUMENT surface may draw.\n *\n * A `page` (a static storefront page) and a `policy` (refund, shipping,\n * privacy, terms) are the same shape as each other and a different shape to\n * everything else a turn can link: a title and a URL, and no image, no price\n * and no variant. A product card has nothing to draw them with, and an article\n * card would promise an author and a publish date neither one has.\n *\n * This lives beside `isProductFamilyEntityType` and for the same reason — a\n * surface that routes by type and has never heard of `policy` does not fail\n * loudly, it renders nothing and leaves the shopper an answer with no way to\n * read the policy it just summarised.\n */\nconst DOCUMENT_FAMILY: ReadonlySet<string> = new Set(['page', 'policy']);\n\n/**\n * `true` for the entity types a title-and-link document card can render.\n *\n * Case-insensitive on the trimmed value, like the product predicate: the type\n * is the verbatim `doc_domain` a site's mapping schema chose.\n */\nexport function isDocumentFamilyEntityType(entityType: string | undefined): boolean {\n return DOCUMENT_FAMILY.has((entityType ?? '').trim().toLowerCase());\n}\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAmC,GAAG,IAAIC,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CAACC,UAA8B,EAAW;EACjF,OAAOH,cAAc,CAACI,GAAG,CAAC,CAACD,UAAU,IAAI,EAAE,EAAEE,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAoC,GAAG,IAAIN,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;;AAExE;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,0BAA0BA,CAACL,UAA8B,EAAW;EAClF,OAAOI,eAAe,CAACH,GAAG,CAAC,CAACD,UAAU,IAAI,EAAE,EAAEE,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC;AACrE","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.PLATFORM_ENTITY_TYPES = void 0;
|
|
5
|
+
exports.resolveEntityTypeConfig = resolveEntityTypeConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Entity types every site can resolve, whether or not its client config names
|
|
8
|
+
* them.
|
|
9
|
+
*
|
|
10
|
+
* Resolution is an EXACT-KEY lookup into `entityConfig.entityTypes` with no
|
|
11
|
+
* mapping and no fallback (DL #124: "an unknown key just yields no data"), so a
|
|
12
|
+
* type a client never declared is not a degraded reference — it is no reference
|
|
13
|
+
* at all. That gate is right for a type nobody can serve, and wrong for the
|
|
14
|
+
* static-content domains the platform's own ecom mapping schema publishes on
|
|
15
|
+
* every store: `page` and `policy` (see
|
|
16
|
+
* `web5-collection-mapping/schema/examples/ecom-site.schema.json`). Those rows
|
|
17
|
+
* arrive in the turn's payload with a title and a URL, and were dropped for the
|
|
18
|
+
* sole reason that four hand-written config files had never heard of them.
|
|
19
|
+
*
|
|
20
|
+
* Keys are the semantic `doc_domain` the mapping stamps, so the link's `<type>`
|
|
21
|
+
* and the card's `type` are the same word. A client that needs different
|
|
22
|
+
* matching for one of these declares its own row and wins — this is the floor,
|
|
23
|
+
* not an override.
|
|
24
|
+
*
|
|
25
|
+
* NOT here: `product` / `variant` / `collection` / `article`, which every client
|
|
26
|
+
* already declares and whose matching genuinely differs per store, and `blog` /
|
|
27
|
+
* `catalog`, the two remaining domains of the ecom schema that no answer links
|
|
28
|
+
* to yet.
|
|
29
|
+
*/
|
|
30
|
+
const PLATFORM_ENTITY_TYPES = exports.PLATFORM_ENTITY_TYPES = Object.freeze({
|
|
31
|
+
// A store policy (refund, shipping, privacy, terms). Title + URL, no image,
|
|
32
|
+
// no price, no variant.
|
|
33
|
+
policy: {
|
|
34
|
+
payloadType: 'policy',
|
|
35
|
+
urlMatchProperty: 'url',
|
|
36
|
+
urlMatchPattern: 'endsWith'
|
|
37
|
+
},
|
|
38
|
+
// A static storefront page (`/pages/<handle>`) — "About us", "Delivery
|
|
39
|
+
// information". Same shape as a policy.
|
|
40
|
+
page: {
|
|
41
|
+
payloadType: 'page',
|
|
42
|
+
urlMatchProperty: 'url',
|
|
43
|
+
urlMatchPattern: 'endsWith'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The config row a `web5://entity/<type>/<id>` reference resolves against: the
|
|
49
|
+
* client's own declaration first, then the platform floor above.
|
|
50
|
+
*
|
|
51
|
+
* The client lookup stays verbatim — `entityTypes` keys are compared exactly
|
|
52
|
+
* everywhere else, and a client that keys a row `Solution` means `Solution`.
|
|
53
|
+
* The floor is matched case-insensitively on the trimmed value, for the same
|
|
54
|
+
* reason `isProductFamilyEntityType` is: the type is whatever `doc_domain` a
|
|
55
|
+
* site's mapping schema chose and nothing normalizes it on the way here.
|
|
56
|
+
*/
|
|
57
|
+
function resolveEntityTypeConfig(entityConfig, entityType) {
|
|
58
|
+
var _entityConfig$entityT;
|
|
59
|
+
if (!entityType) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const declared = entityConfig == null || (_entityConfig$entityT = entityConfig.entityTypes) == null ? void 0 : _entityConfig$entityT[entityType];
|
|
63
|
+
if (declared) {
|
|
64
|
+
return declared;
|
|
65
|
+
}
|
|
66
|
+
return PLATFORM_ENTITY_TYPES[entityType.trim().toLowerCase()];
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=entityTypeDefaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PLATFORM_ENTITY_TYPES","exports","Object","freeze","policy","payloadType","urlMatchProperty","urlMatchPattern","page","resolveEntityTypeConfig","entityConfig","entityType","_entityConfig$entityT","undefined","declared","entityTypes","trim","toLowerCase"],"sources":["../../../src/entity/entityTypeDefaults.ts"],"sourcesContent":["import type { EntityConfig, EntityTypeConfig } from '../types/entity';\n\n/**\n * Entity types every site can resolve, whether or not its client config names\n * them.\n *\n * Resolution is an EXACT-KEY lookup into `entityConfig.entityTypes` with no\n * mapping and no fallback (DL #124: \"an unknown key just yields no data\"), so a\n * type a client never declared is not a degraded reference — it is no reference\n * at all. That gate is right for a type nobody can serve, and wrong for the\n * static-content domains the platform's own ecom mapping schema publishes on\n * every store: `page` and `policy` (see\n * `web5-collection-mapping/schema/examples/ecom-site.schema.json`). Those rows\n * arrive in the turn's payload with a title and a URL, and were dropped for the\n * sole reason that four hand-written config files had never heard of them.\n *\n * Keys are the semantic `doc_domain` the mapping stamps, so the link's `<type>`\n * and the card's `type` are the same word. A client that needs different\n * matching for one of these declares its own row and wins — this is the floor,\n * not an override.\n *\n * NOT here: `product` / `variant` / `collection` / `article`, which every client\n * already declares and whose matching genuinely differs per store, and `blog` /\n * `catalog`, the two remaining domains of the ecom schema that no answer links\n * to yet.\n */\nexport const PLATFORM_ENTITY_TYPES: Readonly<Record<string, EntityTypeConfig>> =\n Object.freeze({\n // A store policy (refund, shipping, privacy, terms). Title + URL, no image,\n // no price, no variant.\n policy: {\n payloadType: 'policy',\n urlMatchProperty: 'url',\n urlMatchPattern: 'endsWith' as const,\n },\n // A static storefront page (`/pages/<handle>`) — \"About us\", \"Delivery\n // information\". Same shape as a policy.\n page: {\n payloadType: 'page',\n urlMatchProperty: 'url',\n urlMatchPattern: 'endsWith' as const,\n },\n });\n\n/**\n * The config row a `web5://entity/<type>/<id>` reference resolves against: the\n * client's own declaration first, then the platform floor above.\n *\n * The client lookup stays verbatim — `entityTypes` keys are compared exactly\n * everywhere else, and a client that keys a row `Solution` means `Solution`.\n * The floor is matched case-insensitively on the trimmed value, for the same\n * reason `isProductFamilyEntityType` is: the type is whatever `doc_domain` a\n * site's mapping schema chose and nothing normalizes it on the way here.\n */\nexport function resolveEntityTypeConfig(\n entityConfig: Pick<EntityConfig, 'entityTypes'> | undefined | null,\n entityType: string | undefined,\n): EntityTypeConfig | undefined {\n if (!entityType) {\n return undefined;\n }\n const declared = entityConfig?.entityTypes?.[entityType];\n if (declared) {\n return declared;\n }\n return PLATFORM_ENTITY_TYPES[entityType.trim().toLowerCase()];\n}\n"],"mappings":";;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,qBAAiE,GAAAC,OAAA,CAAAD,qBAAA,GAC5EE,MAAM,CAACC,MAAM,CAAC;EACZ;EACA;EACAC,MAAM,EAAE;IACNC,WAAW,EAAE,QAAQ;IACrBC,gBAAgB,EAAE,KAAK;IACvBC,eAAe,EAAE;EACnB,CAAC;EACD;EACA;EACAC,IAAI,EAAE;IACJH,WAAW,EAAE,MAAM;IACnBC,gBAAgB,EAAE,KAAK;IACvBC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,uBAAuBA,CACrCC,YAAkE,EAClEC,UAA8B,EACA;EAAA,IAAAC,qBAAA;EAC9B,IAAI,CAACD,UAAU,EAAE;IACf,OAAOE,SAAS;EAClB;EACA,MAAMC,QAAQ,GAAGJ,YAAY,aAAAE,qBAAA,GAAZF,YAAY,CAAEK,WAAW,qBAAzBH,qBAAA,CAA4BD,UAAU,CAAC;EACxD,IAAIG,QAAQ,EAAE;IACZ,OAAOA,QAAQ;EACjB;EACA,OAAOd,qBAAqB,CAACW,UAAU,CAACK,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC;AAC/D","ignoreList":[]}
|
package/dist/cjs/entity/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.formatProductPriceLabel = exports.formatPriceField = exports.formatMoney = exports.fetchEntityListData = exports.entityPayloadFromItems = exports.entityHref = exports.enrichEntitiesFromPayload = exports.LIST_ITEMS_ENDPOINT = void 0;
|
|
4
|
+
exports.formatProductPriceLabel = exports.formatPriceField = exports.formatMoney = exports.fetchEntityListData = exports.entityPayloadFromItems = exports.entityHref = exports.enrichEntitiesFromPayload = exports.PLATFORM_ENTITY_TYPES = exports.LIST_ITEMS_ENDPOINT = void 0;
|
|
5
5
|
exports.getEntityExtractor = getEntityExtractor;
|
|
6
|
-
exports.readCurrencyCode = exports.normalizeEntityItem = exports.mergeEntityData = exports.listEntityItems = exports.isProductFamilyEntityType = void 0;
|
|
6
|
+
exports.readCurrencyCode = exports.normalizeEntityItem = exports.mergeEntityData = exports.listEntityItems = exports.isProductFamilyEntityType = exports.isDocumentFamilyEntityType = void 0;
|
|
7
7
|
exports.registerEntityExtractor = registerEntityExtractor;
|
|
8
|
-
exports.transformToSolutionEntityData = exports.transformToGenericEntityData = exports.transformToBlogPostEntityData = exports.toMatchedOptions = exports.toCatalogPath = void 0;
|
|
8
|
+
exports.transformToSolutionEntityData = exports.transformToGenericEntityData = exports.transformToBlogPostEntityData = exports.toMatchedOptions = exports.toCatalogPath = exports.resolveEntityTypeConfig = void 0;
|
|
9
9
|
var _defaultExtractor = require("./defaultExtractor");
|
|
10
10
|
exports.defaultExtractor = _defaultExtractor.defaultExtractor;
|
|
11
11
|
exports.transformToSolutionEntityData = _defaultExtractor.transformToSolutionEntityData;
|
|
@@ -21,6 +21,10 @@ exports.entityPayloadFromItems = _entityPayload.entityPayloadFromItems;
|
|
|
21
21
|
exports.toCatalogPath = _entityPayload.toCatalogPath;
|
|
22
22
|
var _entityFamily = require("./entityFamily");
|
|
23
23
|
exports.isProductFamilyEntityType = _entityFamily.isProductFamilyEntityType;
|
|
24
|
+
exports.isDocumentFamilyEntityType = _entityFamily.isDocumentFamilyEntityType;
|
|
25
|
+
var _entityTypeDefaults = require("./entityTypeDefaults");
|
|
26
|
+
exports.PLATFORM_ENTITY_TYPES = _entityTypeDefaults.PLATFORM_ENTITY_TYPES;
|
|
27
|
+
exports.resolveEntityTypeConfig = _entityTypeDefaults.resolveEntityTypeConfig;
|
|
24
28
|
var _mergeEntityData = require("./mergeEntityData");
|
|
25
29
|
exports.mergeEntityData = _mergeEntityData.mergeEntityData;
|
|
26
30
|
var _matchedVariant = require("./matchedVariant");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defaultExtractor","require","exports","defaultExtractor","transformToSolutionEntityData","transformToBlogPostEntityData","transformToGenericEntityData","_enrichEntitiesFromPayload","enrichEntitiesFromPayload","_entityHref","entityHref","_entityPayload","normalizeEntityItem","entityPayloadFromItems","toCatalogPath","_entityFamily","isProductFamilyEntityType","_mergeEntityData","mergeEntityData","_matchedVariant","toMatchedOptions","formatMoney","readCurrencyCode","formatPriceField","formatProductPriceLabel","_fetchEntityListData","fetchEntityListData","_listEntityItems","listEntityItems","LIST_ITEMS_ENDPOINT","extractorRegistry","getEntityExtractor","clientId","registerEntityExtractor","extractor"],"sources":["../../../src/entity/index.ts"],"sourcesContent":["import type { EntityExtractor } from './types';\nimport { defaultExtractor } from './defaultExtractor';\n\nexport {\n defaultExtractor,\n transformToSolutionEntityData,\n transformToBlogPostEntityData,\n transformToGenericEntityData,\n} from './defaultExtractor';\n\nexport { enrichEntitiesFromPayload } from './enrichEntitiesFromPayload';\nexport { entityHref } from './entityHref';\nexport {\n normalizeEntityItem,\n entityPayloadFromItems,\n toCatalogPath,\n} from './entityPayload';\nexport {
|
|
1
|
+
{"version":3,"names":["_defaultExtractor","require","exports","defaultExtractor","transformToSolutionEntityData","transformToBlogPostEntityData","transformToGenericEntityData","_enrichEntitiesFromPayload","enrichEntitiesFromPayload","_entityHref","entityHref","_entityPayload","normalizeEntityItem","entityPayloadFromItems","toCatalogPath","_entityFamily","isProductFamilyEntityType","isDocumentFamilyEntityType","_entityTypeDefaults","PLATFORM_ENTITY_TYPES","resolveEntityTypeConfig","_mergeEntityData","mergeEntityData","_matchedVariant","toMatchedOptions","formatMoney","readCurrencyCode","formatPriceField","formatProductPriceLabel","_fetchEntityListData","fetchEntityListData","_listEntityItems","listEntityItems","LIST_ITEMS_ENDPOINT","extractorRegistry","getEntityExtractor","clientId","registerEntityExtractor","extractor"],"sources":["../../../src/entity/index.ts"],"sourcesContent":["import type { EntityExtractor } from './types';\nimport { defaultExtractor } from './defaultExtractor';\n\nexport {\n defaultExtractor,\n transformToSolutionEntityData,\n transformToBlogPostEntityData,\n transformToGenericEntityData,\n} from './defaultExtractor';\n\nexport { enrichEntitiesFromPayload } from './enrichEntitiesFromPayload';\nexport { entityHref } from './entityHref';\nexport {\n normalizeEntityItem,\n entityPayloadFromItems,\n toCatalogPath,\n} from './entityPayload';\nexport {\n isProductFamilyEntityType,\n isDocumentFamilyEntityType,\n} from './entityFamily';\nexport {\n PLATFORM_ENTITY_TYPES,\n resolveEntityTypeConfig,\n} from './entityTypeDefaults';\nexport { mergeEntityData } from './mergeEntityData';\nexport {\n toMatchedOptions,\n formatMoney,\n readCurrencyCode,\n formatPriceField,\n formatProductPriceLabel,\n type MatchedOption,\n type ProductPriceFields,\n} from './matchedVariant';\nexport {\n fetchEntityListData,\n type FetchEntityListDataOptions,\n} from './fetchEntityListData';\nexport {\n listEntityItems,\n LIST_ITEMS_ENDPOINT,\n type ListEntityItemsOptions,\n} from './listEntityItems';\n\nexport type { EntityExtractor } from './types';\n\n/**\n * Registry of client-specific entity extractors.\n * Only needed if a client requires custom extraction logic beyond the config-driven default.\n */\nconst extractorRegistry: Record<string, EntityExtractor> = {};\n\n/**\n * Get the entity extractor for a specific client.\n * The default extractor is config-driven and works for any client with entityConfig.\n */\nexport function getEntityExtractor(clientId?: string): EntityExtractor {\n if (clientId && extractorRegistry[clientId]) {\n return extractorRegistry[clientId];\n }\n return defaultExtractor;\n}\n\n/**\n * Register a custom entity extractor for a client\n * Useful for runtime registration or testing\n */\nexport function registerEntityExtractor(\n clientId: string,\n extractor: EntityExtractor,\n): void {\n extractorRegistry[clientId] = extractor;\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAAsDC,OAAA,CAAAC,gBAAA,GAAAH,iBAAA,CAAAG,gBAAA;AAAAD,OAAA,CAAAE,6BAAA,GAAAJ,iBAAA,CAAAI,6BAAA;AAAAF,OAAA,CAAAG,6BAAA,GAAAL,iBAAA,CAAAK,6BAAA;AAAAH,OAAA,CAAAI,4BAAA,GAAAN,iBAAA,CAAAM,4BAAA;AAStD,IAAAC,0BAAA,GAAAN,OAAA;AAAwEC,OAAA,CAAAM,yBAAA,GAAAD,0BAAA,CAAAC,yBAAA;AACxE,IAAAC,WAAA,GAAAR,OAAA;AAA0CC,OAAA,CAAAQ,UAAA,GAAAD,WAAA,CAAAC,UAAA;AAC1C,IAAAC,cAAA,GAAAV,OAAA;AAIyBC,OAAA,CAAAU,mBAAA,GAAAD,cAAA,CAAAC,mBAAA;AAAAV,OAAA,CAAAW,sBAAA,GAAAF,cAAA,CAAAE,sBAAA;AAAAX,OAAA,CAAAY,aAAA,GAAAH,cAAA,CAAAG,aAAA;AACzB,IAAAC,aAAA,GAAAd,OAAA;AAGwBC,OAAA,CAAAc,yBAAA,GAAAD,aAAA,CAAAC,yBAAA;AAAAd,OAAA,CAAAe,0BAAA,GAAAF,aAAA,CAAAE,0BAAA;AACxB,IAAAC,mBAAA,GAAAjB,OAAA;AAG8BC,OAAA,CAAAiB,qBAAA,GAAAD,mBAAA,CAAAC,qBAAA;AAAAjB,OAAA,CAAAkB,uBAAA,GAAAF,mBAAA,CAAAE,uBAAA;AAC9B,IAAAC,gBAAA,GAAApB,OAAA;AAAoDC,OAAA,CAAAoB,eAAA,GAAAD,gBAAA,CAAAC,eAAA;AACpD,IAAAC,eAAA,GAAAtB,OAAA;AAQ0BC,OAAA,CAAAsB,gBAAA,GAAAD,eAAA,CAAAC,gBAAA;AAAAtB,OAAA,CAAAuB,WAAA,GAAAF,eAAA,CAAAE,WAAA;AAAAvB,OAAA,CAAAwB,gBAAA,GAAAH,eAAA,CAAAG,gBAAA;AAAAxB,OAAA,CAAAyB,gBAAA,GAAAJ,eAAA,CAAAI,gBAAA;AAAAzB,OAAA,CAAA0B,uBAAA,GAAAL,eAAA,CAAAK,uBAAA;AAC1B,IAAAC,oBAAA,GAAA5B,OAAA;AAG+BC,OAAA,CAAA4B,mBAAA,GAAAD,oBAAA,CAAAC,mBAAA;AAC/B,IAAAC,gBAAA,GAAA9B,OAAA;AAI2BC,OAAA,CAAA8B,eAAA,GAAAD,gBAAA,CAAAC,eAAA;AAAA9B,OAAA,CAAA+B,mBAAA,GAAAF,gBAAA,CAAAE,mBAAA;AAI3B;AACA;AACA;AACA;AACA,MAAMC,iBAAkD,GAAG,CAAC,CAAC;;AAE7D;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,QAAiB,EAAmB;EACrE,IAAIA,QAAQ,IAAIF,iBAAiB,CAACE,QAAQ,CAAC,EAAE;IAC3C,OAAOF,iBAAiB,CAACE,QAAQ,CAAC;EACpC;EACA,OAAOjC,kCAAgB;AACzB;;AAEA;AACA;AACA;AACA;AACO,SAASkC,uBAAuBA,CACrCD,QAAgB,EAChBE,SAA0B,EACpB;EACNJ,iBAAiB,CAACE,QAAQ,CAAC,GAAGE,SAAS;AACzC","ignoreList":[]}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.writeProductBackHandoff = exports.validatePatternWithBlocks = void 0;
|
|
4
|
+
exports.WEB5_USER_QUERY_EVENT = exports.WEB5_SCOPES = exports.WEB5_SCOPE = exports.WEB5_ROOT_ID = exports.WEB5_ROOT_CLASS = exports.WEB5_REDIRECT_EVENT = exports.WEB5_GLOBAL_TOKENS = exports.WEB5_ANSWER_UPDATED_EVENT = exports.WEB5_ANSWER_SETTLED_EVENT = exports.UserQueryProvider = exports.UserQuery = exports.UnifiedMarkdownParser = exports.UnifiedLink = exports.UNKNOWN_CONSENT = exports.TextBlockSectionDefinition = exports.TableRow = exports.TableHeader = exports.TableHead = exports.TableFooter = exports.TableCell = exports.TableCaption = exports.TableBody = exports.Table = exports.TOKEN_NAME_PATTERN = exports.THEME_TOKEN_CONTRACT = exports.THEME_OVERRIDE_TOKENS = exports.THEME_DEBUG_QUERY_PARAM = exports.THEME_DEBUG_KEY = exports.TEMPLATES_MANIFEST_URL = exports.TEMPLATES_CDN_BASE = exports.SmartIcon = exports.SkipNodesSectionDefinition = exports.ShopifyStorefrontClient = exports.SectionSkeleton = exports.SearchSectionDefinition = exports.SearchSection = exports.STREAMING_TIMEOUT_MS = exports.REFRESH_PROMPTS_WINDOW_MS = exports.REFRESH_PROMPTS_UNTIL_KEY = exports.PromptEntryEmptyState = exports.PlacementSmoothHeight = exports.PlacementResponseRenderer = exports.PlacementPayloadProvider = exports.PlacementLoader = exports.PRODUCT_BY_HANDLE_QUERY = exports.PRODUCT_BACK_SESSION_KEY = exports.PLATFORM_ENTITY_TYPES = exports.OptimizedImage = exports.NextStepsSectionDefinition = exports.MetricsSectionDefinition = exports.MarkdownText = exports.MATCH_DEBUG_QUERY_PARAM = exports.MATCH_DEBUG_KEY = exports.Loader = exports.ListItemsSectionDefinition = exports.LinkType = exports.LIST_ITEMS_ENDPOINT = exports.KpiSectionDefinition = exports.ImageSlotProvider = exports.ImageSearchFilterToken = exports.HtmlCommentSectionDefinition = exports.HeroSectionDefinition = exports.HeroEntitySectionDefinition = exports.HOST_CONSENT_GLOBAL = exports.FeedbackBar = exports.FeatureToggleProvider = exports.FeatureSection9PlusDefinition = exports.FeatureCardsSectionDefinition = exports.FallbackSectionDefinition = exports.ErrorSectionDefinition = exports.EntitySectionDefinition = exports.EntityCollectionSectionDefinition = exports.EXPERIMENT_IDS = exports.ERROR_MARKDOWN = exports.EDITABLE_TOKENS = exports.Disclaimer = exports.DiagnosticsCollector = exports.DROP_SECTION = exports.DIAGNOSTIC_TYPES = exports.DEFAULT_ERROR_TEMPLATES = exports.DEFAULT_BACKEND_ENVIRONMENT = exports.CtaBannerSectionDefinition = exports.ComponentTracking = exports.ComponentRegistry = exports.ComponentDependenciesProvider = exports.ComparisonSectionDefinition = exports.ChipsProvider = exports.CalloutSectionDefinition = exports.CalloutBlock = exports.CONSENT_OVERRIDE_QUERY_PARAM = exports.CONSENT_OVERRIDE_KEY = exports.COLLECTION_BY_HANDLE_QUERY = exports.CLIENT_IDS = exports.CALLOUT_SEMANTICS = exports.CALLOUT_KINDS = exports.BottomContainer = exports.BRAND_TOKENS = exports.BACKEND_ENVIRONMENT_QUERY_PARAM = exports.BACKEND_ENVIRONMENT_KEY = exports.ARTICLE_BY_HANDLE_QUERY = void 0;
|
|
5
|
+
exports.isSimulationTraffic = exports.isShopifyHost = exports.isProductFamilyEntityType = exports.isOneTrustHost = exports.isNavigableUrl = exports.isMatchDebugEnabled = exports.isLegacyUrl = exports.isHtmlComment = exports.isHslTriplet = exports.isEntityLink = exports.isDocumentFamilyEntityType = exports.installConsentProvider = exports.initConsentGate = exports.hslTripletToHex = exports.hslToRgb = exports.hostAliasFor = exports.hexToHslTriplet = exports.hasImage = exports.hasHostSuppliedConsent = exports.hasAnalyticsConsent = exports.getTemplateOverride = exports.getSessionId = exports.getResizedImageUrl = exports.getRefreshPromptsExpiry = exports.getPartsByType = exports.getPartByRole = exports.getOrCreateSessionId = exports.getLinks = exports.getIntentFromMarkdown = exports.getInstalledProviderName = exports.getImages = exports.getHeading = exports.getGateView = exports.getForwardStack = exports.getErrorTypeFromStatus = exports.getEntityExtractor = exports.getContextualImageFilename = exports.getConsentSnapshot = exports.getConsentOverride = exports.getConsentGateStats = exports.getClientBundleOverride = exports.getChatId = exports.getBackendEnvironment = exports.getAllByRole = exports.generateSectionId = exports.generateId = exports.formatProductPriceLabel = exports.formatPriceField = exports.formatMoney = exports.fixMalformedLinks = exports.findKeywordsInContent = exports.findInvalidWeb5Links = exports.findImageInNode = exports.findImageInChildren = exports.fetchProductsByHandlesMap = exports.fetchProductsByHandles = exports.fetchEntityListData = exports.extractProtocol = exports.extractLinkMetadata = exports.extractIntentFromMarkdown = exports.extractContentMarkdown = exports.extractContent = exports.escapeWeb5Links = exports.entityPayloadFromItems = exports.entityHref = exports.ensureMinLightness = exports.enrichEntitiesFromPayload = exports.enableRefreshPrompts = exports.disableRefreshPrompts = exports.detectLinkType = exports.detectConsentProvider = exports.deriveRole = exports.deriveLightColor = exports.deriveDarkGradient = exports.deriveDarkColor = exports.defaultExtractor = exports.decodeLinkText = exports.createWixAuthFetch = exports.createShopifyConsentProvider = exports.createSdkRegistry = exports.createPageSection = exports.createOneTrustConsentProvider = exports.createHostSuppliedConsentProvider = exports.createFeatureToggleReader = exports.createErrorMarkdown = exports.convertToBlockElementsWithMapping = exports.convertToBlockElements = exports.computeContentBBox = exports.composeSemantic = exports.cn = exports.clearForwardStack = exports.buildProbeUrl = exports.buildPlacementDependencies = exports.buildImageSearchFilter = exports.bucketOf = exports.backgroundFilter = exports.applyThemeOverrides = exports.analyzeBackdrop = exports.addToCart = exports.Web5UrlType = void 0;
|
|
6
|
+
exports.usesStagingBackend = exports.useWeb5Link = exports.useUserQuery = exports.useResolvedImageSources = exports.useResolveShopifyEntityData = exports.useResolveSearchSpringEntityData = exports.useResolveGenericEntityData = exports.usePlacementPayload = exports.useMarkdownUtils = exports.useImageSlotCollector = exports.useImageSlot = exports.useFeatureToggles = exports.useFeatureToggle = exports.useEntityTransforms = exports.useDebugImageContext = exports.useConversation = exports.useComponentDependencies = exports.useChips = exports.unlockOnUserAction = exports.tryParseComponent = exports.trimTrailingWhitespace = exports.transmit = exports.transformToSolutionEntityData = exports.transformToGenericEntityData = exports.transformToBlogPostEntityData = exports.transformShopifyProduct = exports.transformShopifyEntityToItemData = exports.transformShopifyCollection = exports.transformShopifyArticle = exports.transformSSProductToEntityItemData = exports.toRgb = exports.toMatchedOptions = exports.toCatalogPath = exports.subscribeToConsent = exports.stripMarkdown = exports.startNewChatId = exports.shouldRefreshPrompts = exports.setMatchDebug = exports.setForwardStack = exports.setConsentOverride = exports.setConsentBufferLimit = exports.setChatId = exports.setBackendEnvironment = exports.rgbToHsl = exports.resolveShopifyEntity = exports.resolveShopifyConfig = exports.resolveErrorTemplate = exports.resolveEntityTypeConfig = exports.resolveClientBundleUrl = exports.resetMatchDebugCache = exports.resetConsentGateForTests = exports.resetChatIdForTests = exports.registerEntityExtractor = exports.readProductBackHandoff = exports.readCurrencyCode = exports.pushToForwardStack = exports.pushPromptSubmit = exports.pushLinkClick = exports.pushExit = exports.pushEvent = exports.pushError = exports.pushEntityFiltered = exports.publishHostConsent = exports.preprocessMarkdown = exports.popFromForwardStack = exports.parseWeb5Url = exports.parseMarkdownToComponents = exports.parseMarkdownToAst = exports.parseEntityLink = exports.parseAstToMarkdown = exports.normalizeImageUrl = exports.normalizeIconUrls = exports.normalizeEntityItem = exports.nodesToParts = exports.mergeSectionsWithStableReferences = exports.mergeEntityData = exports.mergeClientConfig = exports.mayTransmit = exports.mayPersistIdentity = exports.matchMarkdown = exports.matchAllSections = exports.logMatchDebug = exports.loadImagePixels = exports.loadClientBundle = exports.loadBackdropAnalysis = exports.listEntityItems = exports.isWeb5Url = exports.isWeb5SearchUrl = exports.isWeb5ImageUrl = exports.isWeb5IconUrl = exports.isWeb5EntityUrl = exports.isWeb5AskUrl = exports.isWeb5ActionUrl = exports.isValidWeb5Url = exports.isValidTemplateId = exports.isValidLinkUrl = exports.isUserEngaged = exports.isTrustedBundleHost = exports.isThemeDebugEnabled = exports.isTemplatePickerRequested = void 0;
|
|
7
|
+
exports.writeProductBackHandoff = exports.validatePatternWithBlocks = exports.validatePatternSyntax = exports.validatePattern = exports.validateLinkUrl = void 0;
|
|
8
8
|
var _clients = require("./clients");
|
|
9
9
|
exports.CLIENT_IDS = _clients.CLIENT_IDS;
|
|
10
10
|
exports.EXPERIMENT_IDS = _clients.EXPERIMENT_IDS;
|
|
@@ -122,6 +122,9 @@ exports.readCurrencyCode = _entity.readCurrencyCode;
|
|
|
122
122
|
exports.formatPriceField = _entity.formatPriceField;
|
|
123
123
|
exports.formatProductPriceLabel = _entity.formatProductPriceLabel;
|
|
124
124
|
exports.isProductFamilyEntityType = _entity.isProductFamilyEntityType;
|
|
125
|
+
exports.isDocumentFamilyEntityType = _entity.isDocumentFamilyEntityType;
|
|
126
|
+
exports.PLATFORM_ENTITY_TYPES = _entity.PLATFORM_ENTITY_TYPES;
|
|
127
|
+
exports.resolveEntityTypeConfig = _entity.resolveEntityTypeConfig;
|
|
125
128
|
var _callout = require("./types/callout");
|
|
126
129
|
exports.CALLOUT_KINDS = _callout.CALLOUT_KINDS;
|
|
127
130
|
exports.CALLOUT_SEMANTICS = _callout.CALLOUT_SEMANTICS;
|