@wix/web5-core 1.63.28 → 1.63.30
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/ErrorSectionDefinition.js +8 -0
- package/dist/cjs/component/componentDefinitions/ErrorSectionDefinition.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/errors/conversationErrorTypes.js +4 -0
- package/dist/cjs/errors/conversationErrorTypes.js.map +1 -1
- package/dist/cjs/errors/errorTemplates.js +8 -0
- package/dist/cjs/errors/errorTemplates.js.map +1 -1
- package/dist/cjs/index.js +7 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/component/componentDefinitions/ErrorSectionDefinition.js +8 -0
- package/dist/esm/component/componentDefinitions/ErrorSectionDefinition.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/errors/conversationErrorTypes.js +4 -0
- package/dist/esm/errors/conversationErrorTypes.js.map +1 -1
- package/dist/esm/errors/errorTemplates.js +8 -0
- package/dist/esm/errors/errorTemplates.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/component/componentDefinitions/ErrorSectionDefinition.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/errors/conversationErrorTypes.d.ts +1 -1
- package/dist/types/errors/conversationErrorTypes.d.ts.map +1 -1
- package/dist/types/errors/errorTemplates.d.ts +1 -1
- package/dist/types/errors/errorTemplates.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
|
@@ -11,6 +11,9 @@ const ERROR_PATTERNS = [{
|
|
|
11
11
|
}, {
|
|
12
12
|
pattern: /Error: conversation-403/i,
|
|
13
13
|
type: 'conversation-403'
|
|
14
|
+
}, {
|
|
15
|
+
pattern: /Error: conversation-429/i,
|
|
16
|
+
type: 'conversation-429'
|
|
14
17
|
}, {
|
|
15
18
|
pattern: /Error: conversation-500/i,
|
|
16
19
|
type: 'conversation-500'
|
|
@@ -57,6 +60,11 @@ class ErrorSectionDefinition {
|
|
|
57
60
|
expected: {
|
|
58
61
|
type: 'conversation-500'
|
|
59
62
|
}
|
|
63
|
+
}, {
|
|
64
|
+
markdown: 'Error: conversation-429',
|
|
65
|
+
expected: {
|
|
66
|
+
type: 'conversation-429'
|
|
67
|
+
}
|
|
60
68
|
}]);
|
|
61
69
|
}
|
|
62
70
|
parse(parts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_parseUtils","require","ERROR_PATTERNS","pattern","type","ErrorSectionDefinition","constructor","_defineProperty2","default","markdown","expected","parse","parts","text","bodyText","test","exports"],"sources":["../../../../src/component/componentDefinitions/ErrorSectionDefinition.ts"],"sourcesContent":["import { bodyText } from './parse-utils';\nimport type { Part } from '../../parts/parts';\nimport type {\n ErrorCompProps,\n ErrorSectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition } from '../section-definition';\nimport type { ConversationErrorType } from '../../errors/conversationErrorTypes';\n\ninterface ErrorPattern {\n pattern: RegExp;\n type: ConversationErrorType;\n}\n\nconst ERROR_PATTERNS: ErrorPattern[] = [\n { pattern: /Error: conversation-404/i, type: 'conversation-404' },\n { pattern: /Error: conversation-403/i, type: 'conversation-403' },\n { pattern: /Error: conversation-500/i, type: 'conversation-500' },\n {\n pattern: /Error: conversation-generic-network-error/i,\n type: 'conversation-generic-network-error',\n },\n { pattern: /Error: conversation-timeout/i, type: 'conversation-timeout' },\n {\n pattern: /Error: conversation-partial-load/i,\n type: 'conversation-partial-load',\n },\n {\n pattern: /Error: conversation-streaming-error/i,\n type: 'conversation-streaming-error',\n },\n {\n pattern: /Error: conversation-llm-empty-response/i,\n type: 'conversation-llm-empty-response',\n },\n { pattern: /Error: history-load-error/i, type: 'history-load-error' },\n { pattern: /^error/i, type: 'conversation-llm-error-text' },\n { pattern: /Error/i, type: 'conversation-llm-error-text' },\n];\n\nexport class ErrorSectionDefinition\n implements SectionDefinition<ErrorSectionComponent>\n{\n sectionType = 'error' as const;\n patterns = ['t'];\n maxConsumedNodes = 1;\n\n defaults: ErrorCompProps = {\n type: 'conversation-llm-error-text',\n };\n\n fixtures: SectionFixture<ErrorCompProps>[] = [\n {\n markdown: 'Error: conversation-404',\n expected: { type: 'conversation-404' },\n },\n {\n markdown: 'Error: conversation-500',\n expected: { type: 'conversation-500' },\n },\n ];\n\n parse(parts: Part[]): ErrorCompProps | null {\n const text = bodyText(parts);\n if (!text) {\n return null;\n }\n\n for (const { pattern, type } of ERROR_PATTERNS) {\n if (pattern.test(text)) {\n return { type };\n }\n }\n\n return null;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAeA,MAAMC,cAA8B,GAAG,CACrC;EAAEC,OAAO,EAAE,0BAA0B;EAAEC,IAAI,EAAE;AAAmB,CAAC,EACjE;EAAED,OAAO,EAAE,0BAA0B;EAAEC,IAAI,EAAE;AAAmB,CAAC,EACjE;EAAED,OAAO,EAAE,0BAA0B;EAAEC,IAAI,EAAE;AAAmB,CAAC,EACjE;EACED,OAAO,EAAE,4CAA4C;EACrDC,IAAI,EAAE;AACR,CAAC,EACD;EAAED,OAAO,EAAE,8BAA8B;EAAEC,IAAI,EAAE;AAAuB,CAAC,EACzE;EACED,OAAO,EAAE,mCAAmC;EAC5CC,IAAI,EAAE;AACR,CAAC,EACD;EACED,OAAO,EAAE,sCAAsC;EAC/CC,IAAI,EAAE;AACR,CAAC,EACD;EACED,OAAO,EAAE,yCAAyC;EAClDC,IAAI,EAAE;AACR,CAAC,EACD;EAAED,OAAO,EAAE,4BAA4B;EAAEC,IAAI,EAAE;AAAqB,CAAC,EACrE;EAAED,OAAO,EAAE,SAAS;EAAEC,IAAI,EAAE;AAA8B,CAAC,EAC3D;EAAED,OAAO,EAAE,QAAQ;EAAEC,IAAI,EAAE;AAA8B,CAAC,CAC3D;AAEM,MAAMC,sBAAsB,CAEnC;EAAAC,YAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,uBACgB,OAAO;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBACV,CAAC,GAAG,CAAC;IAAA,IAAAD,gBAAA,CAAAC,OAAA,4BACG,CAAC;IAAA,IAAAD,gBAAA,CAAAC,OAAA,oBAEO;MACzBJ,IAAI,EAAE;IACR,CAAC;IAAA,IAAAG,gBAAA,CAAAC,OAAA,oBAE4C,CAC3C;MACEC,QAAQ,EAAE,yBAAyB;MACnCC,QAAQ,EAAE;QAAEN,IAAI,EAAE;MAAmB;IACvC,CAAC,EACD;MACEK,QAAQ,EAAE,yBAAyB;MACnCC,QAAQ,EAAE;QAAEN,IAAI,EAAE;MAAmB;IACvC,CAAC,CACF;EAAA;EAEDO,KAAKA,CAACC,KAAa,EAAyB;IAC1C,MAAMC,IAAI,GAAG,IAAAC,oBAAQ,EAACF,KAAK,CAAC;IAC5B,IAAI,CAACC,IAAI,EAAE;MACT,OAAO,IAAI;IACb;IAEA,KAAK,MAAM;MAAEV,OAAO;MAAEC;IAAK,CAAC,IAAIF,cAAc,EAAE;MAC9C,IAAIC,OAAO,CAACY,IAAI,CAACF,IAAI,CAAC,EAAE;QACtB,OAAO;UAAET;QAAK,CAAC;MACjB;IACF;IAEA,OAAO,IAAI;EACb;AACF;AAACY,OAAA,CAAAX,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_parseUtils","require","ERROR_PATTERNS","pattern","type","ErrorSectionDefinition","constructor","_defineProperty2","default","markdown","expected","parse","parts","text","bodyText","test","exports"],"sources":["../../../../src/component/componentDefinitions/ErrorSectionDefinition.ts"],"sourcesContent":["import { bodyText } from './parse-utils';\nimport type { Part } from '../../parts/parts';\nimport type {\n ErrorCompProps,\n ErrorSectionComponent,\n SectionFixture,\n} from '../types';\nimport type { SectionDefinition } from '../section-definition';\nimport type { ConversationErrorType } from '../../errors/conversationErrorTypes';\n\ninterface ErrorPattern {\n pattern: RegExp;\n type: ConversationErrorType;\n}\n\nconst ERROR_PATTERNS: ErrorPattern[] = [\n { pattern: /Error: conversation-404/i, type: 'conversation-404' },\n { pattern: /Error: conversation-403/i, type: 'conversation-403' },\n { pattern: /Error: conversation-429/i, type: 'conversation-429' },\n { pattern: /Error: conversation-500/i, type: 'conversation-500' },\n {\n pattern: /Error: conversation-generic-network-error/i,\n type: 'conversation-generic-network-error',\n },\n { pattern: /Error: conversation-timeout/i, type: 'conversation-timeout' },\n {\n pattern: /Error: conversation-partial-load/i,\n type: 'conversation-partial-load',\n },\n {\n pattern: /Error: conversation-streaming-error/i,\n type: 'conversation-streaming-error',\n },\n {\n pattern: /Error: conversation-llm-empty-response/i,\n type: 'conversation-llm-empty-response',\n },\n { pattern: /Error: history-load-error/i, type: 'history-load-error' },\n { pattern: /^error/i, type: 'conversation-llm-error-text' },\n { pattern: /Error/i, type: 'conversation-llm-error-text' },\n];\n\nexport class ErrorSectionDefinition\n implements SectionDefinition<ErrorSectionComponent>\n{\n sectionType = 'error' as const;\n patterns = ['t'];\n maxConsumedNodes = 1;\n\n defaults: ErrorCompProps = {\n type: 'conversation-llm-error-text',\n };\n\n fixtures: SectionFixture<ErrorCompProps>[] = [\n {\n markdown: 'Error: conversation-404',\n expected: { type: 'conversation-404' },\n },\n {\n markdown: 'Error: conversation-500',\n expected: { type: 'conversation-500' },\n },\n {\n markdown: 'Error: conversation-429',\n expected: { type: 'conversation-429' },\n },\n ];\n\n parse(parts: Part[]): ErrorCompProps | null {\n const text = bodyText(parts);\n if (!text) {\n return null;\n }\n\n for (const { pattern, type } of ERROR_PATTERNS) {\n if (pattern.test(text)) {\n return { type };\n }\n }\n\n return null;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAeA,MAAMC,cAA8B,GAAG,CACrC;EAAEC,OAAO,EAAE,0BAA0B;EAAEC,IAAI,EAAE;AAAmB,CAAC,EACjE;EAAED,OAAO,EAAE,0BAA0B;EAAEC,IAAI,EAAE;AAAmB,CAAC,EACjE;EAAED,OAAO,EAAE,0BAA0B;EAAEC,IAAI,EAAE;AAAmB,CAAC,EACjE;EAAED,OAAO,EAAE,0BAA0B;EAAEC,IAAI,EAAE;AAAmB,CAAC,EACjE;EACED,OAAO,EAAE,4CAA4C;EACrDC,IAAI,EAAE;AACR,CAAC,EACD;EAAED,OAAO,EAAE,8BAA8B;EAAEC,IAAI,EAAE;AAAuB,CAAC,EACzE;EACED,OAAO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E;QACtB,OAAO;UAAET;QAAK,CAAC;MACjB;IACF;IAEA,OAAO,IAAI;EACb;AACF;AAACY,OAAA,CAAAX,sBAAA,GAAAA,sBAAA","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,UAAU,CAAC,EAAE;IAC/C,OAAO,IAAI;EACb;EACA,MAAMG,MAAM,GAAG,IAAAC,8BAAY,EAACJ,UAAU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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,iBAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAMA;AACA;AACA;AACA;AACA,SAASI,sBAAs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
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 registerE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AAA,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":[]}
|
|
@@ -17,6 +17,7 @@ exports.getErrorTypeFromStatus = exports.createErrorMarkdown = exports.STREAMING
|
|
|
17
17
|
const ERROR_MARKDOWN = exports.ERROR_MARKDOWN = {
|
|
18
18
|
'conversation-404': 'Error: conversation-404',
|
|
19
19
|
'conversation-403': 'Error: conversation-403',
|
|
20
|
+
'conversation-429': 'Error: conversation-429',
|
|
20
21
|
'conversation-500': 'Error: conversation-500',
|
|
21
22
|
'conversation-generic-network-error': 'Error: conversation-generic-network-error',
|
|
22
23
|
'conversation-timeout': 'Error: conversation-timeout',
|
|
@@ -35,6 +36,9 @@ const getErrorTypeFromStatus = status => {
|
|
|
35
36
|
if (status === 403) {
|
|
36
37
|
return 'conversation-403';
|
|
37
38
|
}
|
|
39
|
+
if (status === 429) {
|
|
40
|
+
return 'conversation-429';
|
|
41
|
+
}
|
|
38
42
|
if (status >= 500) {
|
|
39
43
|
return 'conversation-500';
|
|
40
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ERROR_MARKDOWN","exports","getErrorTypeFromStatus","status","createErrorMarkdown","type","STREAMING_TIMEOUT_MS"],"sources":["../../../src/errors/conversationErrorTypes.ts"],"sourcesContent":["/**\n * Conversation Error Types\n *\n * Canonical error type definitions and utilities for the error handling pipeline.\n * Maps HTTP status codes and error conditions to typed error identifiers.\n *\n * Prefix conventions:\n * conversation- → errors during conversation streaming flow\n * history- → errors during conversation history loading\n */\n\nexport type ConversationErrorType =\n | 'conversation-llm-error-text'\n | 'conversation-llm-empty-response'\n | 'conversation-500'\n | 'conversation-generic-network-error'\n | 'conversation-timeout'\n | 'conversation-streaming-error'\n | 'conversation-404'\n | 'conversation-403'\n | 'conversation-partial-load'\n | 'history-load-error';\n\n/** Error markdown strings that ErrorSectionDefinition recognizes */\nexport const ERROR_MARKDOWN: Record<ConversationErrorType, string> = {\n 'conversation-404': 'Error: conversation-404',\n 'conversation-403': 'Error: conversation-403',\n 'conversation-500': 'Error: conversation-500',\n 'conversation-generic-network-error':\n 'Error: conversation-generic-network-error',\n 'conversation-timeout': 'Error: conversation-timeout',\n 'conversation-streaming-error': 'Error: conversation-streaming-error',\n 'conversation-partial-load': 'Error: conversation-partial-load',\n 'conversation-llm-empty-response': 'Error: conversation-llm-empty-response',\n 'conversation-llm-error-text': 'Error',\n 'history-load-error': 'Error: history-load-error',\n};\n\n/** Maps HTTP status code to error type */\nexport const getErrorTypeFromStatus = (\n status: number,\n): ConversationErrorType => {\n if (status === 404) {\n return 'conversation-404';\n }\n if (status === 403) {\n return 'conversation-403';\n }\n if (status >= 500) {\n return 'conversation-500';\n }\n if (status >= 400) {\n return 'conversation-generic-network-error';\n }\n return 'conversation-llm-error-text';\n};\n\n/** Creates error markdown string for the given error type */\nexport const createErrorMarkdown = (type: ConversationErrorType): string => {\n return ERROR_MARKDOWN[type] || ERROR_MARKDOWN['conversation-llm-error-text'];\n};\n\n/** Streaming timeout in milliseconds (60 seconds) */\nexport const STREAMING_TIMEOUT_MS = 60000;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["ERROR_MARKDOWN","exports","getErrorTypeFromStatus","status","createErrorMarkdown","type","STREAMING_TIMEOUT_MS"],"sources":["../../../src/errors/conversationErrorTypes.ts"],"sourcesContent":["/**\n * Conversation Error Types\n *\n * Canonical error type definitions and utilities for the error handling pipeline.\n * Maps HTTP status codes and error conditions to typed error identifiers.\n *\n * Prefix conventions:\n * conversation- → errors during conversation streaming flow\n * history- → errors during conversation history loading\n */\n\nexport type ConversationErrorType =\n | 'conversation-llm-error-text'\n | 'conversation-llm-empty-response'\n | 'conversation-500'\n | 'conversation-generic-network-error'\n | 'conversation-timeout'\n | 'conversation-streaming-error'\n | 'conversation-404'\n | 'conversation-403'\n | 'conversation-429'\n | 'conversation-partial-load'\n | 'history-load-error';\n\n/** Error markdown strings that ErrorSectionDefinition recognizes */\nexport const ERROR_MARKDOWN: Record<ConversationErrorType, string> = {\n 'conversation-404': 'Error: conversation-404',\n 'conversation-403': 'Error: conversation-403',\n 'conversation-429': 'Error: conversation-429',\n 'conversation-500': 'Error: conversation-500',\n 'conversation-generic-network-error':\n 'Error: conversation-generic-network-error',\n 'conversation-timeout': 'Error: conversation-timeout',\n 'conversation-streaming-error': 'Error: conversation-streaming-error',\n 'conversation-partial-load': 'Error: conversation-partial-load',\n 'conversation-llm-empty-response': 'Error: conversation-llm-empty-response',\n 'conversation-llm-error-text': 'Error',\n 'history-load-error': 'Error: history-load-error',\n};\n\n/** Maps HTTP status code to error type */\nexport const getErrorTypeFromStatus = (\n status: number,\n): ConversationErrorType => {\n if (status === 404) {\n return 'conversation-404';\n }\n if (status === 403) {\n return 'conversation-403';\n }\n if (status === 429) {\n return 'conversation-429';\n }\n if (status >= 500) {\n return 'conversation-500';\n }\n if (status >= 400) {\n return 'conversation-generic-network-error';\n }\n return 'conversation-llm-error-text';\n};\n\n/** Creates error markdown string for the given error type */\nexport const createErrorMarkdown = (type: ConversationErrorType): string => {\n return ERROR_MARKDOWN[type] || ERROR_MARKDOWN['conversation-llm-error-text'];\n};\n\n/** Streaming timeout in milliseconds (60 seconds) */\nexport const STREAMING_TIMEOUT_MS = 60000;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACO,MAAMA,cAAqD,GAAAC,OAAA,CAAAD,cAAA,GAAG;EACnE,kBAAkB,EAAE,yBAAyB;EAC7C,kBAAkB,EAAE,yBAAyB;EAC7C,kBAAkB,EAAE,yBAAyB;EAC7C,kBAAkB,EAAE,yBAAyB;EAC7C,oCAAoC,EAClC,2CAA2C;EAC7C,sBAAsB,EAAE,6BAA6B;EACrD,8BAA8B,EAAE,qCAAqC;EACrE,2BAA2B,EAAE,kCAAkC;EAC/D,iCAAiC,EAAE,wCAAwC;EAC3E,6BAA6B,EAAE,OAAO;EACtC,oBAAoB,EAAE;AACxB,CAAC;;AAED;AACO,MAAME,sBAAsB,GACjCC,MAAc,IACY;EAC1B,IAAIA,MAAM,KAAK,GAAG,EAAE;IAClB,OAAO,kBAAkB;EAC3B;EACA,IAAIA,MAAM,KAAK,GAAG,EAAE;IAClB,OAAO,kBAAkB;EAC3B;EACA,IAAIA,MAAM,KAAK,GAAG,EAAE;IAClB,OAAO,kBAAkB;EAC3B;EACA,IAAIA,MAAM,IAAI,GAAG,EAAE;IACjB,OAAO,kBAAkB;EAC3B;EACA,IAAIA,MAAM,IAAI,GAAG,EAAE;IACjB,OAAO,oCAAoC;EAC7C;EACA,OAAO,6BAA6B;AACtC,CAAC;;AAED;AAAAF,OAAA,CAAAC,sBAAA,GAAAA,sBAAA;AACO,MAAME,mBAAmB,GAAIC,IAA2B,IAAa;EAC1E,OAAOL,cAAc,CAACK,IAAI,CAAC,IAAIL,cAAc,CAAC,6BAA6B,CAAC;AAC9E,CAAC;;AAED;AAAAC,OAAA,CAAAG,mBAAA,GAAAA,mBAAA;AACO,MAAME,oBAAoB,GAAAL,OAAA,CAAAK,oBAAA,GAAG,KAAK","ignoreList":[]}
|
|
@@ -55,6 +55,14 @@ const DEFAULT_ERROR_TEMPLATES = exports.DEFAULT_ERROR_TEMPLATES = {
|
|
|
55
55
|
showChips: true,
|
|
56
56
|
chipsLabel: 'Some ideas to get you started:'
|
|
57
57
|
},
|
|
58
|
+
'conversation-429': {
|
|
59
|
+
iconType: 'quota-exceeded',
|
|
60
|
+
title: 'This service is currently out of quota.\nPlease try again later.',
|
|
61
|
+
buttons: [{
|
|
62
|
+
text: 'Contact Us',
|
|
63
|
+
variant: 'link'
|
|
64
|
+
}]
|
|
65
|
+
},
|
|
58
66
|
'conversation-partial-load': {
|
|
59
67
|
iconType: 'partial-load',
|
|
60
68
|
title: 'Some content didn\u2019t load',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["retryAndContactButtons","text","action","variant","DEFAULT_ERROR_TEMPLATES","exports","title","showChips","iconType","buttons","chipsLabel","resolveErrorTemplate","type","overrides","templates"],"sources":["../../../src/errors/errorTemplates.ts"],"sourcesContent":["import type { ConversationErrorType } from './conversationErrorTypes';\n\n/** Action identifiers for error template buttons — resolved to callbacks by the rendering component */\nexport type ErrorActionType = 'retry' | 'newConversation' | 'reload';\n\n/** Icon identifiers for error templates — resolved to SVG components by the rendering component */\nexport type ErrorIconType =\n | 'error-500'\n | 'timeout'\n | 'streaming-error'\n | 'not-found'\n | 'forbidden'\n | 'partial-load';\n\nexport interface ErrorTemplateButton {\n text: string;\n /** URL for navigation (renders as a link) */\n href?: string;\n /** Action identifier — component resolves to a callback */\n action?: ErrorActionType;\n variant: 'cta' | 'link';\n}\n\nexport interface ErrorTemplate {\n title: string;\n subtitle?: string;\n /** Icon identifier — component resolves to an SVG */\n iconType?: ErrorIconType;\n buttons?: ErrorTemplateButton[];\n showChips?: boolean;\n chipsLabel?: string;\n}\n\nexport type ErrorTemplateOverrides = Partial<\n Record<ConversationErrorType, ErrorTemplate>\n>;\n\nconst retryAndContactButtons: ErrorTemplateButton[] = [\n { text: 'Try Again', action: 'retry', variant: 'cta' },\n { text: 'Contact Us', variant: 'link' },\n];\n\nexport const DEFAULT_ERROR_TEMPLATES: Record<\n ConversationErrorType,\n ErrorTemplate\n> = {\n 'conversation-llm-error-text': {\n title:\n \"I couldn't find information about what you asked.\\nTry asking about a different topic.\",\n showChips: true,\n },\n 'conversation-llm-empty-response': {\n title:\n \"I couldn't find information about what you asked.\\nTry asking about a different topic.\",\n showChips: true,\n },\n 'conversation-500': {\n iconType: 'error-500',\n title: \"This page isn't available right now.\",\n buttons: retryAndContactButtons,\n },\n 'conversation-generic-network-error': {\n iconType: 'timeout',\n title: 'Something went wrong on our side.\\nPlease try again in a moment.',\n buttons: retryAndContactButtons,\n },\n 'conversation-timeout': {\n iconType: 'timeout',\n title: 'Something went wrong on our side.\\nPlease try again in a moment.',\n buttons: retryAndContactButtons,\n },\n 'conversation-streaming-error': {\n iconType: 'streaming-error',\n title: 'The connection dropped. Please try again.',\n buttons: retryAndContactButtons,\n },\n 'conversation-404': {\n iconType: 'not-found',\n title: 'Page not found.\\nIt happens! Let\\u2019s get you back on track',\n showChips: true,\n chipsLabel: 'Some ideas to get you started:',\n },\n 'conversation-403': {\n iconType: 'forbidden',\n title:\n 'Welcome back.\\nFor privacy, we couldn\\u2019t restore previous content. Ask anything to continue.',\n showChips: true,\n chipsLabel: 'Some ideas to get you started:',\n },\n 'conversation-partial-load': {\n iconType: 'partial-load',\n title: 'Some content didn\\u2019t load',\n buttons: retryAndContactButtons,\n },\n 'history-load-error': {\n iconType: 'streaming-error',\n title: 'We couldn\\u2019t load this conversation.',\n buttons: [\n { text: 'New Conversation', action: 'newConversation', variant: 'cta' },\n { text: 'Contact Us', variant: 'link' },\n ],\n },\n};\n\n/** Resolves the error template for a given type, merging client overrides on top of defaults */\nexport const resolveErrorTemplate = (\n type: string,\n overrides?: ErrorTemplateOverrides,\n): ErrorTemplate => {\n const templates = overrides\n ? { ...DEFAULT_ERROR_TEMPLATES, ...overrides }\n : DEFAULT_ERROR_TEMPLATES;\n return (\n templates[type as ConversationErrorType] ??\n templates['conversation-llm-error-text']\n );\n};\n"],"mappings":";;;;AAEA;;AAGA;;
|
|
1
|
+
{"version":3,"names":["retryAndContactButtons","text","action","variant","DEFAULT_ERROR_TEMPLATES","exports","title","showChips","iconType","buttons","chipsLabel","resolveErrorTemplate","type","overrides","templates"],"sources":["../../../src/errors/errorTemplates.ts"],"sourcesContent":["import type { ConversationErrorType } from './conversationErrorTypes';\n\n/** Action identifiers for error template buttons — resolved to callbacks by the rendering component */\nexport type ErrorActionType = 'retry' | 'newConversation' | 'reload';\n\n/** Icon identifiers for error templates — resolved to SVG components by the rendering component */\nexport type ErrorIconType =\n | 'error-500'\n | 'timeout'\n | 'streaming-error'\n | 'not-found'\n | 'forbidden'\n | 'partial-load'\n | 'quota-exceeded';\n\nexport interface ErrorTemplateButton {\n text: string;\n /** URL for navigation (renders as a link) */\n href?: string;\n /** Action identifier — component resolves to a callback */\n action?: ErrorActionType;\n variant: 'cta' | 'link';\n}\n\nexport interface ErrorTemplate {\n title: string;\n subtitle?: string;\n /** Icon identifier — component resolves to an SVG */\n iconType?: ErrorIconType;\n buttons?: ErrorTemplateButton[];\n showChips?: boolean;\n chipsLabel?: string;\n}\n\nexport type ErrorTemplateOverrides = Partial<\n Record<ConversationErrorType, ErrorTemplate>\n>;\n\nconst retryAndContactButtons: ErrorTemplateButton[] = [\n { text: 'Try Again', action: 'retry', variant: 'cta' },\n { text: 'Contact Us', variant: 'link' },\n];\n\nexport const DEFAULT_ERROR_TEMPLATES: Record<\n ConversationErrorType,\n ErrorTemplate\n> = {\n 'conversation-llm-error-text': {\n title:\n \"I couldn't find information about what you asked.\\nTry asking about a different topic.\",\n showChips: true,\n },\n 'conversation-llm-empty-response': {\n title:\n \"I couldn't find information about what you asked.\\nTry asking about a different topic.\",\n showChips: true,\n },\n 'conversation-500': {\n iconType: 'error-500',\n title: \"This page isn't available right now.\",\n buttons: retryAndContactButtons,\n },\n 'conversation-generic-network-error': {\n iconType: 'timeout',\n title: 'Something went wrong on our side.\\nPlease try again in a moment.',\n buttons: retryAndContactButtons,\n },\n 'conversation-timeout': {\n iconType: 'timeout',\n title: 'Something went wrong on our side.\\nPlease try again in a moment.',\n buttons: retryAndContactButtons,\n },\n 'conversation-streaming-error': {\n iconType: 'streaming-error',\n title: 'The connection dropped. Please try again.',\n buttons: retryAndContactButtons,\n },\n 'conversation-404': {\n iconType: 'not-found',\n title: 'Page not found.\\nIt happens! Let\\u2019s get you back on track',\n showChips: true,\n chipsLabel: 'Some ideas to get you started:',\n },\n 'conversation-403': {\n iconType: 'forbidden',\n title:\n 'Welcome back.\\nFor privacy, we couldn\\u2019t restore previous content. Ask anything to continue.',\n showChips: true,\n chipsLabel: 'Some ideas to get you started:',\n },\n 'conversation-429': {\n iconType: 'quota-exceeded',\n title: 'This service is currently out of quota.\\nPlease try again later.',\n buttons: [{ text: 'Contact Us', variant: 'link' }],\n },\n 'conversation-partial-load': {\n iconType: 'partial-load',\n title: 'Some content didn\\u2019t load',\n buttons: retryAndContactButtons,\n },\n 'history-load-error': {\n iconType: 'streaming-error',\n title: 'We couldn\\u2019t load this conversation.',\n buttons: [\n { text: 'New Conversation', action: 'newConversation', variant: 'cta' },\n { text: 'Contact Us', variant: 'link' },\n ],\n },\n};\n\n/** Resolves the error template for a given type, merging client overrides on top of defaults */\nexport const resolveErrorTemplate = (\n type: string,\n overrides?: ErrorTemplateOverrides,\n): ErrorTemplate => {\n const templates = overrides\n ? { ...DEFAULT_ERROR_TEMPLATES, ...overrides }\n : DEFAULT_ERROR_TEMPLATES;\n return (\n templates[type as ConversationErrorType] ??\n templates['conversation-llm-error-text']\n );\n};\n"],"mappings":";;;;AAEA;;AAGA;;AAiCA,MAAMA,sBAA6C,GAAG,CACpD;EAAEC,IAAI,EAAE,WAAW;EAAEC,MAAM,EAAE,OAAO;EAAEC,OAAO,EAAE;AAAM,CAAC,EACtD;EAAEF,IAAI,EAAE,YAAY;EAAEE,OAAO,EAAE;AAAO,CAAC,CACxC;AAEM,MAAMC,uBAGZ,GAAAC,OAAA,CAAAD,uBAAA,GAAG;EACF,6BAA6B,EAAE;IAC7BE,KAAK,EACH,wFAAwF;IAC1FC,SAAS,EAAE;EACb,CAAC;EACD,iCAAiC,EAAE;IACjCD,KAAK,EACH,wFAAwF;IAC1FC,SAAS,EAAE;EACb,CAAC;EACD,kBAAkB,EAAE;IAClBC,QAAQ,EAAE,WAAW;IACrBF,KAAK,EAAE,sCAAsC;IAC7CG,OAAO,EAAET;EACX,CAAC;EACD,oCAAoC,EAAE;IACpCQ,QAAQ,EAAE,SAAS;IACnBF,KAAK,EAAE,kEAAkE;IACzEG,OAAO,EAAET;EACX,CAAC;EACD,sBAAsB,EAAE;IACtBQ,QAAQ,EAAE,SAAS;IACnBF,KAAK,EAAE,kEAAkE;IACzEG,OAAO,EAAET;EACX,CAAC;EACD,8BAA8B,EAAE;IAC9BQ,QAAQ,EAAE,iBAAiB;IAC3BF,KAAK,EAAE,2CAA2C;IAClDG,OAAO,EAAET;EACX,CAAC;EACD,kBAAkB,EAAE;IAClBQ,QAAQ,EAAE,WAAW;IACrBF,KAAK,EAAE,+DAA+D;IACtEC,SAAS,EAAE,IAAI;IACfG,UAAU,EAAE;EACd,CAAC;EACD,kBAAkB,EAAE;IAClBF,QAAQ,EAAE,WAAW;IACrBF,KAAK,EACH,kGAAkG;IACpGC,SAAS,EAAE,IAAI;IACfG,UAAU,EAAE;EACd,CAAC;EACD,kBAAkB,EAAE;IAClBF,QAAQ,EAAE,gBAAgB;IAC1BF,KAAK,EAAE,kEAAkE;IACzEG,OAAO,EAAE,CAAC;MAAER,IAAI,EAAE,YAAY;MAAEE,OAAO,EAAE;IAAO,CAAC;EACnD,CAAC;EACD,2BAA2B,EAAE;IAC3BK,QAAQ,EAAE,cAAc;IACxBF,KAAK,EAAE,+BAA+B;IACtCG,OAAO,EAAET;EACX,CAAC;EACD,oBAAoB,EAAE;IACpBQ,QAAQ,EAAE,iBAAiB;IAC3BF,KAAK,EAAE,0CAA0C;IACjDG,OAAO,EAAE,CACP;MAAER,IAAI,EAAE,kBAAkB;MAAEC,MAAM,EAAE,iBAAiB;MAAEC,OAAO,EAAE;IAAM,CAAC,EACvE;MAAEF,IAAI,EAAE,YAAY;MAAEE,OAAO,EAAE;IAAO,CAAC;EAE3C;AACF,CAAC;;AAED;AACO,MAAMQ,oBAAoB,GAAGA,CAClCC,IAAY,EACZC,SAAkC,KAChB;EAClB,MAAMC,SAAS,GAAGD,SAAS,GACvB;IAAE,GAAGT,uBAAuB;IAAE,GAAGS;EAAU,CAAC,GAC5CT,uBAAuB;EAC3B,OACEU,SAAS,CAACF,IAAI,CAA0B,IACxCE,SAAS,CAAC,6BAA6B,CAAC;AAE5C,CAAC;AAACT,OAAA,CAAAM,oBAAA,GAAAA,oBAAA","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;
|