@wix/web5-core 1.59.0 → 1.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/component/componentDefinitions/ComparisonSectionDefinition.js +33 -1
- package/dist/cjs/component/componentDefinitions/ComparisonSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/FeatureSection9PlusDefinition.js +9 -5
- package/dist/cjs/component/componentDefinitions/FeatureSection9PlusDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/listItemsSectionDefinition.js +10 -5
- package/dist/cjs/component/componentDefinitions/listItemsSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/parse-utils.js +45 -8
- package/dist/cjs/component/componentDefinitions/parse-utils.js.map +1 -1
- package/dist/cjs/component/componentParser.js +15 -0
- package/dist/cjs/component/componentParser.js.map +1 -1
- package/dist/cjs/component/section-definition.js +14 -0
- package/dist/cjs/component/section-definition.js.map +1 -1
- package/dist/cjs/components/ui/MarkdownText.js +41 -42
- package/dist/cjs/components/ui/MarkdownText.js.map +1 -1
- package/dist/cjs/components/ui/UnifiedLink.js +22 -10
- package/dist/cjs/components/ui/UnifiedLink.js.map +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles/base-tokens.css +0 -26
- package/dist/cjs/styles/tailwind-theme.css +0 -17
- package/dist/cjs/utils/markdownPreprocessor.js +162 -8
- package/dist/cjs/utils/markdownPreprocessor.js.map +1 -1
- package/dist/esm/component/componentDefinitions/ComparisonSectionDefinition.js +34 -1
- package/dist/esm/component/componentDefinitions/ComparisonSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/FeatureSection9PlusDefinition.js +10 -6
- package/dist/esm/component/componentDefinitions/FeatureSection9PlusDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/listItemsSectionDefinition.js +11 -6
- package/dist/esm/component/componentDefinitions/listItemsSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/parse-utils.js +44 -8
- package/dist/esm/component/componentDefinitions/parse-utils.js.map +1 -1
- package/dist/esm/component/componentParser.js +15 -0
- package/dist/esm/component/componentParser.js.map +1 -1
- package/dist/esm/component/section-definition.js +13 -1
- package/dist/esm/component/section-definition.js.map +1 -1
- package/dist/esm/components/ui/MarkdownText.js +8 -9
- package/dist/esm/components/ui/MarkdownText.js.map +1 -1
- package/dist/esm/components/ui/UnifiedLink.js +7 -1
- package/dist/esm/components/ui/UnifiedLink.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styles/base-tokens.css +0 -26
- package/dist/esm/styles/tailwind-theme.css +0 -17
- package/dist/esm/utils/markdownPreprocessor.js +160 -8
- package/dist/esm/utils/markdownPreprocessor.js.map +1 -1
- package/dist/types/component/componentDefinitions/ComparisonSectionDefinition.d.ts +2 -2
- package/dist/types/component/componentDefinitions/ComparisonSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/FeatureSection9PlusDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/listItemsSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/parse-utils.d.ts +10 -0
- package/dist/types/component/componentDefinitions/parse-utils.d.ts.map +1 -1
- package/dist/types/component/componentParser.d.ts.map +1 -1
- package/dist/types/component/section-definition.d.ts +13 -1
- package/dist/types/component/section-definition.d.ts.map +1 -1
- package/dist/types/components/ui/MarkdownText.d.ts +13 -0
- package/dist/types/components/ui/MarkdownText.d.ts.map +1 -1
- package/dist/types/components/ui/UnifiedLink.d.ts +1 -1
- package/dist/types/components/ui/UnifiedLink.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/markdownPreprocessor.d.ts +30 -5
- package/dist/types/utils/markdownPreprocessor.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/styles/base-tokens.css +0 -26
- package/src/styles/tailwind-theme.css +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ReactMarkdown","remarkGfm","parseWeb5Url","validateLinkUrl","Web5UrlType","cn","useWeb5Link","useComponentDependencies","DIAGNOSTIC_TYPES","Table","TableHeader","TableBody","TableRow","TableHead","TableCell","UnifiedLink","OptimizedImage","SmartIcon","decodeWeb5Path","path","decodeURIComponent","MarkdownText","_ref","children","markdownChildren","className","codeClassName","isActionRegistered","reportDiagnostic","fixMalformedLinks","markdown","replace","processedMarkdown","urlTransform","url","validated","BROKEN_WEB5_LINK","createElement","remarkPlugins","components","p","_ref2","code","_ref3","inlineClassName","isBlock","includes","pre","_ref4","em","_ref5","strong","_ref6","h1","_ref7","h2","_ref8","h3","_ref9","h4","_ref0","h5","_ref1","h6","_ref10","blockquote","_ref11","table","_ref12","thead","_ref13","tbody","_ref14","tr","_ref15","th","_ref16","td","_ref17","ul","_ref18","ol","_ref19","li","_ref20","a","_ref21","href","parsed","type","ACTION","actionName","UNKNOWN_WEB5_ACTION","variant","hr","img","_ref22","src","alt","ICON","iconHint","label","undefined","IMAGE","IMAGE_RESOLUTION_FAILED","Fragment","filename","objectFit","layout"],"sources":["../../../../src/components/ui/MarkdownText.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { parseWeb5Url, validateLinkUrl } from '../../utils/entityLinkParser';\nimport { Web5UrlType } from '../../types/link-types';\nimport { cn } from '../../lib/utils';\nimport { useWeb5Link } from '../../hooks/useWeb5Link';\nimport { useComponentDependencies } from '../../context/ComponentDependenciesContext';\nimport { DIAGNOSTIC_TYPES } from '../../component/diagnosticTypes';\nimport {\n Table,\n TableHeader,\n TableBody,\n TableRow,\n TableHead,\n TableCell,\n} from './table';\nimport { UnifiedLink } from './UnifiedLink';\nimport { OptimizedImage } from './OptimizedImage';\nimport { SmartIcon } from './SmartIcon';\n\n/** Decode a web5:// url path, tolerating malformed escape sequences. */\nfunction decodeWeb5Path(path: string): string {\n try {\n return decodeURIComponent(path);\n } catch {\n return path;\n }\n}\n\ninterface MarkdownTextProps {\n children: string;\n className?: string;\n codeClassName?: string;\n}\n\nexport const MarkdownText: FC<MarkdownTextProps> = ({\n children: markdownChildren,\n className = '',\n codeClassName = 'bg-muted px-1 py-0.5 rounded text-xs font-mono',\n}) => {\n const { isActionRegistered } = useWeb5Link();\n const { reportDiagnostic } = useComponentDependencies();\n\n // Fix malformed markdown links with space between ] and ( e.g. [text] (url) → [text](url)\n const fixMalformedLinks = (markdown: string): string => {\n return markdown.replace(/\\]\\s+\\(/g, '](');\n };\n\n const processedMarkdown = fixMalformedLinks(markdownChildren);\n // Custom URL transform: only render valid URLs (react-markdown v9+ strips non-http by default)\n const urlTransform = (url: string) => {\n const validated = validateLinkUrl(url);\n if (!validated) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.BROKEN_WEB5_LINK,\n 'markdownText',\n `URL stripped: \"${url}\"`,\n );\n }\n return validated;\n };\n\n return (\n <div className={cn('prose prose-slate max-w-none', className)}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n urlTransform={urlTransform}\n components={{\n p: ({ children }) => (\n <p className=\"mb-4 leading-relaxed\">{children}</p>\n ),\n code: ({ children, className: inlineClassName }) => {\n const isBlock = inlineClassName?.includes('language-');\n if (isBlock) {\n return (\n <code\n className={cn(\n 'block bg-muted p-4 rounded-md text-sm font-mono overflow-x-auto',\n inlineClassName,\n )}\n >\n {children}\n </code>\n );\n }\n return (\n <code className={cn(codeClassName, inlineClassName)}>\n {children}\n </code>\n );\n },\n pre: ({ children }) => {\n return (\n <pre className=\"mb-4 overflow-x-auto [&>code]:block [&>code]:my-0\">\n {children}\n </pre>\n );\n },\n em: ({ children }) => <em className=\"italic\">{children}</em>,\n strong: ({ children }) => (\n <strong className=\"font-bold\">{children}</strong>\n ),\n h1: ({ children }) => (\n <h1 className=\"text-4xl font-bold text-foreground mb-4 mt-6\">\n {children}\n </h1>\n ),\n h2: ({ children }) => (\n <h2 className=\"text-3xl font-bold text-foreground mb-3 mt-6\">\n {children}\n </h2>\n ),\n h3: ({ children }) => (\n <h3 className=\"text-2xl font-semibold text-foreground mb-3 mt-5\">\n {children}\n </h3>\n ),\n h4: ({ children }) => (\n <h4 className=\"text-xl font-semibold text-foreground mb-2 mt-4\">\n {children}\n </h4>\n ),\n h5: ({ children }) => (\n <h5 className=\"text-lg font-semibold text-foreground mb-2 mt-4\">\n {children}\n </h5>\n ),\n h6: ({ children }) => (\n <h6 className=\"text-base font-semibold text-foreground mb-2 mt-3\">\n {children}\n </h6>\n ),\n blockquote: ({ children }) => (\n <blockquote className=\"border-l-4 border-border pl-4 italic text-muted-foreground my-4\">\n {children}\n </blockquote>\n ),\n table: ({ children }) => (\n <div className=\"my-6\">\n <Table>{children}</Table>\n </div>\n ),\n thead: ({ children }) => <TableHeader>{children}</TableHeader>,\n tbody: ({ children }) => <TableBody>{children}</TableBody>,\n tr: ({ children }) => <TableRow>{children}</TableRow>,\n th: ({ children }) => <TableHead>{children}</TableHead>,\n td: ({ children }) => <TableCell>{children}</TableCell>,\n ul: ({ children }) => (\n <ul className=\"list-disc list-outside mb-4 space-y-2 text-foreground pl-6\">\n {children}\n </ul>\n ),\n ol: ({ children }) => (\n <ol className=\"list-decimal list-outside mb-4 space-y-2 text-foreground pl-6\">\n {children}\n </ol>\n ),\n li: ({ children }) => <li className=\"text-foreground\">{children}</li>,\n a: ({ children, href: url }) => {\n // Validate web5://action/ links — render as plain text if unregistered\n if (url) {\n const parsed = parseWeb5Url(url);\n if (\n parsed &&\n parsed.type === Web5UrlType.ACTION &&\n !isActionRegistered(parsed.actionName)\n ) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.UNKNOWN_WEB5_ACTION,\n 'markdownText',\n `Unregistered action: \"${parsed.actionName}\"`,\n );\n return (\n <span className=\"text-muted-foreground\">{children}</span>\n );\n }\n }\n\n return (\n <UnifiedLink href={url} variant=\"inline\">\n {children}\n </UnifiedLink>\n );\n },\n hr: () => <hr className=\"my-6 border-border\" />,\n img: ({ src, alt }) => {\n const parsed = src ? parseWeb5Url(src) : null;\n\n // `web5://icon/…` references a named icon, not a bitmap (KPI /\n // metrics blocks emit these). Render it via SmartIcon, which\n // resolves through the `resolveIcons` dependency and degrades to an\n // empty inline placeholder when no resolver is present — never a\n // broken-image box.\n if (parsed?.type === Web5UrlType.ICON) {\n return (\n <SmartIcon\n iconHint={decodeWeb5Path(parsed.path)}\n label={alt || undefined}\n />\n );\n }\n\n // Only `web5://image/` resolves to a real asset. Any other web5://\n // scheme used as an image source would fall through to a raw\n // <img src=\"web5://…\"> the browser can't load, rendering a \"Failed\n // to load image\" box — skip it (keep the alt text if present).\n if (parsed && parsed.type !== Web5UrlType.IMAGE) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.IMAGE_RESOLUTION_FAILED,\n 'markdownText',\n `Unsupported web5:// image source: \"${src}\"`,\n );\n return alt ? <>{alt}</> : null;\n }\n\n return (\n <span className=\"block my-4\">\n <OptimizedImage\n filename={src ?? ''}\n alt={alt ?? ''}\n className=\"w-full rounded-md\"\n objectFit=\"cover\"\n layout=\"intrinsic\"\n />\n </span>\n );\n },\n }}\n >\n {processedMarkdown}\n </ReactMarkdown>\n </div>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAc,OAAO;AACjC,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,YAAY,EAAEC,eAAe,QAAQ,8BAA8B;AAC5E,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,wBAAwB,QAAQ,4CAA4C;AACrF,SAASC,gBAAgB,QAAQ,iCAAiC;AAClE,SACEC,KAAK,EACLC,WAAW,EACXC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,SAAS,QACJ,SAA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EH,GAAG,IAAII;UAAU,CACzB,CAAC;QAEN;;QAEA;QACA;QACA;QACA;QACA,IAAId,MAAM,IAAIA,MAAM,CAACC,IAAI,KAAKrF,WAAW,CAACmG,KAAK,EAAE;UAC/C3E,gBAAgB,YAAhBA,gBAAgB,CACdpB,gBAAgB,CAACgG,uBAAuB,EACxC,cAAc,EACd,sCAAsCP,GAAG,GAC3C,CAAC;UACD,OAAOC,GAAG,gBAAGnG,KAAA,CAAAsC,aAAA,CAAAtC,KAAA,CAAA0G,QAAA,QAAGP,GAAM,CAAC,GAAG,IAAI;QAChC;QAEA,oBACEnG,KAAA,CAAAsC,aAAA;UAAMZ,SAAS,EAAC;QAAY,gBAC1B1B,KAAA,CAAAsC,aAAA,CAACrB,cAAc;UACb0F,QAAQ,EAAET,GAAG,IAAI,EAAG;UACpBC,GAAG,EAAEA,GAAG,IAAI,EAAG;UACfzE,SAAS,EAAC,mBAAmB;UAC7BkF,SAAS,EAAC,OAAO;UACjBC,MAAM,EAAC;QAAW,CACnB,CACG,CAAC;MAEX;IACF;EAAE,GAED5E,iBACY,CACZ,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","ReactMarkdown","remarkGfm","parseWeb5Url","validateLinkUrl","fixMalformedLinks","Web5UrlType","cn","useWeb5Link","useComponentDependencies","DIAGNOSTIC_TYPES","Table","TableHeader","TableBody","TableRow","TableHead","TableCell","UnifiedLink","OptimizedImage","SmartIcon","decodeWeb5Path","path","decodeURIComponent","MarkdownText","_ref","children","markdownChildren","className","codeClassName","inline","isActionRegistered","reportDiagnostic","processedMarkdown","urlTransform","url","validated","BROKEN_WEB5_LINK","Wrapper","wrapperClassName","undefined","createElement","remarkPlugins","components","p","_ref2","Fragment","code","_ref3","inlineClassName","isBlock","includes","pre","_ref4","em","_ref5","strong","_ref6","h1","_ref7","h2","_ref8","h3","_ref9","h4","_ref0","h5","_ref1","h6","_ref10","blockquote","_ref11","table","_ref12","thead","_ref13","tbody","_ref14","tr","_ref15","th","_ref16","td","_ref17","ul","_ref18","ol","_ref19","li","_ref20","a","_ref21","href","parsed","type","ACTION","actionName","UNKNOWN_WEB5_ACTION","variant","hr","img","_ref22","src","alt","ICON","iconHint","label","IMAGE","IMAGE_RESOLUTION_FAILED","filename","objectFit","layout"],"sources":["../../../../src/components/ui/MarkdownText.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { parseWeb5Url, validateLinkUrl } from '../../utils/entityLinkParser';\nimport { fixMalformedLinks } from '../../utils/markdownPreprocessor';\nimport { Web5UrlType } from '../../types/link-types';\nimport { cn } from '../../lib/utils';\nimport { useWeb5Link } from '../../hooks/useWeb5Link';\nimport { useComponentDependencies } from '../../context/ComponentDependenciesContext';\nimport { DIAGNOSTIC_TYPES } from '../../component/diagnosticTypes';\nimport {\n Table,\n TableHeader,\n TableBody,\n TableRow,\n TableHead,\n TableCell,\n} from './table';\nimport { UnifiedLink } from './UnifiedLink';\nimport { OptimizedImage } from './OptimizedImage';\nimport { SmartIcon } from './SmartIcon';\n\n/** Decode a web5:// url path, tolerating malformed escape sequences. */\nfunction decodeWeb5Path(path: string): string {\n try {\n return decodeURIComponent(path);\n } catch {\n return path;\n }\n}\n\ninterface MarkdownTextProps {\n children: string;\n className?: string;\n codeClassName?: string;\n /**\n * Render a single line of *inline* markdown — links, bold, italic, code —\n * with no `prose` wrapper and no paragraph margins.\n *\n * The default (block) mode wraps output in `prose prose-slate`, which sets\n * its own font size and body color. That is right for a standalone passage\n * and wrong inside text the caller has already styled: a list item body or a\n * label would silently lose its variant's size, weight and theme color to\n * prose's slate palette. Use `inline` there so the surrounding element keeps\n * control of typography, and keep the content to one line — block markdown\n * (lists, tables, headings) has no place inside a span.\n */\n inline?: boolean;\n}\n\nexport const MarkdownText: FC<MarkdownTextProps> = ({\n children: markdownChildren,\n className = '',\n codeClassName = 'bg-muted px-1 py-0.5 rounded text-xs font-mono',\n inline = false,\n}) => {\n const { isActionRegistered } = useWeb5Link();\n const { reportDiagnostic } = useComponentDependencies();\n\n const processedMarkdown = fixMalformedLinks(markdownChildren);\n // Custom URL transform: only render valid URLs (react-markdown v9+ strips non-http by default)\n const urlTransform = (url: string) => {\n const validated = validateLinkUrl(url);\n if (!validated) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.BROKEN_WEB5_LINK,\n 'markdownText',\n `URL stripped: \"${url}\"`,\n );\n }\n return validated;\n };\n\n const Wrapper = inline ? 'span' : 'div';\n const wrapperClassName = inline\n ? className || undefined\n : cn('prose prose-slate max-w-none', className);\n\n return (\n <Wrapper className={wrapperClassName}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n urlTransform={urlTransform}\n components={{\n p: ({ children }) =>\n inline ? (\n <>{children}</>\n ) : (\n <p className=\"mb-4 leading-relaxed\">{children}</p>\n ),\n code: ({ children, className: inlineClassName }) => {\n const isBlock = inlineClassName?.includes('language-');\n if (isBlock) {\n return (\n <code\n className={cn(\n 'block bg-muted p-4 rounded-md text-sm font-mono overflow-x-auto',\n inlineClassName,\n )}\n >\n {children}\n </code>\n );\n }\n return (\n <code className={cn(codeClassName, inlineClassName)}>\n {children}\n </code>\n );\n },\n pre: ({ children }) => {\n return (\n <pre className=\"mb-4 overflow-x-auto [&>code]:block [&>code]:my-0\">\n {children}\n </pre>\n );\n },\n em: ({ children }) => <em className=\"italic\">{children}</em>,\n strong: ({ children }) => (\n <strong className=\"font-bold\">{children}</strong>\n ),\n h1: ({ children }) => (\n <h1 className=\"text-4xl font-bold text-foreground mb-4 mt-6\">\n {children}\n </h1>\n ),\n h2: ({ children }) => (\n <h2 className=\"text-3xl font-bold text-foreground mb-3 mt-6\">\n {children}\n </h2>\n ),\n h3: ({ children }) => (\n <h3 className=\"text-2xl font-semibold text-foreground mb-3 mt-5\">\n {children}\n </h3>\n ),\n h4: ({ children }) => (\n <h4 className=\"text-xl font-semibold text-foreground mb-2 mt-4\">\n {children}\n </h4>\n ),\n h5: ({ children }) => (\n <h5 className=\"text-lg font-semibold text-foreground mb-2 mt-4\">\n {children}\n </h5>\n ),\n h6: ({ children }) => (\n <h6 className=\"text-base font-semibold text-foreground mb-2 mt-3\">\n {children}\n </h6>\n ),\n blockquote: ({ children }) => (\n <blockquote className=\"border-l-4 border-border pl-4 italic text-muted-foreground my-4\">\n {children}\n </blockquote>\n ),\n table: ({ children }) => (\n <div className=\"my-6\">\n <Table>{children}</Table>\n </div>\n ),\n thead: ({ children }) => <TableHeader>{children}</TableHeader>,\n tbody: ({ children }) => <TableBody>{children}</TableBody>,\n tr: ({ children }) => <TableRow>{children}</TableRow>,\n th: ({ children }) => <TableHead>{children}</TableHead>,\n td: ({ children }) => <TableCell>{children}</TableCell>,\n ul: ({ children }) => (\n <ul className=\"list-disc list-outside mb-4 space-y-2 text-foreground pl-6\">\n {children}\n </ul>\n ),\n ol: ({ children }) => (\n <ol className=\"list-decimal list-outside mb-4 space-y-2 text-foreground pl-6\">\n {children}\n </ol>\n ),\n li: ({ children }) => <li className=\"text-foreground\">{children}</li>,\n a: ({ children, href: url }) => {\n // Validate web5://action/ links — render as plain text if unregistered\n if (url) {\n const parsed = parseWeb5Url(url);\n if (\n parsed &&\n parsed.type === Web5UrlType.ACTION &&\n !isActionRegistered(parsed.actionName)\n ) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.UNKNOWN_WEB5_ACTION,\n 'markdownText',\n `Unregistered action: \"${parsed.actionName}\"`,\n );\n return (\n <span className=\"text-muted-foreground\">{children}</span>\n );\n }\n }\n\n return (\n <UnifiedLink href={url} variant=\"inline\">\n {children}\n </UnifiedLink>\n );\n },\n hr: () => <hr className=\"my-6 border-border\" />,\n img: ({ src, alt }) => {\n const parsed = src ? parseWeb5Url(src) : null;\n\n // `web5://icon/…` references a named icon, not a bitmap (KPI /\n // metrics blocks emit these). Render it via SmartIcon, which\n // resolves through the `resolveIcons` dependency and degrades to an\n // empty inline placeholder when no resolver is present — never a\n // broken-image box.\n if (parsed?.type === Web5UrlType.ICON) {\n return (\n <SmartIcon\n iconHint={decodeWeb5Path(parsed.path)}\n label={alt || undefined}\n />\n );\n }\n\n // Only `web5://image/` resolves to a real asset. Any other web5://\n // scheme used as an image source would fall through to a raw\n // <img src=\"web5://…\"> the browser can't load, rendering a \"Failed\n // to load image\" box — skip it (keep the alt text if present).\n if (parsed && parsed.type !== Web5UrlType.IMAGE) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.IMAGE_RESOLUTION_FAILED,\n 'markdownText',\n `Unsupported web5:// image source: \"${src}\"`,\n );\n return alt ? <>{alt}</> : null;\n }\n\n return (\n <span className=\"block my-4\">\n <OptimizedImage\n filename={src ?? ''}\n alt={alt ?? ''}\n className=\"w-full rounded-md\"\n objectFit=\"cover\"\n layout=\"intrinsic\"\n />\n </span>\n );\n },\n }}\n >\n {processedMarkdown}\n </ReactMarkdown>\n </Wrapper>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAc,OAAO;AACjC,OAAOC,aAAa,MAAM,gBAAgB;AAC1C,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,YAAY,EAAEC,eAAe,QAAQ,8BAA8B;AAC5E,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,wBAAwB,QAAQ,4CAA4C;AACrF,SAASC,gBAAgB,QAAQ,iCAAiC;AAClE,SACEC,KAAK,EACLC,WAAW,EACXC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,SAAS,QACJ,SAAS;AAChB,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,SAAS,QAAQ,aAAa;;AAEvC;AACA,SAASC,cAAcA,CAACC,IAAY,EAAU;EAC5C,IAAI;IACF,OAAOC,kBAAkB,CAACD,IAAI,CAA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MAAM,IAAIA,MAAM,CAACC,IAAI,KAAKvF,WAAW,CAACoG,KAAK,EAAE;UAC/C3E,gBAAgB,YAAhBA,gBAAgB,CACdrB,gBAAgB,CAACiG,uBAAuB,EACxC,cAAc,EACd,sCAAsCN,GAAG,GAC3C,CAAC;UACD,OAAOC,GAAG,gBAAGtG,KAAA,CAAAwC,aAAA,CAAAxC,KAAA,CAAA6C,QAAA,QAAGyD,GAAM,CAAC,GAAG,IAAI;QAChC;QAEA,oBACEtG,KAAA,CAAAwC,aAAA;UAAMb,SAAS,EAAC;QAAY,gBAC1B3B,KAAA,CAAAwC,aAAA,CAACtB,cAAc;UACb0F,QAAQ,EAAEP,GAAG,IAAI,EAAG;UACpBC,GAAG,EAAEA,GAAG,IAAI,EAAG;UACf3E,SAAS,EAAC,mBAAmB;UAC7BkF,SAAS,EAAC,OAAO;UACjBC,MAAM,EAAC;QAAW,CACnB,CACG,CAAC;MAEX;IACF;EAAE,GAED9E,iBACY,CACR,CAAC;AAEd,CAAC","ignoreList":[]}
|
|
@@ -52,7 +52,13 @@ export function UnifiedLink(_ref) {
|
|
|
52
52
|
} = useComponentDependencies();
|
|
53
53
|
if (!validateLinkUrl(href)) {
|
|
54
54
|
reportDiagnostic == null || reportDiagnostic(DIAGNOSTIC_TYPES.BROKEN_WEB5_LINK, 'unifiedLink', `link rejected: "${href}"`);
|
|
55
|
-
|
|
55
|
+
// Degrade to the label as plain text rather than dropping it. Returning
|
|
56
|
+
// null used to delete the children too, so a bad href silently removed
|
|
57
|
+
// words from the middle of a sentence — the reader lost prose, not just a
|
|
58
|
+
// link. An unclickable phrase is the smaller failure.
|
|
59
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
60
|
+
className: className
|
|
61
|
+
}, children);
|
|
56
62
|
}
|
|
57
63
|
const resolvedHref = resolveUrl(href) ?? href;
|
|
58
64
|
const linkType = linkTypeProp ?? detectLinkType(href);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","isWeb5AskUrl","isWeb5ActionUrl","validateLinkUrl","cn","useWeb5Link","useComponentDependencies","DIAGNOSTIC_TYPES","ArrowUpIcon","ArrowTopRightIcon","LinkType","ARROW_BY_TYPE","ASK","ACTION","NAVIGATE","detectLinkType","href","UnifiedLink","_ref","linkType","linkTypeProp","variant","active","hideArrow","className","children","onClick","props","handleLinkClick","resolveUrl","reportDiagnostic","BROKEN_WEB5_LINK","resolvedHref","ArrowIcon","showArrow","safeHref","startsWith","handleClick","e","defaultPrevented","
|
|
1
|
+
{"version":3,"names":["React","isWeb5AskUrl","isWeb5ActionUrl","validateLinkUrl","cn","useWeb5Link","useComponentDependencies","DIAGNOSTIC_TYPES","ArrowUpIcon","ArrowTopRightIcon","LinkType","ARROW_BY_TYPE","ASK","ACTION","NAVIGATE","detectLinkType","href","UnifiedLink","_ref","linkType","linkTypeProp","variant","active","hideArrow","className","children","onClick","props","handleLinkClick","resolveUrl","reportDiagnostic","BROKEN_WEB5_LINK","createElement","resolvedHref","ArrowIcon","showArrow","safeHref","startsWith","handleClick","e","defaultPrevented","_extends"],"sources":["../../../../src/components/ui/UnifiedLink.tsx"],"sourcesContent":["import React from 'react';\nimport { isWeb5AskUrl, isWeb5ActionUrl } from '../../types/link-types';\nimport { validateLinkUrl } from '../../utils/entityLinkParser';\nimport { cn } from '../../lib/utils';\nimport { useWeb5Link } from '../../hooks/useWeb5Link';\nimport { useComponentDependencies } from '../../context/ComponentDependenciesContext';\nimport { DIAGNOSTIC_TYPES } from '../../component/diagnosticTypes';\nimport { ArrowUpIcon } from './icons/ArrowUpIcon';\nimport { ArrowTopRightIcon } from './icons/ArrowTopRightIcon';\n\nexport enum LinkType {\n ASK = 'ask',\n ACTION = 'action',\n NAVIGATE = 'navigate',\n}\n\nexport type LinkVariant = 'primary' | 'secondary' | 'inline';\n\nexport interface UnifiedLinkProps\n extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n href?: string;\n /** Override auto-detected link type */\n linkType?: LinkType;\n /** Visual variant */\n variant?: LinkVariant;\n /** Whether this is the first/active item (dark bg). Only applies to primary variant. */\n active?: boolean;\n /** Hide the arrow icon */\n hideArrow?: boolean;\n children: React.ReactNode;\n}\n\nconst ARROW_BY_TYPE: Record<\n LinkType,\n React.FC<React.SVGProps<SVGSVGElement>>\n> = {\n [LinkType.ASK]: ArrowUpIcon,\n [LinkType.ACTION]: ArrowTopRightIcon,\n [LinkType.NAVIGATE]: ArrowUpIcon,\n};\n\nexport function detectLinkType(href: string | undefined): LinkType {\n if (!href) {\n return LinkType.NAVIGATE;\n }\n if (isWeb5AskUrl(href)) {\n return LinkType.ASK;\n }\n if (isWeb5ActionUrl(href)) {\n return LinkType.ACTION;\n }\n return LinkType.NAVIGATE;\n}\n\nexport function UnifiedLink({\n href,\n linkType: linkTypeProp,\n variant = 'primary',\n active = false,\n hideArrow,\n className,\n children,\n onClick,\n ...props\n}: UnifiedLinkProps) {\n const { handleLinkClick, resolveUrl } = useWeb5Link();\n const { reportDiagnostic } = useComponentDependencies();\n\n if (!validateLinkUrl(href)) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.BROKEN_WEB5_LINK,\n 'unifiedLink',\n `link rejected: \"${href}\"`,\n );\n // Degrade to the label as plain text rather than dropping it. Returning\n // null used to delete the children too, so a bad href silently removed\n // words from the middle of a sentence — the reader lost prose, not just a\n // link. An unclickable phrase is the smaller failure.\n return <span className={className}>{children}</span>;\n }\n\n const resolvedHref = resolveUrl(href) ?? href;\n const linkType = linkTypeProp ?? detectLinkType(href);\n const ArrowIcon = ARROW_BY_TYPE[linkType];\n const showArrow = !hideArrow && variant !== 'inline';\n\n // web5:// hrefs must never reach the browser — Safari iOS attempts custom-scheme\n // navigation before JS fires, producing an \"address is invalid\" error.\n const safeHref = href?.startsWith('web5://') ? '#' : resolvedHref;\n\n const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n onClick?.(e);\n if (!e.defaultPrevented && resolvedHref) {\n handleLinkClick(e, resolvedHref);\n }\n };\n\n if (variant === 'inline') {\n return (\n <a\n href={safeHref}\n className={cn(\n 'text-primary underline underline-offset-4 hover:text-primary/80 cursor-pointer',\n className,\n )}\n onClick={handleClick}\n {...props}\n >\n {children}\n </a>\n );\n }\n\n if (variant === 'secondary') {\n return (\n <a\n href={safeHref}\n className={cn(\n 'inline w-fit cursor-pointer',\n 'text-sm leading-[18px] text-text-accent',\n className,\n )}\n onClick={handleClick}\n {...props}\n >\n {children}\n {showArrow && (\n <span className=\"inline whitespace-nowrap\">\n \n <ArrowIcon className=\"ml-0.5 inline-block size-4 align-middle\" />\n </span>\n )}\n </a>\n );\n }\n\n // Primary variant — pill with arrow circle and hover overlay\n return (\n <a\n href={safeHref}\n className={cn(\n 'group relative flex md:w-fit md:max-w-[500px] items-center justify-between rounded-[80px] pl-5 pr-[3px] py-[3px] gap-2 cursor-pointer overflow-hidden',\n 'text-sm leading-[14px]',\n active\n ? 'bg-text-accent text-white'\n : 'bg-white border border-text-accent/30 text-text-accent',\n className,\n )}\n onClick={handleClick}\n {...props}\n >\n {/* Hover overlay — expands from right (arrow) to fill pill */}\n <span\n className={cn(\n 'absolute inset-[3px] rounded-[80px] pointer-events-none',\n 'origin-right scale-x-0 group-hover:scale-x-100',\n 'transition-transform duration-300 ease-out',\n active ? 'bg-text-accent-hover' : 'bg-text-accent/10',\n )}\n />\n <span className=\"relative z-[1] min-w-0 py-[10px] truncate\">\n {children}\n </span>\n {showArrow && (\n <span\n className={cn(\n 'relative z-[1] flex items-center justify-center rounded-full shrink-0',\n 'size-[34px] p-2.5',\n active ? 'bg-text-accent-hover' : 'bg-text-accent/10',\n )}\n >\n <ArrowIcon className=\"size-4\" />\n </span>\n )}\n </a>\n );\n}\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,eAAe,QAAQ,wBAAwB;AACtE,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ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;MAAMR,SAAS,EAAC;IAA0B,GAAC,MAEzC,eAAAxB,KAAA,CAAAgC,aAAA,CAACE,SAAS;MAACV,SAAS,EAAC;IAAyC,CAAE,CAC5D,CAEP,CAAC;EAER;;EAEA;EACA,oBACExB,KAAA,CAAAgC,aAAA,MAAAS,QAAA;IACEzB,IAAI,EAAEoB,QAAS;IACfZ,SAAS,EAAEpB,EAAE,CACX,uJAAuJ,EACvJ,wBAAwB,EACxBkB,MAAM,GACF,2BAA2B,GAC3B,wDAAwD,EAC5DE,SACF,CAAE;IACFE,OAAO,EAAEY;EAAY,GACjBX,KAAK,gBAGT3B,KAAA,CAAAgC,aAAA;IACER,SAAS,EAAEpB,EAAE,CACX,yDAAyD,EACzD,gDAAgD,EAChD,4CAA4C,EAC5CkB,MAAM,GAAG,sBAAsB,GAAG,mBACpC;EAAE,CACH,CAAC,eACFtB,KAAA,CAAAgC,aAAA;IAAMR,SAAS,EAAC;EAA2C,GACxDC,QACG,CAAC,EACNU,SAAS,iBACRnC,KAAA,CAAAgC,aAAA;IACER,SAAS,EAAEpB,EAAE,CACX,uEAAuE,EACvE,mBAAmB,EACnBkB,MAAM,GAAG,sBAAsB,GAAG,mBACpC;EAAE,gBAEFtB,KAAA,CAAAgC,aAAA,CAACE,SAAS;IAACV,SAAS,EAAC;EAAQ,CAAE,CAC3B,CAEP,CAAC;AAER","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export { getPartsByType, getPartByRole, getAllByRole, getHeading, getImages, get
|
|
|
11
11
|
|
|
12
12
|
// Section definition
|
|
13
13
|
|
|
14
|
+
export { DROP_SECTION } from './component/section-definition.js';
|
|
15
|
+
|
|
14
16
|
// Diagnostic types
|
|
15
17
|
export { DIAGNOSTIC_TYPES } from './component/diagnosticTypes.js';
|
|
16
18
|
// Image search filters
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CLIENT_IDS","EXPERIMENT_IDS","createFeatureToggleReader","FeatureToggleProvider","useFeatureToggles","useFeatureToggle","getPartsByType","getPartByRole","getAllByRole","getHeading","getImages","getLinks","extractContent","extractContentMarkdown","deriveRole","DIAGNOSTIC_TYPES","buildImageSearchFilter","ImageSearchFilterToken","backgroundFilter","HeroSectionDefinition","HeroEntitySectionDefinition","KpiSectionDefinition","FeatureCardsSectionDefinition","EntitySectionDefinition","EntityCollectionSectionDefinition","ComparisonSectionDefinition","TextBlockSectionDefinition","CtaBannerSectionDefinition","CalloutSectionDefinition","NextStepsSectionDefinition","FeatureSection9PlusDefinition","ListItemsSectionDefinition","SkipNodesSectionDefinition","HtmlCommentSectionDefinition","SearchSectionDefinition","ErrorSectionDefinition","FallbackSectionDefinition","createSdkRegistry","ComponentRegistry","validatePattern","validatePatternSyntax","validatePatternWithBlocks","convertToBlockElements","convertToBlockElementsWithMapping","Web5UrlType","isWeb5AskUrl","isWeb5EntityUrl","isWeb5ImageUrl","isWeb5IconUrl","isWeb5ActionUrl","isWeb5SearchUrl","isWeb5Url","isNavigableUrl","isValidLinkUrl","isLegacyUrl","parseWeb5Url","isValidWeb5Url","validateLinkUrl","isEntityLink","parseEntityLink","extractProtocol","extractLinkMetadata","findInvalidWeb5Links","hasImage","isHtmlComment","matchMarkdown","matchAllSections","nodesToParts","ComponentDependenciesProvider","useComponentDependencies","UserQueryProvider","useUserQuery","ChipsProvider","useChips","defaultExtractor","enrichEntitiesFromPayload","fetchEntityListData","listEntityItems","LIST_ITEMS_ENDPOINT","getEntityExtractor","registerEntityExtractor","transformToSolutionEntityData","transformToBlogPostEntityData","transformToGenericEntityData","CALLOUT_KINDS","useWeb5Link","useConversation","useDebugImageContext","useResolvedImageSources","useResolveGenericEntityData","useEntityTransforms","useMarkdownUtils","useResolveShopifyEntityData","useResolveSearchSpringEntityData","fetchProductsByHandles","fetchProductsByHandlesMap","transformSSProductToEntityItemData","addToCart","ShopifyStorefrontClient","resolveShopifyConfig","resolveShopifyEntity","transformShopifyProduct","transformShopifyCollection","transformShopifyArticle","transformShopifyEntityToItemData","PRODUCT_BY_HANDLE_QUERY","COLLECTION_BY_HANDLE_QUERY","ARTICLE_BY_HANDLE_QUERY","cn","normalizeImageUrl","getResizedImageUrl","analyzeBackdrop","computeContentBBox","buildProbeUrl","loadImagePixels","loadBackdropAnalysis","stripMarkdown","rgbToHsl","hslToRgb","ensureMinLightness","toRgb","deriveDarkColor","deriveDarkGradient","deriveLightColor","pushEvent","pushPromptSubmit","pushLinkClick","pushError","pushExit","pushEntityFiltered","hasAnalyticsConsent","ERROR_MARKDOWN","getErrorTypeFromStatus","createErrorMarkdown","STREAMING_TIMEOUT_MS","DEFAULT_ERROR_TEMPLATES","resolveErrorTemplate","getForwardStack","setForwardStack","clearForwardStack","pushToForwardStack","popFromForwardStack","UserQuery","PRODUCT_BACK_SESSION_KEY","writeProductBackHandoff","readProductBackHandoff","PromptEntryEmptyState","SearchSection","FeedbackBar","Disclaimer","BottomContainer","MarkdownText","CalloutBlock","OptimizedImage","SectionSkeleton","SmartIcon","Loader","PlacementLoader","UnifiedLink","detectLinkType","LinkType","Table","TableHeader","TableBody","TableFooter","TableHead","TableRow","TableCell","TableCaption","WEB5_USER_QUERY_EVENT","WEB5_ANSWER_UPDATED_EVENT","WEB5_REDIRECT_EVENT","loadClientBundle","getClientBundleOverride","isTrustedBundleHost","TEMPLATES_CDN_BASE","TEMPLATES_MANIFEST_URL","getTemplateOverride","isTemplatePickerRequested","isValidTemplateId","resolveClientBundleUrl","mergeClientConfig","applyThemeOverrides","THEME_OVERRIDE_TOKENS","PlacementResponseRenderer","PlacementSmoothHeight","buildPlacementDependencies","PlacementPayloadProvider","usePlacementPayload","UnifiedMarkdownParser","parseMarkdownToAst","parseAstToMarkdown","escapeWeb5Links","fixMalformedLinks","trimTrailingWhitespace","normalizeIconUrls","decodeLinkText","preprocessMarkdown","ComponentTracking","findKeywordsInContent","getContextualImageFilename","extractIntentFromMarkdown","getIntentFromMarkdown","createPageSection","generateSectionId","generateId","findImageInNode","findImageInChildren","DiagnosticsCollector","REFRESH_PROMPTS_UNTIL_KEY","REFRESH_PROMPTS_WINDOW_MS","getRefreshPromptsExpiry","shouldRefreshPrompts","enableRefreshPrompts","disableRefreshPrompts","BACKEND_ENVIRONMENT_KEY","BACKEND_ENVIRONMENT_QUERY_PARAM","DEFAULT_BACKEND_ENVIRONMENT","getBackendEnvironment","setBackendEnvironment","usesStagingBackend","MATCH_DEBUG_KEY","MATCH_DEBUG_QUERY_PARAM","isMatchDebugEnabled","setMatchDebug","resetMatchDebugCache","logMatchDebug","createWixAuthFetch","getOrCreateSessionId","getSessionId","getChatId","startNewChatId","setChatId","resetChatIdForTests","parseMarkdownToComponents","tryParseComponent","mergeSectionsWithStableReferences","WEB5_ROOT_ID","WEB5_ROOT_CLASS","WEB5_SCOPES","WEB5_SCOPE","WEB5_GLOBAL_TOKENS"],"sources":["../../src/index.ts"],"sourcesContent":["// Client IDs and experiment IDs\nexport { CLIENT_IDS, EXPERIMENT_IDS } from './clients';\n\nexport {\n type EmbedFeatureToggleResult,\n type FeatureToggleReader,\n createFeatureToggleReader,\n FeatureToggleProvider,\n useFeatureToggles,\n useFeatureToggle,\n} from './featureToggles/FeatureToggleContext';\n\n// Dev-only chrome injection contract for client packages\nexport type { DevEnvironment } from './client/devEnvironment';\n\n// Part types and helpers\nexport {\n type PartType,\n type Part,\n type HeadingPart,\n type ImagePart,\n type LinkPart,\n type ListPart,\n type ListItemPart,\n type KpiItemPart,\n type CardPart,\n type IconPart,\n type CalloutPart,\n type EntityPart,\n getPartsByType,\n getPartByRole,\n getAllByRole,\n getHeading,\n getImages,\n getLinks,\n extractContent,\n extractContentMarkdown,\n deriveRole,\n} from './parts/parts';\n\n// Component types\nexport type {\n BaseCompProps,\n SlotCompProps,\n SectionCompProps,\n SectionCompPropsWithSlot,\n TextCompProps,\n ButtonCompProps,\n ImageCompProps,\n BadgeCompProps,\n HeroButton,\n KpiItemCompProps,\n FeatureItemCompProps,\n FeatureCardCompProps,\n EntityItemData,\n EntityItem,\n GenericEntityData,\n GenericEntityCompProps,\n ComparisonRow,\n ComparisonColumn,\n AiNarrativeCompProps,\n HeroCompProps,\n HeroEntityCompProps,\n KpiCompProps,\n FeatureCardsCompProps,\n EntityCompProps,\n ComparisonCompProps,\n TextBlockCompProps,\n Component,\n BaseComponent,\n SlotComponent,\n SectionComponent,\n TextComponent,\n ButtonComponent,\n ImageComponent,\n BadgeComponent,\n KpiItemComponent,\n FeatureItemComponent,\n FeatureCardComponent,\n GenericEntityComponent,\n AiNarrativeComponent,\n ComparisonSectionComponent,\n TextBlockSectionComponent,\n HeroSectionComponent,\n HeroEntitySectionComponent,\n KpiSectionComponent,\n FeatureCardsSectionComponent,\n EntitySectionComponent,\n PropsOf,\n SectionFixture,\n CtaBannerCompProps,\n CtaBannerSectionComponent,\n CalloutCompProps,\n CalloutSectionComponent,\n NextStepsCompProps,\n NextStepsSectionComponent,\n FeatureSection9PlusCompProps,\n FeatureSection9PlusSectionComponent,\n ListItemsSectionCompProps,\n ListItemsSectionComponent,\n ErrorCompProps,\n ErrorSectionComponent,\n NullCompProps,\n NullSectionComponent,\n SolutionEntityCompProps,\n SolutionEntitySectionComponent,\n SolutionEntityData,\n BlogEntityCompProps,\n BlogEntitySectionComponent,\n BlogEntityData,\n GeneralTextCompProps,\n GeneralTextSectionComponent,\n PersonalizedNarrativeCompProps,\n PersonalizedNarrativeSectionComponent,\n} from './component/types';\n\n// Section definition\nexport type {\n SectionDefinition,\n ParseContext,\n ContextualImageResult,\n} from './component/section-definition';\n\n// Diagnostic types\nexport { DIAGNOSTIC_TYPES } from './component/diagnosticTypes';\nexport type { DiagnosticType } from './component/diagnosticTypes';\n\n// Image search filters\nexport {\n buildImageSearchFilter,\n type ImageSearchFilterString,\n} from './image/imageSearchFilterTypes';\nexport {\n ImageSearchFilterToken,\n backgroundFilter,\n} from './image/imageSearchFilters';\nexport type {\n ContextualImageAsset,\n ImageSourceInput,\n ResolvedImageSource,\n ResolvedImageSourceKind,\n} from './image/contextualImageTypes';\n\n// Section definition classes + createSdkRegistry\nexport {\n HeroSectionDefinition,\n HeroEntitySectionDefinition,\n KpiSectionDefinition,\n FeatureCardsSectionDefinition,\n EntitySectionDefinition,\n EntityCollectionSectionDefinition,\n ComparisonSectionDefinition,\n TextBlockSectionDefinition,\n CtaBannerSectionDefinition,\n CalloutSectionDefinition,\n NextStepsSectionDefinition,\n FeatureSection9PlusDefinition,\n ListItemsSectionDefinition,\n SkipNodesSectionDefinition,\n HtmlCommentSectionDefinition,\n SearchSectionDefinition,\n ErrorSectionDefinition,\n FallbackSectionDefinition,\n createSdkRegistry,\n} from './component/componentDefinitions';\n\n// Registry\nexport { ComponentRegistry } from './registry';\nexport type {\n SlotOptions,\n SectionOptions,\n SectionRegistration,\n SlotNode,\n SlotIntentNode,\n SectionIntentNode,\n SectionNode,\n SlotVariant,\n SectionVariant,\n RegistryCatalog,\n ActionResult,\n ActionHandler,\n} from './registry';\n\n// Pattern validator\nexport {\n validatePattern,\n validatePatternSyntax,\n validatePatternWithBlocks,\n type PatternValidationResult,\n type BlockElement,\n type EnrichedBlockElement,\n type LinkMetadata,\n type LinkAttribute,\n} from './patternValidator';\n\n// Markdown blocks\nexport {\n convertToBlockElements,\n convertToBlockElementsWithMapping,\n type BlockElementsWithMapping,\n} from './markdownBlocks';\n\n// Link types, enum & guards\nexport {\n Web5UrlType,\n type Web5AskUrl,\n type Web5EntityUrl,\n type Web5ImageUrl,\n type Web5IconUrl,\n type Web5ActionUrl,\n type Web5SearchUrl,\n type Web5Url,\n type HttpsUrl,\n type HttpUrl,\n type MailtoUrl,\n type RelativeUrl,\n type NavigableUrl,\n type ValidLinkUrl,\n type AnyKnownUrl,\n type LegacyUrl,\n isWeb5AskUrl,\n isWeb5EntityUrl,\n isWeb5ImageUrl,\n isWeb5IconUrl,\n isWeb5ActionUrl,\n isWeb5SearchUrl,\n isWeb5Url,\n isNavigableUrl,\n isValidLinkUrl,\n isLegacyUrl,\n} from './types/link-types';\n\n// Entity/URL parsing\nexport {\n parseWeb5Url,\n isValidWeb5Url,\n validateLinkUrl,\n type Web5UrlParsed,\n type Web5AskParsed,\n type Web5EntityParsed,\n type Web5ImageParsed,\n type Web5IconParsed,\n type Web5ActionParsed,\n type Web5SearchParsed,\n isEntityLink,\n parseEntityLink,\n extractProtocol,\n extractLinkMetadata,\n} from './utils/entityLinkParser';\n\n// Web5 link validation\nexport {\n findInvalidWeb5Links,\n type InvalidWeb5Link,\n} from './utils/web5LinkValidator';\n\n// Node matchers\nexport { hasImage, isHtmlComment } from './utils/nodeMatchers';\n\n// Match API\nexport {\n matchMarkdown,\n type MarkdownMatchResult,\n matchAllSections,\n type MatchAllSectionsResult,\n nodesToParts,\n} from './match';\n\n// ---------------------------------------------------------------------------\n// DI Infrastructure (moved from @wix/w5-client-circana)\n// ---------------------------------------------------------------------------\n\n// DI context and provider\nexport {\n ComponentDependenciesProvider,\n useComponentDependencies,\n type ComponentDependenciesProviderProps,\n} from './context/ComponentDependenciesContext';\n\n// Raw user query for the current response page\nexport {\n UserQueryProvider,\n useUserQuery,\n type UserQueryProviderProps,\n} from './context/UserQueryContext';\n\n// Chips context (suggestion chips shared between SearchSection and error states)\nexport {\n ChipsProvider,\n useChips,\n type SuggestionChip,\n} from './context/ChipsContext';\n\n// DI types\nexport type {\n ComponentDependencies,\n Web5LinkApi,\n ConversationApi,\n SendMessageTrackingOptions,\n SendMessageOptions,\n ComparisonSubmitPayload,\n ComparisonSelectedProduct,\n ProductComparisonSelectionState,\n ProductComparisonApi,\n EntityTransforms,\n MarkdownUtils,\n ResolveGenericEntityDataOptions,\n} from './types/dependencies';\nexport type {\n ApiPayloadItem,\n EntityTypeConfig,\n EntityConfig,\n EntityExtractionContext,\n} from './types/entity';\nexport {\n defaultExtractor,\n enrichEntitiesFromPayload,\n fetchEntityListData,\n listEntityItems,\n LIST_ITEMS_ENDPOINT,\n getEntityExtractor,\n registerEntityExtractor,\n transformToSolutionEntityData,\n transformToBlogPostEntityData,\n transformToGenericEntityData,\n} from './entity';\nexport type {\n EntityExtractor,\n FetchEntityListDataOptions,\n ListEntityItemsOptions,\n} from './entity';\nexport { CALLOUT_KINDS, type CalloutKind, type Callout } from './types/callout';\n\n// Wrapper hooks\nexport { useWeb5Link } from './hooks/useWeb5Link';\nexport { useConversation } from './hooks/useConversation';\nexport { useDebugImageContext } from './hooks/useDebugImageContext';\nexport { useResolvedImageSources } from './hooks/useResolvedImageSources';\nexport { useResolveGenericEntityData } from './hooks/useResolveGenericEntityData';\nexport { useEntityTransforms } from './hooks/useEntityTransforms';\nexport { useMarkdownUtils } from './hooks/useMarkdownUtils';\nexport { useResolveShopifyEntityData } from './hooks/useResolveShopifyEntityData';\nexport { useResolveSearchSpringEntityData } from './hooks/useResolveSearchSpringEntityData';\n\n// SearchSpring\nexport {\n fetchProductsByHandles,\n fetchProductsByHandlesMap,\n transformSSProductToEntityItemData,\n} from './services/searchspring';\nexport type {\n SearchSpringConfig,\n SSProduct,\n SSSearchResponse,\n SSSizeData,\n} from './services/searchspring';\n\n// Shopify Storefront API\n// Cart actions\nexport { addToCart } from './services/cart';\n\nexport {\n ShopifyStorefrontClient,\n resolveShopifyConfig,\n resolveShopifyEntity,\n transformShopifyProduct,\n transformShopifyCollection,\n transformShopifyArticle,\n transformShopifyEntityToItemData,\n PRODUCT_BY_HANDLE_QUERY,\n COLLECTION_BY_HANDLE_QUERY,\n ARTICLE_BY_HANDLE_QUERY,\n} from './services/shopify';\nexport type {\n ShopifyStorefrontConfig,\n ShopifyProduct,\n ShopifyCollection,\n ShopifyArticle,\n ShopifyImage,\n ShopifyMoneyV2,\n} from './services/shopify';\n\n// Utilities\nexport { cn } from './lib/utils';\nexport { normalizeImageUrl, getResizedImageUrl } from './utils/image-utils';\nexport {\n analyzeBackdrop,\n computeContentBBox,\n buildProbeUrl,\n loadImagePixels,\n loadBackdropAnalysis,\n type BackdropAnalysis,\n type ContentBBox,\n type ImagePixels,\n} from './utils/imageBackdrop';\nexport { stripMarkdown } from './component/componentDefinitions/parse-utils';\n\n// Color utilities\nexport {\n type RGB,\n rgbToHsl,\n hslToRgb,\n ensureMinLightness,\n toRgb,\n deriveDarkColor,\n deriveDarkGradient,\n deriveLightColor,\n} from './color/colorUtils';\n\n// Analytics\nexport {\n pushEvent,\n pushPromptSubmit,\n pushLinkClick,\n pushError,\n pushExit,\n pushEntityFiltered,\n hasAnalyticsConsent,\n type EntityFilteredReason,\n} from './utils/analyticsEvents';\n\n// Error handling types and utilities\nexport {\n type ConversationErrorType,\n ERROR_MARKDOWN,\n getErrorTypeFromStatus,\n createErrorMarkdown,\n STREAMING_TIMEOUT_MS,\n type ErrorActionType,\n type ErrorIconType,\n type ErrorTemplateButton,\n type ErrorTemplate,\n type ErrorTemplateOverrides,\n DEFAULT_ERROR_TEMPLATES,\n resolveErrorTemplate,\n} from './errors';\n\n// Navigation utilities\nexport {\n getForwardStack,\n setForwardStack,\n clearForwardStack,\n pushToForwardStack,\n popFromForwardStack,\n} from './utils/navigationStack';\n\n// UI components\nexport {\n UserQuery,\n type UserQueryProps,\n type ProductBackContext,\n} from './components/ui/UserQuery';\nexport {\n PRODUCT_BACK_SESSION_KEY,\n writeProductBackHandoff,\n readProductBackHandoff,\n type ProductBackHandoff,\n} from './utils/productBackHandoff';\nexport {\n PromptEntryEmptyState,\n type PromptEntryEmptyStateProps,\n} from './components/ui/PromptEntryEmptyState';\nexport {\n SearchSection,\n type SearchSectionProps,\n type SearchSectionHandle,\n type ScrollChip,\n} from './components/ui/SearchSection';\nexport {\n FeedbackBar,\n type FeedbackBarProps,\n type FeedbackCategoryOption,\n type FeedbackSentiment,\n type FeedbackSubmitInput,\n} from './components/ui/FeedbackBar';\nexport {\n Disclaimer,\n type DisclaimerProps,\n} from './components/ui/Disclaimer';\nexport {\n BottomContainer,\n type BottomContainerProps,\n} from './components/ui/BottomContainer';\nexport { MarkdownText } from './components/ui/MarkdownText';\nexport {\n CalloutBlock,\n type CalloutBlockProps,\n} from './components/ui/CalloutBlock';\nexport {\n OptimizedImage,\n type OptimizedImageProps,\n} from './components/ui/OptimizedImage';\nexport {\n SectionSkeleton,\n type SectionSkeletonProps,\n} from './components/ui/SectionSkeleton';\nexport { SmartIcon, type SmartIconProps } from './components/ui/SmartIcon';\nexport { Loader, type LoaderProps } from './components/ui/Loader';\nexport {\n PlacementLoader,\n type PlacementLoaderProps,\n} from './components/ui/PlacementLoader';\nexport {\n UnifiedLink,\n detectLinkType,\n type UnifiedLinkProps,\n LinkType,\n type LinkVariant,\n} from './components/ui/UnifiedLink';\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from './components/ui/table';\n\n// Placement (DL #088, DL #102 behavior declarations)\nexport type {\n PlacementBehaviorConfig,\n PlacementConfig,\n PlacementPrompts,\n} from './types/placement';\n\n// Cross-bundle user-query broadcast event (DL #097 D2)\nexport {\n WEB5_USER_QUERY_EVENT,\n type Web5UserQueryEventDetail,\n type Web5UserQueryEvent,\n} from './types/userQueryEvent';\n\n// Cross-bundle answer-updated broadcast event (B2B-4121)\nexport {\n WEB5_ANSWER_UPDATED_EVENT,\n type Web5AnswerUpdatedEventDetail,\n type Web5AnswerUpdatedEvent,\n} from './types/answerUpdatedEvent';\n\n// Cross-bundle redirect broadcast event (DL #098 D3)\nexport {\n WEB5_REDIRECT_EVENT,\n type Web5RedirectEventDetail,\n type Web5RedirectEvent,\n type Web5RedirectReason,\n} from './types/redirectEvent';\n// `placementFilter` was removed — hero/next-steps exclusion is the prompt's job\n// and placement-specific designs belong as `{ placement: true }` registry\n// variants (resolved automatically via `resolveSection(type, { placement: true })`).\n\n// Client bundle loader (DL #088 D3.3)\nexport { loadClientBundle } from './client/loadClientBundle';\n\n// `?clientBundleUrl=` dev override — shared by `web50-server-ui` and\n// `embed-placement` so the trusted-host gate can't drift between them.\nexport {\n getClientBundleOverride,\n isTrustedBundleHost,\n} from './client/clientBundleOverride';\n\n// Client-UMD URL resolution (DL #094 per-msid, DL #129 per-template) and the\n// universal bundle←backend config merge (DL #129 Q3/Q7) — shared by\n// `web50-server-ui` and `embed-placement`, the two client-bundle load sites.\nexport {\n TEMPLATES_CDN_BASE,\n TEMPLATES_MANIFEST_URL,\n getTemplateOverride,\n isTemplatePickerRequested,\n isValidTemplateId,\n resolveClientBundleUrl,\n} from './client/clientBundleUrl';\nexport { mergeClientConfig, type DeepPartial } from './client/mergeClientConfig';\nexport {\n applyThemeOverrides,\n THEME_OVERRIDE_TOKENS,\n type ThemeOverrideKey,\n type ThemeOverrides,\n} from './client/applyThemeOverrides';\n\n// Placement renderer + DI helper (DL #088 D3.2, D3.4)\nexport {\n PlacementResponseRenderer,\n PlacementSmoothHeight,\n type PlacementResponseRendererProps,\n type PlacementSection,\n type PlacementVariant,\n} from './components/placement/PlacementResponseRenderer';\nexport {\n buildPlacementDependencies,\n type BuildPlacementDependenciesOptions,\n} from './components/placement/buildPlacementDependencies';\nexport {\n PlacementPayloadProvider,\n usePlacementPayload,\n type PlacementPayloadContextValue,\n} from './components/placement/PlacementPayloadContext';\n\n// Markdown parsing utilities — lifted from web50-server-ui (DL #088 B9.1)\nexport {\n UnifiedMarkdownParser,\n parseMarkdownToAst,\n parseAstToMarkdown,\n} from './utils/unifiedMarkdownParser';\nexport {\n escapeWeb5Links,\n fixMalformedLinks,\n trimTrailingWhitespace,\n normalizeIconUrls,\n decodeLinkText,\n preprocessMarkdown,\n type PreprocessorDiagnostic,\n type PreprocessResult,\n} from './utils/markdownPreprocessor';\nexport {\n ComponentTracking,\n type ComponentNodeRange,\n} from './utils/componentTracking';\nexport {\n findKeywordsInContent,\n getContextualImageFilename,\n} from './utils/contentKeywordMatcher';\nexport {\n extractIntentFromMarkdown,\n getIntentFromMarkdown,\n type IntentInfo,\n type IntentExtractionOptions,\n type ResponseState,\n} from './utils/intentExtractor';\nexport type { PageSection } from './types/page-section';\nexport {\n createPageSection,\n generateSectionId,\n generateId,\n findImageInNode,\n findImageInChildren,\n type Product,\n type ComparisonProduct,\n type ProductComparisonSectionProps,\n} from './utils/propsExtractor';\nexport {\n DiagnosticsCollector,\n type DiagnosticEntry,\n} from './utils/diagnosticsCollector';\nexport {\n REFRESH_PROMPTS_UNTIL_KEY,\n REFRESH_PROMPTS_WINDOW_MS,\n getRefreshPromptsExpiry,\n shouldRefreshPrompts,\n enableRefreshPrompts,\n disableRefreshPrompts,\n} from './utils/refreshPrompts';\nexport {\n type BackendEnvironment,\n BACKEND_ENVIRONMENT_KEY,\n BACKEND_ENVIRONMENT_QUERY_PARAM,\n DEFAULT_BACKEND_ENVIRONMENT,\n getBackendEnvironment,\n setBackendEnvironment,\n usesStagingBackend,\n} from './utils/backendEnvironment';\nexport {\n MATCH_DEBUG_KEY,\n MATCH_DEBUG_QUERY_PARAM,\n isMatchDebugEnabled,\n setMatchDebug,\n resetMatchDebugCache,\n logMatchDebug,\n} from './utils/matchDebug';\nexport { createWixAuthFetch } from './client/wixAuthFetch';\nexport {\n getOrCreateSessionId,\n getSessionId,\n getChatId,\n startNewChatId,\n setChatId,\n resetChatIdForTests,\n} from './utils/sessionManager';\n\n// Component parser orchestrator — lifted from web50-server-ui (DL #088 B9.5)\nexport {\n parseMarkdownToComponents,\n tryParseComponent,\n mergeSectionsWithStableReferences,\n type ParseMarkdownOptions,\n type ParseMarkdownResult,\n type ComponentMatch,\n type ParserContext,\n} from './component/componentParser';\nexport type {\n ParserClientConfig,\n EnrichEntityProps,\n} from './component/parser-types';\n\n// Host-mount scope contract — shared by web50-server-ui (which stamps the\n// class and mounts), embed-placement (which mounts the same bundle elsewhere),\n// and the client CDN build (which compiles every selector against it).\nexport {\n WEB5_ROOT_ID,\n WEB5_ROOT_CLASS,\n WEB5_SCOPES,\n WEB5_SCOPE,\n WEB5_GLOBAL_TOKENS,\n type HostFitConfig,\n} from './hostScope';\n"],"mappings":"AAAA;AACA,SAASA,UAAU,EAAEC,cAAc,QAAQ,WAAW;AAEtD,SAGEC,yBAAy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B,EACrBC,qBAAqB,EACrBC,kBAAkB,QACb,4BAA4B;AACnC,SACEC,eAAe,EACfC,uBAAuB,EACvBC,mBAAmB,EACnBC,aAAa,EACbC,oBAAoB,EACpBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SACEC,oBAAoB,EACpBC,YAAY,EACZC,SAAS,EACTC,cAAc,EACdC,SAAS,EACTC,mBAAmB,QACd,wBAAwB;;AAE/B;AACA,SACEC,yBAAyB,EACzBC,iBAAiB,EACjBC,iCAAiC,QAK5B,6BAA6B;AAMpC;AACA;AACA;AACA,SACEC,YAAY,EACZC,eAAe,EACfC,WAAW,EACXC,UAAU,EACVC,kBAAkB,QAEb,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["CLIENT_IDS","EXPERIMENT_IDS","createFeatureToggleReader","FeatureToggleProvider","useFeatureToggles","useFeatureToggle","getPartsByType","getPartByRole","getAllByRole","getHeading","getImages","getLinks","extractContent","extractContentMarkdown","deriveRole","DROP_SECTION","DIAGNOSTIC_TYPES","buildImageSearchFilter","ImageSearchFilterToken","backgroundFilter","HeroSectionDefinition","HeroEntitySectionDefinition","KpiSectionDefinition","FeatureCardsSectionDefinition","EntitySectionDefinition","EntityCollectionSectionDefinition","ComparisonSectionDefinition","TextBlockSectionDefinition","CtaBannerSectionDefinition","CalloutSectionDefinition","NextStepsSectionDefinition","FeatureSection9PlusDefinition","ListItemsSectionDefinition","SkipNodesSectionDefinition","HtmlCommentSectionDefinition","SearchSectionDefinition","ErrorSectionDefinition","FallbackSectionDefinition","createSdkRegistry","ComponentRegistry","validatePattern","validatePatternSyntax","validatePatternWithBlocks","convertToBlockElements","convertToBlockElementsWithMapping","Web5UrlType","isWeb5AskUrl","isWeb5EntityUrl","isWeb5ImageUrl","isWeb5IconUrl","isWeb5ActionUrl","isWeb5SearchUrl","isWeb5Url","isNavigableUrl","isValidLinkUrl","isLegacyUrl","parseWeb5Url","isValidWeb5Url","validateLinkUrl","isEntityLink","parseEntityLink","extractProtocol","extractLinkMetadata","findInvalidWeb5Links","hasImage","isHtmlComment","matchMarkdown","matchAllSections","nodesToParts","ComponentDependenciesProvider","useComponentDependencies","UserQueryProvider","useUserQuery","ChipsProvider","useChips","defaultExtractor","enrichEntitiesFromPayload","fetchEntityListData","listEntityItems","LIST_ITEMS_ENDPOINT","getEntityExtractor","registerEntityExtractor","transformToSolutionEntityData","transformToBlogPostEntityData","transformToGenericEntityData","CALLOUT_KINDS","useWeb5Link","useConversation","useDebugImageContext","useResolvedImageSources","useResolveGenericEntityData","useEntityTransforms","useMarkdownUtils","useResolveShopifyEntityData","useResolveSearchSpringEntityData","fetchProductsByHandles","fetchProductsByHandlesMap","transformSSProductToEntityItemData","addToCart","ShopifyStorefrontClient","resolveShopifyConfig","resolveShopifyEntity","transformShopifyProduct","transformShopifyCollection","transformShopifyArticle","transformShopifyEntityToItemData","PRODUCT_BY_HANDLE_QUERY","COLLECTION_BY_HANDLE_QUERY","ARTICLE_BY_HANDLE_QUERY","cn","normalizeImageUrl","getResizedImageUrl","analyzeBackdrop","computeContentBBox","buildProbeUrl","loadImagePixels","loadBackdropAnalysis","stripMarkdown","rgbToHsl","hslToRgb","ensureMinLightness","toRgb","deriveDarkColor","deriveDarkGradient","deriveLightColor","pushEvent","pushPromptSubmit","pushLinkClick","pushError","pushExit","pushEntityFiltered","hasAnalyticsConsent","ERROR_MARKDOWN","getErrorTypeFromStatus","createErrorMarkdown","STREAMING_TIMEOUT_MS","DEFAULT_ERROR_TEMPLATES","resolveErrorTemplate","getForwardStack","setForwardStack","clearForwardStack","pushToForwardStack","popFromForwardStack","UserQuery","PRODUCT_BACK_SESSION_KEY","writeProductBackHandoff","readProductBackHandoff","PromptEntryEmptyState","SearchSection","FeedbackBar","Disclaimer","BottomContainer","MarkdownText","CalloutBlock","OptimizedImage","SectionSkeleton","SmartIcon","Loader","PlacementLoader","UnifiedLink","detectLinkType","LinkType","Table","TableHeader","TableBody","TableFooter","TableHead","TableRow","TableCell","TableCaption","WEB5_USER_QUERY_EVENT","WEB5_ANSWER_UPDATED_EVENT","WEB5_REDIRECT_EVENT","loadClientBundle","getClientBundleOverride","isTrustedBundleHost","TEMPLATES_CDN_BASE","TEMPLATES_MANIFEST_URL","getTemplateOverride","isTemplatePickerRequested","isValidTemplateId","resolveClientBundleUrl","mergeClientConfig","applyThemeOverrides","THEME_OVERRIDE_TOKENS","PlacementResponseRenderer","PlacementSmoothHeight","buildPlacementDependencies","PlacementPayloadProvider","usePlacementPayload","UnifiedMarkdownParser","parseMarkdownToAst","parseAstToMarkdown","escapeWeb5Links","fixMalformedLinks","trimTrailingWhitespace","normalizeIconUrls","decodeLinkText","preprocessMarkdown","ComponentTracking","findKeywordsInContent","getContextualImageFilename","extractIntentFromMarkdown","getIntentFromMarkdown","createPageSection","generateSectionId","generateId","findImageInNode","findImageInChildren","DiagnosticsCollector","REFRESH_PROMPTS_UNTIL_KEY","REFRESH_PROMPTS_WINDOW_MS","getRefreshPromptsExpiry","shouldRefreshPrompts","enableRefreshPrompts","disableRefreshPrompts","BACKEND_ENVIRONMENT_KEY","BACKEND_ENVIRONMENT_QUERY_PARAM","DEFAULT_BACKEND_ENVIRONMENT","getBackendEnvironment","setBackendEnvironment","usesStagingBackend","MATCH_DEBUG_KEY","MATCH_DEBUG_QUERY_PARAM","isMatchDebugEnabled","setMatchDebug","resetMatchDebugCache","logMatchDebug","createWixAuthFetch","getOrCreateSessionId","getSessionId","getChatId","startNewChatId","setChatId","resetChatIdForTests","parseMarkdownToComponents","tryParseComponent","mergeSectionsWithStableReferences","WEB5_ROOT_ID","WEB5_ROOT_CLASS","WEB5_SCOPES","WEB5_SCOPE","WEB5_GLOBAL_TOKENS"],"sources":["../../src/index.ts"],"sourcesContent":["// Client IDs and experiment IDs\nexport { CLIENT_IDS, EXPERIMENT_IDS } from './clients';\n\nexport {\n type EmbedFeatureToggleResult,\n type FeatureToggleReader,\n createFeatureToggleReader,\n FeatureToggleProvider,\n useFeatureToggles,\n useFeatureToggle,\n} from './featureToggles/FeatureToggleContext';\n\n// Dev-only chrome injection contract for client packages\nexport type { DevEnvironment } from './client/devEnvironment';\n\n// Part types and helpers\nexport {\n type PartType,\n type Part,\n type HeadingPart,\n type ImagePart,\n type LinkPart,\n type ListPart,\n type ListItemPart,\n type KpiItemPart,\n type CardPart,\n type IconPart,\n type CalloutPart,\n type EntityPart,\n getPartsByType,\n getPartByRole,\n getAllByRole,\n getHeading,\n getImages,\n getLinks,\n extractContent,\n extractContentMarkdown,\n deriveRole,\n} from './parts/parts';\n\n// Component types\nexport type {\n BaseCompProps,\n SlotCompProps,\n SectionCompProps,\n SectionCompPropsWithSlot,\n TextCompProps,\n ButtonCompProps,\n ImageCompProps,\n BadgeCompProps,\n HeroButton,\n KpiItemCompProps,\n FeatureItemCompProps,\n FeatureCardCompProps,\n EntityItemData,\n EntityItem,\n GenericEntityData,\n GenericEntityCompProps,\n ComparisonRow,\n ComparisonColumn,\n AiNarrativeCompProps,\n HeroCompProps,\n HeroEntityCompProps,\n KpiCompProps,\n FeatureCardsCompProps,\n EntityCompProps,\n ComparisonCompProps,\n TextBlockCompProps,\n Component,\n BaseComponent,\n SlotComponent,\n SectionComponent,\n TextComponent,\n ButtonComponent,\n ImageComponent,\n BadgeComponent,\n KpiItemComponent,\n FeatureItemComponent,\n FeatureCardComponent,\n GenericEntityComponent,\n AiNarrativeComponent,\n ComparisonSectionComponent,\n TextBlockSectionComponent,\n HeroSectionComponent,\n HeroEntitySectionComponent,\n KpiSectionComponent,\n FeatureCardsSectionComponent,\n EntitySectionComponent,\n PropsOf,\n SectionFixture,\n CtaBannerCompProps,\n CtaBannerSectionComponent,\n CalloutCompProps,\n CalloutSectionComponent,\n NextStepsCompProps,\n NextStepsSectionComponent,\n FeatureSection9PlusCompProps,\n FeatureSection9PlusSectionComponent,\n ListItemsSectionCompProps,\n ListItemsSectionComponent,\n ErrorCompProps,\n ErrorSectionComponent,\n NullCompProps,\n NullSectionComponent,\n SolutionEntityCompProps,\n SolutionEntitySectionComponent,\n SolutionEntityData,\n BlogEntityCompProps,\n BlogEntitySectionComponent,\n BlogEntityData,\n GeneralTextCompProps,\n GeneralTextSectionComponent,\n PersonalizedNarrativeCompProps,\n PersonalizedNarrativeSectionComponent,\n} from './component/types';\n\n// Section definition\nexport type {\n SectionDefinition,\n ParseContext,\n ContextualImageResult,\n DropSection,\n} from './component/section-definition';\nexport { DROP_SECTION } from './component/section-definition';\n\n// Diagnostic types\nexport { DIAGNOSTIC_TYPES } from './component/diagnosticTypes';\nexport type { DiagnosticType } from './component/diagnosticTypes';\n\n// Image search filters\nexport {\n buildImageSearchFilter,\n type ImageSearchFilterString,\n} from './image/imageSearchFilterTypes';\nexport {\n ImageSearchFilterToken,\n backgroundFilter,\n} from './image/imageSearchFilters';\nexport type {\n ContextualImageAsset,\n ImageSourceInput,\n ResolvedImageSource,\n ResolvedImageSourceKind,\n} from './image/contextualImageTypes';\n\n// Section definition classes + createSdkRegistry\nexport {\n HeroSectionDefinition,\n HeroEntitySectionDefinition,\n KpiSectionDefinition,\n FeatureCardsSectionDefinition,\n EntitySectionDefinition,\n EntityCollectionSectionDefinition,\n ComparisonSectionDefinition,\n TextBlockSectionDefinition,\n CtaBannerSectionDefinition,\n CalloutSectionDefinition,\n NextStepsSectionDefinition,\n FeatureSection9PlusDefinition,\n ListItemsSectionDefinition,\n SkipNodesSectionDefinition,\n HtmlCommentSectionDefinition,\n SearchSectionDefinition,\n ErrorSectionDefinition,\n FallbackSectionDefinition,\n createSdkRegistry,\n} from './component/componentDefinitions';\n\n// Registry\nexport { ComponentRegistry } from './registry';\nexport type {\n SlotOptions,\n SectionOptions,\n SectionRegistration,\n SlotNode,\n SlotIntentNode,\n SectionIntentNode,\n SectionNode,\n SlotVariant,\n SectionVariant,\n RegistryCatalog,\n ActionResult,\n ActionHandler,\n} from './registry';\n\n// Pattern validator\nexport {\n validatePattern,\n validatePatternSyntax,\n validatePatternWithBlocks,\n type PatternValidationResult,\n type BlockElement,\n type EnrichedBlockElement,\n type LinkMetadata,\n type LinkAttribute,\n} from './patternValidator';\n\n// Markdown blocks\nexport {\n convertToBlockElements,\n convertToBlockElementsWithMapping,\n type BlockElementsWithMapping,\n} from './markdownBlocks';\n\n// Link types, enum & guards\nexport {\n Web5UrlType,\n type Web5AskUrl,\n type Web5EntityUrl,\n type Web5ImageUrl,\n type Web5IconUrl,\n type Web5ActionUrl,\n type Web5SearchUrl,\n type Web5Url,\n type HttpsUrl,\n type HttpUrl,\n type MailtoUrl,\n type RelativeUrl,\n type NavigableUrl,\n type ValidLinkUrl,\n type AnyKnownUrl,\n type LegacyUrl,\n isWeb5AskUrl,\n isWeb5EntityUrl,\n isWeb5ImageUrl,\n isWeb5IconUrl,\n isWeb5ActionUrl,\n isWeb5SearchUrl,\n isWeb5Url,\n isNavigableUrl,\n isValidLinkUrl,\n isLegacyUrl,\n} from './types/link-types';\n\n// Entity/URL parsing\nexport {\n parseWeb5Url,\n isValidWeb5Url,\n validateLinkUrl,\n type Web5UrlParsed,\n type Web5AskParsed,\n type Web5EntityParsed,\n type Web5ImageParsed,\n type Web5IconParsed,\n type Web5ActionParsed,\n type Web5SearchParsed,\n isEntityLink,\n parseEntityLink,\n extractProtocol,\n extractLinkMetadata,\n} from './utils/entityLinkParser';\n\n// Web5 link validation\nexport {\n findInvalidWeb5Links,\n type InvalidWeb5Link,\n} from './utils/web5LinkValidator';\n\n// Node matchers\nexport { hasImage, isHtmlComment } from './utils/nodeMatchers';\n\n// Match API\nexport {\n matchMarkdown,\n type MarkdownMatchResult,\n matchAllSections,\n type MatchAllSectionsResult,\n nodesToParts,\n} from './match';\n\n// ---------------------------------------------------------------------------\n// DI Infrastructure (moved from @wix/w5-client-circana)\n// ---------------------------------------------------------------------------\n\n// DI context and provider\nexport {\n ComponentDependenciesProvider,\n useComponentDependencies,\n type ComponentDependenciesProviderProps,\n} from './context/ComponentDependenciesContext';\n\n// Raw user query for the current response page\nexport {\n UserQueryProvider,\n useUserQuery,\n type UserQueryProviderProps,\n} from './context/UserQueryContext';\n\n// Chips context (suggestion chips shared between SearchSection and error states)\nexport {\n ChipsProvider,\n useChips,\n type SuggestionChip,\n} from './context/ChipsContext';\n\n// DI types\nexport type {\n ComponentDependencies,\n Web5LinkApi,\n ConversationApi,\n SendMessageTrackingOptions,\n SendMessageOptions,\n ComparisonSubmitPayload,\n ComparisonSelectedProduct,\n ProductComparisonSelectionState,\n ProductComparisonApi,\n EntityTransforms,\n MarkdownUtils,\n ResolveGenericEntityDataOptions,\n} from './types/dependencies';\nexport type {\n ApiPayloadItem,\n EntityTypeConfig,\n EntityConfig,\n EntityExtractionContext,\n} from './types/entity';\nexport {\n defaultExtractor,\n enrichEntitiesFromPayload,\n fetchEntityListData,\n listEntityItems,\n LIST_ITEMS_ENDPOINT,\n getEntityExtractor,\n registerEntityExtractor,\n transformToSolutionEntityData,\n transformToBlogPostEntityData,\n transformToGenericEntityData,\n} from './entity';\nexport type {\n EntityExtractor,\n FetchEntityListDataOptions,\n ListEntityItemsOptions,\n} from './entity';\nexport { CALLOUT_KINDS, type CalloutKind, type Callout } from './types/callout';\n\n// Wrapper hooks\nexport { useWeb5Link } from './hooks/useWeb5Link';\nexport { useConversation } from './hooks/useConversation';\nexport { useDebugImageContext } from './hooks/useDebugImageContext';\nexport { useResolvedImageSources } from './hooks/useResolvedImageSources';\nexport { useResolveGenericEntityData } from './hooks/useResolveGenericEntityData';\nexport { useEntityTransforms } from './hooks/useEntityTransforms';\nexport { useMarkdownUtils } from './hooks/useMarkdownUtils';\nexport { useResolveShopifyEntityData } from './hooks/useResolveShopifyEntityData';\nexport { useResolveSearchSpringEntityData } from './hooks/useResolveSearchSpringEntityData';\n\n// SearchSpring\nexport {\n fetchProductsByHandles,\n fetchProductsByHandlesMap,\n transformSSProductToEntityItemData,\n} from './services/searchspring';\nexport type {\n SearchSpringConfig,\n SSProduct,\n SSSearchResponse,\n SSSizeData,\n} from './services/searchspring';\n\n// Shopify Storefront API\n// Cart actions\nexport { addToCart } from './services/cart';\n\nexport {\n ShopifyStorefrontClient,\n resolveShopifyConfig,\n resolveShopifyEntity,\n transformShopifyProduct,\n transformShopifyCollection,\n transformShopifyArticle,\n transformShopifyEntityToItemData,\n PRODUCT_BY_HANDLE_QUERY,\n COLLECTION_BY_HANDLE_QUERY,\n ARTICLE_BY_HANDLE_QUERY,\n} from './services/shopify';\nexport type {\n ShopifyStorefrontConfig,\n ShopifyProduct,\n ShopifyCollection,\n ShopifyArticle,\n ShopifyImage,\n ShopifyMoneyV2,\n} from './services/shopify';\n\n// Utilities\nexport { cn } from './lib/utils';\nexport { normalizeImageUrl, getResizedImageUrl } from './utils/image-utils';\nexport {\n analyzeBackdrop,\n computeContentBBox,\n buildProbeUrl,\n loadImagePixels,\n loadBackdropAnalysis,\n type BackdropAnalysis,\n type ContentBBox,\n type ImagePixels,\n} from './utils/imageBackdrop';\nexport { stripMarkdown } from './component/componentDefinitions/parse-utils';\n\n// Color utilities\nexport {\n type RGB,\n rgbToHsl,\n hslToRgb,\n ensureMinLightness,\n toRgb,\n deriveDarkColor,\n deriveDarkGradient,\n deriveLightColor,\n} from './color/colorUtils';\n\n// Analytics\nexport {\n pushEvent,\n pushPromptSubmit,\n pushLinkClick,\n pushError,\n pushExit,\n pushEntityFiltered,\n hasAnalyticsConsent,\n type EntityFilteredReason,\n} from './utils/analyticsEvents';\n\n// Error handling types and utilities\nexport {\n type ConversationErrorType,\n ERROR_MARKDOWN,\n getErrorTypeFromStatus,\n createErrorMarkdown,\n STREAMING_TIMEOUT_MS,\n type ErrorActionType,\n type ErrorIconType,\n type ErrorTemplateButton,\n type ErrorTemplate,\n type ErrorTemplateOverrides,\n DEFAULT_ERROR_TEMPLATES,\n resolveErrorTemplate,\n} from './errors';\n\n// Navigation utilities\nexport {\n getForwardStack,\n setForwardStack,\n clearForwardStack,\n pushToForwardStack,\n popFromForwardStack,\n} from './utils/navigationStack';\n\n// UI components\nexport {\n UserQuery,\n type UserQueryProps,\n type ProductBackContext,\n} from './components/ui/UserQuery';\nexport {\n PRODUCT_BACK_SESSION_KEY,\n writeProductBackHandoff,\n readProductBackHandoff,\n type ProductBackHandoff,\n} from './utils/productBackHandoff';\nexport {\n PromptEntryEmptyState,\n type PromptEntryEmptyStateProps,\n} from './components/ui/PromptEntryEmptyState';\nexport {\n SearchSection,\n type SearchSectionProps,\n type SearchSectionHandle,\n type ScrollChip,\n} from './components/ui/SearchSection';\nexport {\n FeedbackBar,\n type FeedbackBarProps,\n type FeedbackCategoryOption,\n type FeedbackSentiment,\n type FeedbackSubmitInput,\n} from './components/ui/FeedbackBar';\nexport {\n Disclaimer,\n type DisclaimerProps,\n} from './components/ui/Disclaimer';\nexport {\n BottomContainer,\n type BottomContainerProps,\n} from './components/ui/BottomContainer';\nexport { MarkdownText } from './components/ui/MarkdownText';\nexport {\n CalloutBlock,\n type CalloutBlockProps,\n} from './components/ui/CalloutBlock';\nexport {\n OptimizedImage,\n type OptimizedImageProps,\n} from './components/ui/OptimizedImage';\nexport {\n SectionSkeleton,\n type SectionSkeletonProps,\n} from './components/ui/SectionSkeleton';\nexport { SmartIcon, type SmartIconProps } from './components/ui/SmartIcon';\nexport { Loader, type LoaderProps } from './components/ui/Loader';\nexport {\n PlacementLoader,\n type PlacementLoaderProps,\n} from './components/ui/PlacementLoader';\nexport {\n UnifiedLink,\n detectLinkType,\n type UnifiedLinkProps,\n LinkType,\n type LinkVariant,\n} from './components/ui/UnifiedLink';\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from './components/ui/table';\n\n// Placement (DL #088, DL #102 behavior declarations)\nexport type {\n PlacementBehaviorConfig,\n PlacementConfig,\n PlacementPrompts,\n} from './types/placement';\n\n// Cross-bundle user-query broadcast event (DL #097 D2)\nexport {\n WEB5_USER_QUERY_EVENT,\n type Web5UserQueryEventDetail,\n type Web5UserQueryEvent,\n} from './types/userQueryEvent';\n\n// Cross-bundle answer-updated broadcast event (B2B-4121)\nexport {\n WEB5_ANSWER_UPDATED_EVENT,\n type Web5AnswerUpdatedEventDetail,\n type Web5AnswerUpdatedEvent,\n} from './types/answerUpdatedEvent';\n\n// Cross-bundle redirect broadcast event (DL #098 D3)\nexport {\n WEB5_REDIRECT_EVENT,\n type Web5RedirectEventDetail,\n type Web5RedirectEvent,\n type Web5RedirectReason,\n} from './types/redirectEvent';\n// `placementFilter` was removed — hero/next-steps exclusion is the prompt's job\n// and placement-specific designs belong as `{ placement: true }` registry\n// variants (resolved automatically via `resolveSection(type, { placement: true })`).\n\n// Client bundle loader (DL #088 D3.3)\nexport { loadClientBundle } from './client/loadClientBundle';\n\n// `?clientBundleUrl=` dev override — shared by `web50-server-ui` and\n// `embed-placement` so the trusted-host gate can't drift between them.\nexport {\n getClientBundleOverride,\n isTrustedBundleHost,\n} from './client/clientBundleOverride';\n\n// Client-UMD URL resolution (DL #094 per-msid, DL #129 per-template) and the\n// universal bundle←backend config merge (DL #129 Q3/Q7) — shared by\n// `web50-server-ui` and `embed-placement`, the two client-bundle load sites.\nexport {\n TEMPLATES_CDN_BASE,\n TEMPLATES_MANIFEST_URL,\n getTemplateOverride,\n isTemplatePickerRequested,\n isValidTemplateId,\n resolveClientBundleUrl,\n} from './client/clientBundleUrl';\nexport { mergeClientConfig, type DeepPartial } from './client/mergeClientConfig';\nexport {\n applyThemeOverrides,\n THEME_OVERRIDE_TOKENS,\n type ThemeOverrideKey,\n type ThemeOverrides,\n} from './client/applyThemeOverrides';\n\n// Placement renderer + DI helper (DL #088 D3.2, D3.4)\nexport {\n PlacementResponseRenderer,\n PlacementSmoothHeight,\n type PlacementResponseRendererProps,\n type PlacementSection,\n type PlacementVariant,\n} from './components/placement/PlacementResponseRenderer';\nexport {\n buildPlacementDependencies,\n type BuildPlacementDependenciesOptions,\n} from './components/placement/buildPlacementDependencies';\nexport {\n PlacementPayloadProvider,\n usePlacementPayload,\n type PlacementPayloadContextValue,\n} from './components/placement/PlacementPayloadContext';\n\n// Markdown parsing utilities — lifted from web50-server-ui (DL #088 B9.1)\nexport {\n UnifiedMarkdownParser,\n parseMarkdownToAst,\n parseAstToMarkdown,\n} from './utils/unifiedMarkdownParser';\nexport {\n escapeWeb5Links,\n fixMalformedLinks,\n trimTrailingWhitespace,\n normalizeIconUrls,\n decodeLinkText,\n preprocessMarkdown,\n type PreprocessorDiagnostic,\n type PreprocessResult,\n} from './utils/markdownPreprocessor';\nexport {\n ComponentTracking,\n type ComponentNodeRange,\n} from './utils/componentTracking';\nexport {\n findKeywordsInContent,\n getContextualImageFilename,\n} from './utils/contentKeywordMatcher';\nexport {\n extractIntentFromMarkdown,\n getIntentFromMarkdown,\n type IntentInfo,\n type IntentExtractionOptions,\n type ResponseState,\n} from './utils/intentExtractor';\nexport type { PageSection } from './types/page-section';\nexport {\n createPageSection,\n generateSectionId,\n generateId,\n findImageInNode,\n findImageInChildren,\n type Product,\n type ComparisonProduct,\n type ProductComparisonSectionProps,\n} from './utils/propsExtractor';\nexport {\n DiagnosticsCollector,\n type DiagnosticEntry,\n} from './utils/diagnosticsCollector';\nexport {\n REFRESH_PROMPTS_UNTIL_KEY,\n REFRESH_PROMPTS_WINDOW_MS,\n getRefreshPromptsExpiry,\n shouldRefreshPrompts,\n enableRefreshPrompts,\n disableRefreshPrompts,\n} from './utils/refreshPrompts';\nexport {\n type BackendEnvironment,\n BACKEND_ENVIRONMENT_KEY,\n BACKEND_ENVIRONMENT_QUERY_PARAM,\n DEFAULT_BACKEND_ENVIRONMENT,\n getBackendEnvironment,\n setBackendEnvironment,\n usesStagingBackend,\n} from './utils/backendEnvironment';\nexport {\n MATCH_DEBUG_KEY,\n MATCH_DEBUG_QUERY_PARAM,\n isMatchDebugEnabled,\n setMatchDebug,\n resetMatchDebugCache,\n logMatchDebug,\n} from './utils/matchDebug';\nexport { createWixAuthFetch } from './client/wixAuthFetch';\nexport {\n getOrCreateSessionId,\n getSessionId,\n getChatId,\n startNewChatId,\n setChatId,\n resetChatIdForTests,\n} from './utils/sessionManager';\n\n// Component parser orchestrator — lifted from web50-server-ui (DL #088 B9.5)\nexport {\n parseMarkdownToComponents,\n tryParseComponent,\n mergeSectionsWithStableReferences,\n type ParseMarkdownOptions,\n type ParseMarkdownResult,\n type ComponentMatch,\n type ParserContext,\n} from './component/componentParser';\nexport type {\n ParserClientConfig,\n EnrichEntityProps,\n} from './component/parser-types';\n\n// Host-mount scope contract — shared by web50-server-ui (which stamps the\n// class and mounts), embed-placement (which mounts the same bundle elsewhere),\n// and the client CDN build (which compiles every selector against it).\nexport {\n WEB5_ROOT_ID,\n WEB5_ROOT_CLASS,\n WEB5_SCOPES,\n WEB5_SCOPE,\n WEB5_GLOBAL_TOKENS,\n type HostFitConfig,\n} from './hostScope';\n"],"mappings":"AAAA;AACA,SAASA,UAAU,EAAEC,cAAc,QAAQ,WAAW;AAEtD,SAGEC,yBAAyB,EACzBC,qBAAqB,EACrBC,iBAAiB,EACjBC,gBAAgB,QACX,uCAAuC;;AAE9C;;AAGA;AACA,SAaEC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,cAAc,EACdC,sBAAsB,EACtBC,UAAU,QACL,eAAe;;AAEtB;;AA4EA;;AAOA,SAASC,YAAY,QAAQ,gCAAgC;;AAE7D;AACA,SAASC,gBAAgB,QAAQ,6BAA6B;AAG9D;AACA,SACEC,sBAAsB,QAEjB,gCAAgC;AACvC,SACEC,sBAAsB,EACtBC,gBAAgB,QACX,4BAA4B;AAQnC;AACA,SACEC,qBAAqB,EACrBC,2BAA2B,EAC3BC,oBAAoB,EACpBC,6BAA6B,EAC7BC,uBAAuB,EACvBC,iCAAiC,EACjCC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,wBAAwB,EACxBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,uBAAuB,E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,EACrBC,kBAAkB,EAClBC,kBAAkB,QACb,+BAA+B;AACtC,SACEC,eAAe,EACfC,iBAAiB,EACjBC,sBAAsB,EACtBC,iBAAiB,EACjBC,cAAc,EACdC,kBAAkB,QAGb,8BAA8B;AACrC,SACEC,iBAAiB,QAEZ,2BAA2B;AAClC,SACEC,qBAAqB,EACrBC,0BAA0B,QACrB,+BAA+B;AACtC,SACEC,yBAAyB,EACzBC,qBAAqB,QAIhB,yBAAyB;AAEhC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EACVC,eAAe,EACfC,mBAAmB,QAId,wBAAwB;AAC/B,SACEC,oBAAoB,QAEf,8BAA8B;AACrC,SACEC,yBAAyB,EACzBC,yBAAyB,EACzBC,uBAAuB,EACvBC,oBAAoB,EACpBC,oBAAoB,EACpBC,qBAAqB,QAChB,wBAAwB;AAC/B,SAEEC,uBAAuB,EACvBC,+BAA+B,EAC/BC,2BAA2B,EAC3BC,qBAAqB,EACrBC,qBAAqB,EACrBC,kBAAkB,QACb,4BAA4B;AACnC,SACEC,eAAe,EACfC,uBAAuB,EACvBC,mBAAmB,EACnBC,aAAa,EACbC,oBAAoB,EACpBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SACEC,oBAAoB,EACpBC,YAAY,EACZC,SAAS,EACTC,cAAc,EACdC,SAAS,EACTC,mBAAmB,QACd,wBAAwB;;AAE/B;AACA,SACEC,yBAAyB,EACzBC,iBAAiB,EACjBC,iCAAiC,QAK5B,6BAA6B;AAMpC;AACA;AACA;AACA,SACEC,YAAY,EACZC,eAAe,EACfC,WAAW,EACXC,UAAU,EACVC,kBAAkB,QAEb,aAAa","ignoreList":[]}
|
|
@@ -26,23 +26,6 @@
|
|
|
26
26
|
--input: 0 0% 89.8%;
|
|
27
27
|
--ring: 0 0% 3.9%;
|
|
28
28
|
|
|
29
|
-
/* Chart colors */
|
|
30
|
-
--chart-1: 180 60% 65%;
|
|
31
|
-
--chart-2: 120 50% 60%;
|
|
32
|
-
--chart-3: 40 50% 70%;
|
|
33
|
-
--chart-4: 200 70% 60%;
|
|
34
|
-
--chart-5: 320 60% 70%;
|
|
35
|
-
|
|
36
|
-
/* Sidebar colors */
|
|
37
|
-
--sidebar: 0 0% 100%;
|
|
38
|
-
--sidebar-foreground: 0 0% 3.9%;
|
|
39
|
-
--sidebar-primary: 0 0% 9%;
|
|
40
|
-
--sidebar-primary-foreground: 0 0% 98%;
|
|
41
|
-
--sidebar-accent: 0 0% 96.1%;
|
|
42
|
-
--sidebar-accent-foreground: 0 0% 9%;
|
|
43
|
-
--sidebar-border: 0 0% 89.8%;
|
|
44
|
-
--sidebar-ring: 0 0% 3.9%;
|
|
45
|
-
|
|
46
29
|
/* Typography tokens */
|
|
47
30
|
--font-sans: ui-sans-serif, system-ui, sans-serif;
|
|
48
31
|
--font-serif: serif;
|
|
@@ -140,13 +123,4 @@
|
|
|
140
123
|
--border: 0 0% 14.9%;
|
|
141
124
|
--input: 0 0% 14.9%;
|
|
142
125
|
--ring: 0 0% 83.1%;
|
|
143
|
-
|
|
144
|
-
--sidebar: 0 0% 3.9%;
|
|
145
|
-
--sidebar-foreground: 0 0% 98%;
|
|
146
|
-
--sidebar-primary: 0 0% 98%;
|
|
147
|
-
--sidebar-primary-foreground: 0 0% 9%;
|
|
148
|
-
--sidebar-accent: 0 0% 14.9%;
|
|
149
|
-
--sidebar-accent-foreground: 0 0% 98%;
|
|
150
|
-
--sidebar-border: 0 0% 14.9%;
|
|
151
|
-
--sidebar-ring: 0 0% 83.1%;
|
|
152
126
|
}
|
|
@@ -47,22 +47,6 @@
|
|
|
47
47
|
--color-text-accent-hover: var(--text-accent-hover);
|
|
48
48
|
--color-accent-border: var(--accent-border);
|
|
49
49
|
|
|
50
|
-
--color-chart-1: hsl(var(--chart-1));
|
|
51
|
-
--color-chart-2: hsl(var(--chart-2));
|
|
52
|
-
--color-chart-3: hsl(var(--chart-3));
|
|
53
|
-
--color-chart-4: hsl(var(--chart-4));
|
|
54
|
-
--color-chart-5: hsl(var(--chart-5));
|
|
55
|
-
|
|
56
|
-
--color-sidebar: hsl(var(--sidebar));
|
|
57
|
-
--color-sidebar-foreground: hsl(var(--sidebar-foreground));
|
|
58
|
-
--color-sidebar-primary: hsl(var(--sidebar-primary));
|
|
59
|
-
--color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground));
|
|
60
|
-
--color-sidebar-accent: hsl(var(--sidebar-accent));
|
|
61
|
-
--color-sidebar-accent-foreground: hsl(var(--sidebar-accent-foreground));
|
|
62
|
-
--color-sidebar-border: hsl(var(--sidebar-border));
|
|
63
|
-
--color-sidebar-ring: hsl(var(--sidebar-ring));
|
|
64
|
-
|
|
65
|
-
|
|
66
50
|
--radius-sm: calc(var(--radius) - 4px);
|
|
67
51
|
--radius-md: calc(var(--radius) - 2px);
|
|
68
52
|
--radius-lg: var(--radius);
|
|
@@ -76,7 +60,6 @@
|
|
|
76
60
|
--shadow-lg: var(--shadow-lg);
|
|
77
61
|
--shadow-xl: var(--shadow-xl);
|
|
78
62
|
--shadow-2xl: var(--shadow-2xl);
|
|
79
|
-
--shadow-sticky-header: var(--shadow-sticky-header);
|
|
80
63
|
|
|
81
64
|
--tracking-tighter: calc(var(--tracking-normal) - 0.05em);
|
|
82
65
|
--tracking-tight: calc(var(--tracking-normal) - 0.025em);
|
|
@@ -70,6 +70,148 @@ export function recoverOrphanedEmphasisLinks(markdown) {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* A `web5://` link target whose opening `[` never arrived, e.g.
|
|
75
|
+
* `try filtering for men](web5://ask/Which+are+for+men%3F)`.
|
|
76
|
+
*
|
|
77
|
+
* Dropping the opening bracket is the most common way an inline ask link is
|
|
78
|
+
* mis-emitted, and it is the worst one: remark parses nothing as a link, so the
|
|
79
|
+
* scheme renders as literal text and the visitor reads `web5://ask/...`.
|
|
80
|
+
*
|
|
81
|
+
* `run` is the text before the `]` on the same line, which is what the label
|
|
82
|
+
* should have been. It may be empty, in which case there is nothing to promote
|
|
83
|
+
* and the construct is dropped instead.
|
|
84
|
+
*/
|
|
85
|
+
const ORPHANED_WEB5_TARGET = /([^[\]()*\n]{0,80}?)\]\((web5:\/\/[^)\s]*)\)/g;
|
|
86
|
+
|
|
87
|
+
/** Any `web5://` url, for the final check that none is visible as text. */
|
|
88
|
+
const ANY_WEB5_URL = /web5:\/\/[^\s)\]]*/g;
|
|
89
|
+
|
|
90
|
+
/** Longest label we will promote out of surrounding prose. */
|
|
91
|
+
const MAX_RECOVERED_LABEL_WORDS = 4;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Words a label should start *after* rather than with. The label is cut at the
|
|
95
|
+
* last of these inside the window, so a promoted phrase reads as a noun phrase
|
|
96
|
+
* ("sensitive skin") instead of trailing off a verb or preposition
|
|
97
|
+
* ("carry for sensitive skin").
|
|
98
|
+
*/
|
|
99
|
+
const LABEL_BOUNDARY_WORDS = new Set(['a', 'an', 'and', 'at', 'but', 'by', 'for', 'from', 'in', 'into', 'of', 'on', 'or', 'the', 'to', 'with']);
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* True when `segment` holds a `[` that is still waiting to be closed — meaning
|
|
103
|
+
* the `](` after it closes a real link and there is nothing to repair.
|
|
104
|
+
*/
|
|
105
|
+
function hasOpenLinkBracket(segment) {
|
|
106
|
+
return segment.lastIndexOf('[') > segment.lastIndexOf(']');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Split `run` into the prose to leave in place and the phrase to promote into
|
|
111
|
+
* the link label. Slices on token offsets rather than rejoining words, so the
|
|
112
|
+
* original spacing around the label is preserved exactly.
|
|
113
|
+
*
|
|
114
|
+
* An empty label means there is nothing worth promoting and the caller should
|
|
115
|
+
* drop the link instead.
|
|
116
|
+
*/
|
|
117
|
+
function splitRecoveredLabel(run) {
|
|
118
|
+
// Never let the label cross a sentence boundary.
|
|
119
|
+
let sentenceStart = 0;
|
|
120
|
+
for (const boundary of run.matchAll(/(?<=[.!?;:])\s+/g)) {
|
|
121
|
+
sentenceStart = (boundary.index ?? 0) + boundary[0].length;
|
|
122
|
+
}
|
|
123
|
+
const tokens = [...run.slice(sentenceStart).matchAll(/\S+/g)].map(token => ({
|
|
124
|
+
word: token[0],
|
|
125
|
+
start: sentenceStart + (token.index ?? 0)
|
|
126
|
+
}));
|
|
127
|
+
let window = tokens.slice(-MAX_RECOVERED_LABEL_WORDS);
|
|
128
|
+
for (let i = window.length - 1; i >= 0; i--) {
|
|
129
|
+
const bare = window[i].word.toLowerCase().replace(/[^a-z]/g, '');
|
|
130
|
+
if (LABEL_BOUNDARY_WORDS.has(bare)) {
|
|
131
|
+
window = window.slice(i + 1);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (window.length === 0) {
|
|
136
|
+
return {
|
|
137
|
+
prefix: run,
|
|
138
|
+
label: ''
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
prefix: run.slice(0, window[0].start),
|
|
143
|
+
label: run.slice(window[0].start).trim()
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Repair `web5://` links that lost their opening `[`.
|
|
149
|
+
*
|
|
150
|
+
* Recovers the link by promoting the words immediately before the `]` into its
|
|
151
|
+
* label; when there are no words to promote, drops the whole construct. Either
|
|
152
|
+
* way the scheme stops being visible, which is the point — a link the visitor
|
|
153
|
+
* cannot use is a smaller failure than a url the visitor can read.
|
|
154
|
+
*/
|
|
155
|
+
export function repairOrphanedWeb5Links(markdown) {
|
|
156
|
+
const diagnostics = [];
|
|
157
|
+
const result = markdown.replace(ORPHANED_WEB5_TARGET, (match, run, href, offset, whole) => {
|
|
158
|
+
const lineStart = whole.lastIndexOf('\n', offset) + 1;
|
|
159
|
+
if (hasOpenLinkBracket(whole.slice(lineStart, offset))) {
|
|
160
|
+
// A real `[label](url)` — the bracket is there, leave it alone.
|
|
161
|
+
return match;
|
|
162
|
+
}
|
|
163
|
+
const {
|
|
164
|
+
prefix,
|
|
165
|
+
label
|
|
166
|
+
} = splitRecoveredLabel(run);
|
|
167
|
+
if (!label) {
|
|
168
|
+
diagnostics.push({
|
|
169
|
+
type: 'orphaned_web5_link_dropped',
|
|
170
|
+
original: match,
|
|
171
|
+
normalized: run
|
|
172
|
+
});
|
|
173
|
+
return run;
|
|
174
|
+
}
|
|
175
|
+
const normalized = `${prefix}[${label}](${href})`;
|
|
176
|
+
diagnostics.push({
|
|
177
|
+
type: 'orphaned_web5_link_recovered',
|
|
178
|
+
original: match,
|
|
179
|
+
normalized
|
|
180
|
+
});
|
|
181
|
+
return normalized;
|
|
182
|
+
});
|
|
183
|
+
return {
|
|
184
|
+
result,
|
|
185
|
+
diagnostics
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Last resort: remove any `web5://` url still sitting in visible text.
|
|
191
|
+
*
|
|
192
|
+
* Runs after every recovery step, so anything left here is a url no repair
|
|
193
|
+
* could turn back into a link. A url in a link target (`](web5://...)`) is
|
|
194
|
+
* left alone — only text the visitor would actually read is scrubbed.
|
|
195
|
+
*/
|
|
196
|
+
export function scrubVisibleWeb5Urls(markdown) {
|
|
197
|
+
const diagnostics = [];
|
|
198
|
+
const result = markdown.replace(ANY_WEB5_URL, (match, offset, whole) => {
|
|
199
|
+
if (whole.slice(offset - 2, offset) === '](') {
|
|
200
|
+
return match;
|
|
201
|
+
}
|
|
202
|
+
diagnostics.push({
|
|
203
|
+
type: 'visible_web5_url_scrubbed',
|
|
204
|
+
original: match,
|
|
205
|
+
normalized: ''
|
|
206
|
+
});
|
|
207
|
+
return '';
|
|
208
|
+
});
|
|
209
|
+
return {
|
|
210
|
+
result,
|
|
211
|
+
diagnostics
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
73
215
|
/**
|
|
74
216
|
* Trim trailing whitespace from lines that contain text
|
|
75
217
|
*
|
|
@@ -220,11 +362,13 @@ export function decodeLinkText(markdown) {
|
|
|
220
362
|
* The preprocessing steps are applied in the following order:
|
|
221
363
|
* 1. Recover orphaned emphasized web5 links
|
|
222
364
|
* 2. Fix malformed links (remove whitespace between ] and () - must happen before web5 links are matched)
|
|
223
|
-
* 3.
|
|
224
|
-
* 4.
|
|
225
|
-
* 5.
|
|
226
|
-
* 6.
|
|
227
|
-
* 7.
|
|
365
|
+
* 3. Repair web5 links missing their opening `[` (after step 2, so `] (url)` is already normalized)
|
|
366
|
+
* 4. Decode URL-encoded link text
|
|
367
|
+
* 5. Escape web5:// links (URL-encode URLs)
|
|
368
|
+
* 6. Normalize icon URLs
|
|
369
|
+
* 7. Insert missing table separators for obvious pipe tables
|
|
370
|
+
* 8. Scrub any web5:// url still visible as text (last, so every repair has had its chance)
|
|
371
|
+
* 9. Trim trailing whitespace from lines
|
|
228
372
|
*
|
|
229
373
|
* @param markdown - The raw markdown string to preprocess
|
|
230
374
|
* @returns The preprocessed markdown string ready for AST parsing
|
|
@@ -235,10 +379,14 @@ export function preprocessMarkdown(markdown) {
|
|
|
235
379
|
diagnostics: recoveredLinkDiagnostics
|
|
236
380
|
} = recoverOrphanedEmphasisLinks(markdown);
|
|
237
381
|
let processed = fixMalformedLinks(recoveredLinks);
|
|
382
|
+
const {
|
|
383
|
+
result: repairedLinks,
|
|
384
|
+
diagnostics: repairedLinkDiagnostics
|
|
385
|
+
} = repairOrphanedWeb5Links(processed);
|
|
238
386
|
const {
|
|
239
387
|
result: decodedText,
|
|
240
388
|
diagnostics: decodeDiagnostics
|
|
241
|
-
} = decodeLinkText(
|
|
389
|
+
} = decodeLinkText(repairedLinks);
|
|
242
390
|
processed = escapeWeb5Links(decodedText);
|
|
243
391
|
const {
|
|
244
392
|
result: normalized,
|
|
@@ -248,10 +396,14 @@ export function preprocessMarkdown(markdown) {
|
|
|
248
396
|
result: tableNormalized,
|
|
249
397
|
diagnostics: tableDiagnostics
|
|
250
398
|
} = insertMissingTableSeparators(normalized);
|
|
251
|
-
|
|
399
|
+
const {
|
|
400
|
+
result: scrubbed,
|
|
401
|
+
diagnostics: scrubDiagnostics
|
|
402
|
+
} = scrubVisibleWeb5Urls(tableNormalized);
|
|
403
|
+
processed = trimTrailingWhitespace(scrubbed);
|
|
252
404
|
return {
|
|
253
405
|
markdown: processed,
|
|
254
|
-
diagnostics: [...recoveredLinkDiagnostics, ...decodeDiagnostics, ...iconDiagnostics, ...tableDiagnostics]
|
|
406
|
+
diagnostics: [...recoveredLinkDiagnostics, ...repairedLinkDiagnostics, ...decodeDiagnostics, ...iconDiagnostics, ...tableDiagnostics, ...scrubDiagnostics]
|
|
255
407
|
};
|
|
256
408
|
}
|
|
257
409
|
//# sourceMappingURL=markdownPreprocessor.js.map
|