@wix/web5-core 1.56.1 → 1.57.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/client/wixAuthFetch.js +2 -2
- package/dist/cjs/client/wixAuthFetch.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js +20 -15
- package/dist/cjs/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js +12 -4
- package/dist/cjs/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/listItemsSectionDefinition.js +24 -29
- package/dist/cjs/component/componentDefinitions/listItemsSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentParser.js +8 -1
- package/dist/cjs/component/componentParser.js.map +1 -1
- package/dist/cjs/component/types.js.map +1 -1
- package/dist/cjs/components/placement/PlacementResponseRenderer.css +0 -4
- package/dist/cjs/components/placement/PlacementResponseRenderer.js +11 -33
- package/dist/cjs/components/placement/PlacementResponseRenderer.js.map +1 -1
- package/dist/cjs/components/placement/buildPlacementDependencies.js.map +1 -1
- package/dist/cjs/components/ui/OptimizedImage.js +59 -14
- package/dist/cjs/components/ui/OptimizedImage.js.map +1 -1
- package/dist/cjs/components/ui/SectionSkeleton.css +19 -0
- package/dist/cjs/components/ui/SectionSkeleton.js +8 -4
- package/dist/cjs/components/ui/SectionSkeleton.js.map +1 -1
- package/dist/cjs/components/ui/UserQuery.css +72 -0
- package/dist/cjs/components/ui/UserQuery.js +131 -37
- package/dist/cjs/components/ui/UserQuery.js.map +1 -1
- package/dist/cjs/context/UserQueryContext.js +34 -0
- package/dist/cjs/context/UserQueryContext.js.map +1 -0
- package/dist/cjs/entity/defaultExtractor.js +9 -2
- package/dist/cjs/entity/defaultExtractor.js.map +1 -1
- package/dist/cjs/entity/fetchEntityListData.js +13 -26
- package/dist/cjs/entity/fetchEntityListData.js.map +1 -1
- package/dist/cjs/entity/index.js +5 -1
- package/dist/cjs/entity/index.js.map +1 -1
- package/dist/cjs/entity/listEntityItems.js +90 -0
- package/dist/cjs/entity/listEntityItems.js.map +1 -0
- package/dist/cjs/hostScope.js +63 -0
- package/dist/cjs/hostScope.js.map +1 -0
- package/dist/cjs/index.js +38 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/patternValidator/validator.test.js +61 -61
- package/dist/cjs/patternValidator/validator.test.js.map +1 -1
- package/dist/cjs/registry/ComponentRegistry.js +22 -2
- package/dist/cjs/registry/ComponentRegistry.js.map +1 -1
- package/dist/cjs/registry/index.js +1 -3
- package/dist/cjs/registry/index.js.map +1 -1
- package/dist/cjs/registry/types.js.map +1 -1
- package/dist/cjs/styles/base-utilities.css +35 -0
- package/dist/cjs/styles/components.css +1 -0
- package/dist/cjs/styles/host-reset.css +81 -0
- package/dist/cjs/styles/tailwind-theme.css +6 -6
- package/dist/cjs/utils/backendEnvironment.js +78 -0
- package/dist/cjs/utils/backendEnvironment.js.map +1 -0
- package/dist/cjs/utils/entityLinkParser.js +3 -1
- package/dist/cjs/utils/entityLinkParser.js.map +1 -1
- package/dist/cjs/utils/imageBackdrop.js +269 -0
- package/dist/cjs/utils/imageBackdrop.js.map +1 -0
- package/dist/cjs/utils/intentExtractor.js +20 -9
- package/dist/cjs/utils/intentExtractor.js.map +1 -1
- package/dist/cjs/utils/productBackHandoff.js +106 -0
- package/dist/cjs/utils/productBackHandoff.js.map +1 -0
- package/dist/cjs/utils/refreshPrompts.js +72 -0
- package/dist/cjs/utils/refreshPrompts.js.map +1 -0
- package/dist/esm/client/wixAuthFetch.js +2 -2
- package/dist/esm/client/wixAuthFetch.js.map +1 -1
- package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js +20 -15
- package/dist/esm/component/componentDefinitions/HeroEntitySectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js +12 -4
- package/dist/esm/component/componentDefinitions/HeroSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/listItemsSectionDefinition.js +25 -30
- package/dist/esm/component/componentDefinitions/listItemsSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentParser.js +8 -1
- package/dist/esm/component/componentParser.js.map +1 -1
- package/dist/esm/component/types.js.map +1 -1
- package/dist/esm/components/placement/PlacementResponseRenderer.css +0 -4
- package/dist/esm/components/placement/PlacementResponseRenderer.js +1 -16
- package/dist/esm/components/placement/PlacementResponseRenderer.js.map +1 -1
- package/dist/esm/components/placement/buildPlacementDependencies.js.map +1 -1
- package/dist/esm/components/ui/OptimizedImage.js +50 -5
- package/dist/esm/components/ui/OptimizedImage.js.map +1 -1
- package/dist/esm/components/ui/SectionSkeleton.css +19 -0
- package/dist/esm/components/ui/SectionSkeleton.js +5 -1
- package/dist/esm/components/ui/SectionSkeleton.js.map +1 -1
- package/dist/esm/components/ui/UserQuery.css +72 -0
- package/dist/esm/components/ui/UserQuery.js +52 -6
- package/dist/esm/components/ui/UserQuery.js.map +1 -1
- package/dist/esm/context/UserQueryContext.js +21 -0
- package/dist/esm/context/UserQueryContext.js.map +1 -0
- package/dist/esm/entity/defaultExtractor.js +9 -2
- package/dist/esm/entity/defaultExtractor.js.map +1 -1
- package/dist/esm/entity/fetchEntityListData.js +14 -26
- package/dist/esm/entity/fetchEntityListData.js.map +1 -1
- package/dist/esm/entity/index.js +1 -0
- package/dist/esm/entity/index.js.map +1 -1
- package/dist/esm/entity/listEntityItems.js +85 -0
- package/dist/esm/entity/listEntityItems.js.map +1 -0
- package/dist/esm/hostScope.js +59 -0
- package/dist/esm/hostScope.js.map +1 -0
- package/dist/esm/index.js +13 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/patternValidator/validator.test.js +61 -61
- package/dist/esm/patternValidator/validator.test.js.map +1 -1
- package/dist/esm/registry/ComponentRegistry.js +22 -2
- package/dist/esm/registry/ComponentRegistry.js.map +1 -1
- package/dist/esm/registry/index.js +0 -1
- package/dist/esm/registry/index.js.map +1 -1
- package/dist/esm/registry/types.js.map +1 -1
- package/dist/esm/styles/base-utilities.css +35 -0
- package/dist/esm/styles/components.css +1 -0
- package/dist/esm/styles/host-reset.css +81 -0
- package/dist/esm/styles/tailwind-theme.css +6 -6
- package/dist/esm/utils/backendEnvironment.js +71 -0
- package/dist/esm/utils/backendEnvironment.js.map +1 -0
- package/dist/esm/utils/entityLinkParser.js +3 -1
- package/dist/esm/utils/entityLinkParser.js.map +1 -1
- package/dist/esm/utils/imageBackdrop.js +262 -0
- package/dist/esm/utils/imageBackdrop.js.map +1 -0
- package/dist/esm/utils/intentExtractor.js +21 -12
- package/dist/esm/utils/intentExtractor.js.map +1 -1
- package/dist/esm/utils/productBackHandoff.js +100 -0
- package/dist/esm/utils/productBackHandoff.js.map +1 -0
- package/dist/esm/utils/refreshPrompts.js +67 -0
- package/dist/esm/utils/refreshPrompts.js.map +1 -0
- package/dist/types/component/componentDefinitions/HeroEntitySectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/HeroSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/listItemsSectionDefinition.d.ts +2 -2
- package/dist/types/component/componentDefinitions/listItemsSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentParser.d.ts.map +1 -1
- package/dist/types/component/types.d.ts +1 -5
- package/dist/types/component/types.d.ts.map +1 -1
- package/dist/types/components/placement/PlacementResponseRenderer.d.ts +1 -1
- package/dist/types/components/placement/PlacementResponseRenderer.d.ts.map +1 -1
- package/dist/types/components/placement/buildPlacementDependencies.d.ts +1 -2
- package/dist/types/components/placement/buildPlacementDependencies.d.ts.map +1 -1
- package/dist/types/components/ui/OptimizedImage.d.ts +9 -0
- package/dist/types/components/ui/OptimizedImage.d.ts.map +1 -1
- package/dist/types/components/ui/SectionSkeleton.d.ts.map +1 -1
- package/dist/types/components/ui/UserQuery.d.ts +21 -0
- package/dist/types/components/ui/UserQuery.d.ts.map +1 -1
- package/dist/types/context/UserQueryContext.d.ts +12 -0
- package/dist/types/context/UserQueryContext.d.ts.map +1 -0
- package/dist/types/entity/defaultExtractor.d.ts.map +1 -1
- package/dist/types/entity/fetchEntityListData.d.ts +0 -2
- package/dist/types/entity/fetchEntityListData.d.ts.map +1 -1
- package/dist/types/entity/index.d.ts +1 -0
- package/dist/types/entity/index.d.ts.map +1 -1
- package/dist/types/entity/listEntityItems.d.ts +40 -0
- package/dist/types/entity/listEntityItems.d.ts.map +1 -0
- package/dist/types/hostScope.d.ts +83 -0
- package/dist/types/hostScope.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/registry/ComponentRegistry.d.ts +8 -0
- package/dist/types/registry/ComponentRegistry.d.ts.map +1 -1
- package/dist/types/registry/index.d.ts +0 -1
- package/dist/types/registry/index.d.ts.map +1 -1
- package/dist/types/registry/types.d.ts +5 -6
- package/dist/types/registry/types.d.ts.map +1 -1
- package/dist/types/utils/backendEnvironment.d.ts +30 -0
- package/dist/types/utils/backendEnvironment.d.ts.map +1 -0
- package/dist/types/utils/entityLinkParser.d.ts.map +1 -1
- package/dist/types/utils/imageBackdrop.d.ts +102 -0
- package/dist/types/utils/imageBackdrop.d.ts.map +1 -0
- package/dist/types/utils/intentExtractor.d.ts +21 -4
- package/dist/types/utils/intentExtractor.d.ts.map +1 -1
- package/dist/types/utils/productBackHandoff.d.ts +43 -0
- package/dist/types/utils/productBackHandoff.d.ts.map +1 -0
- package/dist/types/utils/refreshPrompts.d.ts +32 -0
- package/dist/types/utils/refreshPrompts.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/components/placement/PlacementResponseRenderer.css +0 -4
- package/src/components/ui/SectionSkeleton.css +19 -0
- package/src/components/ui/UserQuery.css +72 -0
- package/src/styles/base-utilities.css +35 -0
- package/src/styles/components.css +1 -0
- package/src/styles/host-reset.css +81 -0
- package/src/styles/tailwind-theme.css +6 -6
- package/dist/cjs/registry/Intent.js +0 -19
- package/dist/cjs/registry/Intent.js.map +0 -1
- package/dist/cjs/utils/conversationApi.js +0 -52
- package/dist/cjs/utils/conversationApi.js.map +0 -1
- package/dist/cjs/utils/conversationMode.js +0 -23
- package/dist/cjs/utils/conversationMode.js.map +0 -1
- package/dist/esm/registry/Intent.js +0 -15
- package/dist/esm/registry/Intent.js.map +0 -1
- package/dist/esm/utils/conversationApi.js +0 -45
- package/dist/esm/utils/conversationApi.js.map +0 -1
- package/dist/esm/utils/conversationMode.js +0 -18
- package/dist/esm/utils/conversationMode.js.map +0 -1
- package/dist/types/registry/Intent.d.ts +0 -12
- package/dist/types/registry/Intent.d.ts.map +0 -1
- package/dist/types/utils/conversationApi.d.ts +0 -26
- package/dist/types/utils/conversationApi.d.ts.map +0 -1
- package/dist/types/utils/conversationMode.d.ts +0 -16
- package/dist/types/utils/conversationMode.d.ts.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mount-scope contract.
|
|
3
|
+
*
|
|
4
|
+
* Several packages have to agree on where Web5 content begins in a host
|
|
5
|
+
* document:
|
|
6
|
+
*
|
|
7
|
+
* - **web5-core** scopes its own CSS to it (`base-utilities.css` already
|
|
8
|
+
* targets `#root`).
|
|
9
|
+
* - **the client build** compiles every selector against it (`scopeCss` in
|
|
10
|
+
* `web5-core/scripts/scope-css.ts`).
|
|
11
|
+
* - **web50-server-ui** stamps `WEB5_ROOT_CLASS` on the element it mounts
|
|
12
|
+
* into, and renders the debug panel into `.debug-view`.
|
|
13
|
+
* - **embed-placement** mounts the *same* client bundle into
|
|
14
|
+
* `[data-web5-placement]` slots on host pages.
|
|
15
|
+
*
|
|
16
|
+
* One home for the list, so those cannot drift.
|
|
17
|
+
*
|
|
18
|
+
* ## Why it is a list and not just `#root`
|
|
19
|
+
*
|
|
20
|
+
* A placement renders client components **outside** `#root`, on the merchant's
|
|
21
|
+
* own PDP. A stylesheet scoped to `#root` alone leaves every placement — and the
|
|
22
|
+
* debug panel — completely unstyled. `w5-client-circana` and
|
|
23
|
+
* `w5-client-feature-com` each discovered this and each hardcoded their own
|
|
24
|
+
* list; this constant is what replaces both.
|
|
25
|
+
*/
|
|
26
|
+
export const WEB5_ROOT_ID = 'root';
|
|
27
|
+
export const WEB5_ROOT_CLASS = 'w5-root';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Every place Web5 content can be mounted.
|
|
31
|
+
*
|
|
32
|
+
* `#root` is the id the host runtime has always created, kept so the compiled
|
|
33
|
+
* stylesheet matches before any script runs. `.w5-root` is stamped at mount and
|
|
34
|
+
* keeps the contract working if the host ever renames the element.
|
|
35
|
+
*/
|
|
36
|
+
export const WEB5_SCOPES = [`#${WEB5_ROOT_ID}`, `.${WEB5_ROOT_CLASS}`, '[data-web5-placement]', '.debug-view'];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* `:is()` takes the specificity of its most specific argument, so this is worth
|
|
40
|
+
* (1,0,0) whichever branch matches — enough to outrank the (0,1,1) descendant
|
|
41
|
+
* selectors host themes use for rich-text typography.
|
|
42
|
+
*/
|
|
43
|
+
export const WEB5_SCOPE = `:is(${WEB5_SCOPES.join(',')})`;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Custom properties the **host** sets on `:root` at runtime. Their declarations
|
|
47
|
+
* must stay global: moved into the scope they would shadow the host's value for
|
|
48
|
+
* our own subtree, which is precisely where it is needed.
|
|
49
|
+
*
|
|
50
|
+
* Kept in sync with what `web50-server-ui` and the host offset injectors write.
|
|
51
|
+
*/
|
|
52
|
+
export const WEB5_GLOBAL_TOKENS = [/^--web5-host-left-offset$/, /^--web5-host-right-offset$/, /^--web5-window-scroll-top-offset$/];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Per-client overrides for the host adaptation web50-server-ui performs at
|
|
56
|
+
* mount. Shared behaviour, client values — a client package supplies this on
|
|
57
|
+
* `clientConfig.hostFit` and never forks the implementation.
|
|
58
|
+
*/
|
|
59
|
+
//# sourceMappingURL=hostScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WEB5_ROOT_ID","WEB5_ROOT_CLASS","WEB5_SCOPES","WEB5_SCOPE","join","WEB5_GLOBAL_TOKENS"],"sources":["../../src/hostScope.ts"],"sourcesContent":["/**\n * The mount-scope contract.\n *\n * Several packages have to agree on where Web5 content begins in a host\n * document:\n *\n * - **web5-core** scopes its own CSS to it (`base-utilities.css` already\n * targets `#root`).\n * - **the client build** compiles every selector against it (`scopeCss` in\n * `web5-core/scripts/scope-css.ts`).\n * - **web50-server-ui** stamps `WEB5_ROOT_CLASS` on the element it mounts\n * into, and renders the debug panel into `.debug-view`.\n * - **embed-placement** mounts the *same* client bundle into\n * `[data-web5-placement]` slots on host pages.\n *\n * One home for the list, so those cannot drift.\n *\n * ## Why it is a list and not just `#root`\n *\n * A placement renders client components **outside** `#root`, on the merchant's\n * own PDP. A stylesheet scoped to `#root` alone leaves every placement — and the\n * debug panel — completely unstyled. `w5-client-circana` and\n * `w5-client-feature-com` each discovered this and each hardcoded their own\n * list; this constant is what replaces both.\n */\nexport const WEB5_ROOT_ID = 'root';\n\nexport const WEB5_ROOT_CLASS = 'w5-root';\n\n/**\n * Every place Web5 content can be mounted.\n *\n * `#root` is the id the host runtime has always created, kept so the compiled\n * stylesheet matches before any script runs. `.w5-root` is stamped at mount and\n * keeps the contract working if the host ever renames the element.\n */\nexport const WEB5_SCOPES = [\n `#${WEB5_ROOT_ID}`,\n `.${WEB5_ROOT_CLASS}`,\n '[data-web5-placement]',\n '.debug-view',\n] as const;\n\n/**\n * `:is()` takes the specificity of its most specific argument, so this is worth\n * (1,0,0) whichever branch matches — enough to outrank the (0,1,1) descendant\n * selectors host themes use for rich-text typography.\n */\nexport const WEB5_SCOPE = `:is(${WEB5_SCOPES.join(',')})`;\n\n/**\n * Custom properties the **host** sets on `:root` at runtime. Their declarations\n * must stay global: moved into the scope they would shadow the host's value for\n * our own subtree, which is precisely where it is needed.\n *\n * Kept in sync with what `web50-server-ui` and the host offset injectors write.\n */\nexport const WEB5_GLOBAL_TOKENS: readonly RegExp[] = [\n /^--web5-host-left-offset$/,\n /^--web5-host-right-offset$/,\n /^--web5-window-scroll-top-offset$/,\n];\n\n/**\n * Per-client overrides for the host adaptation web50-server-ui performs at\n * mount. Shared behaviour, client values — a client package supplies this on\n * `clientConfig.hostFit` and never forks the implementation.\n */\nexport interface HostFitConfig {\n /** Master switch. Default `true`. */\n enabled?: boolean;\n /**\n * What \"the full available width\" means on this site. Default\n * `'main, [role=\"main\"]'`; falls back to `<body>` when nothing matches.\n */\n containerSelector?: string;\n /**\n * Widen the page's content container to the host container's content box.\n * Default **`false`** — opt in per client.\n *\n * Off by default because widening changes the layout of hosts that are\n * already sized correctly; only a client whose host constrains it (a theme\n * that drops the mount into a narrow reading column) needs this.\n */\n bleed?: boolean;\n /**\n * Sticky-header height. `'auto'` (default) measures it; a number pins it.\n *\n * Prefer pinning where the host chrome is known. Circana's\n * `inject-host-nav-offset` measured side rails at runtime, hit false\n * positives in production (host layout containers and full-height nav panels\n * matched the filter), and was changed to static values — the same trap\n * applies to any measured host geometry.\n */\n topInset?: number | 'auto';\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAG,MAAM;AAElC,OAAO,MAAMC,eAAe,GAAG,SAAS;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,CACzB,IAAIF,YAAY,EAAE,EAClB,IAAIC,eAAe,EAAE,EACrB,uBAAuB,EACvB,aAAa,CACL;;AAEV;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,UAAU,GAAG,OAAOD,WAAW,CAACE,IAAI,CAAC,GAAG,CAAC,GAAG;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAqC,GAAG,CACnD,2BAA2B,EAC3B,4BAA4B,EAC5B,mCAAmC,CACpC;;AAED;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export { ImageSearchFilterToken, backgroundFilter } from './image/imageSearchFil
|
|
|
20
20
|
export { HeroSectionDefinition, HeroEntitySectionDefinition, KpiSectionDefinition, FeatureCardsSectionDefinition, EntitySectionDefinition, ComparisonSectionDefinition, TextBlockSectionDefinition, CtaBannerSectionDefinition, CalloutSectionDefinition, NextStepsSectionDefinition, FeatureSection9PlusDefinition, ListItemsSectionDefinition, SkipNodesSectionDefinition, HtmlCommentSectionDefinition, SearchSectionDefinition, ErrorSectionDefinition, FallbackSectionDefinition, createSdkRegistry } from './component/componentDefinitions/index.js';
|
|
21
21
|
|
|
22
22
|
// Registry
|
|
23
|
-
export { ComponentRegistry
|
|
23
|
+
export { ComponentRegistry } from './registry/index.js';
|
|
24
24
|
// Pattern validator
|
|
25
25
|
export { validatePattern, validatePatternSyntax, validatePatternWithBlocks } from './patternValidator/index.js';
|
|
26
26
|
|
|
@@ -49,12 +49,15 @@ export { matchMarkdown, matchAllSections, nodesToParts } from './match/index.js'
|
|
|
49
49
|
// DI context and provider
|
|
50
50
|
export { ComponentDependenciesProvider, useComponentDependencies } from './context/ComponentDependenciesContext.js';
|
|
51
51
|
|
|
52
|
+
// Raw user query for the current response page
|
|
53
|
+
export { UserQueryProvider, useUserQuery } from './context/UserQueryContext.js';
|
|
54
|
+
|
|
52
55
|
// Chips context (suggestion chips shared between SearchSection and error states)
|
|
53
56
|
export { ChipsProvider, useChips } from './context/ChipsContext.js';
|
|
54
57
|
|
|
55
58
|
// DI types
|
|
56
59
|
|
|
57
|
-
export { defaultExtractor, enrichEntitiesFromPayload, fetchEntityListData, getEntityExtractor, registerEntityExtractor, transformToSolutionEntityData, transformToBlogPostEntityData, transformToGenericEntityData } from './entity/index.js';
|
|
60
|
+
export { defaultExtractor, enrichEntitiesFromPayload, fetchEntityListData, listEntityItems, LIST_ITEMS_ENDPOINT, getEntityExtractor, registerEntityExtractor, transformToSolutionEntityData, transformToBlogPostEntityData, transformToGenericEntityData } from './entity/index.js';
|
|
58
61
|
export { CALLOUT_KINDS } from './types/callout.js';
|
|
59
62
|
|
|
60
63
|
// Wrapper hooks
|
|
@@ -77,6 +80,7 @@ export { ShopifyStorefrontClient, resolveShopifyConfig, resolveShopifyEntity, tr
|
|
|
77
80
|
// Utilities
|
|
78
81
|
export { cn } from './lib/utils.js';
|
|
79
82
|
export { normalizeImageUrl, getResizedImageUrl } from './utils/image-utils.js';
|
|
83
|
+
export { analyzeBackdrop, computeContentBBox, buildProbeUrl, loadImagePixels, loadBackdropAnalysis } from './utils/imageBackdrop.js';
|
|
80
84
|
export { stripMarkdown } from './component/componentDefinitions/parse-utils.js';
|
|
81
85
|
|
|
82
86
|
// Color utilities
|
|
@@ -93,6 +97,7 @@ export { getForwardStack, setForwardStack, clearForwardStack, pushToForwardStack
|
|
|
93
97
|
|
|
94
98
|
// UI components
|
|
95
99
|
export { UserQuery } from './components/ui/UserQuery.js';
|
|
100
|
+
export { PRODUCT_BACK_SESSION_KEY, writeProductBackHandoff, readProductBackHandoff } from './utils/productBackHandoff.js';
|
|
96
101
|
export { PromptEntryEmptyState } from './components/ui/PromptEntryEmptyState.js';
|
|
97
102
|
export { SearchSection } from './components/ui/SearchSection.js';
|
|
98
103
|
export { FeedbackBar } from './components/ui/FeedbackBar.js';
|
|
@@ -142,11 +147,15 @@ export { findKeywordsInContent, getContextualImageFilename } from './utils/conte
|
|
|
142
147
|
export { extractIntentFromMarkdown, getIntentFromMarkdown } from './utils/intentExtractor.js';
|
|
143
148
|
export { createPageSection, generateSectionId, generateId, findImageInNode, findImageInChildren } from './utils/propsExtractor.js';
|
|
144
149
|
export { DiagnosticsCollector } from './utils/diagnosticsCollector.js';
|
|
145
|
-
export {
|
|
146
|
-
export {
|
|
150
|
+
export { REFRESH_PROMPTS_UNTIL_KEY, REFRESH_PROMPTS_WINDOW_MS, getRefreshPromptsExpiry, shouldRefreshPrompts, enableRefreshPrompts, disableRefreshPrompts } from './utils/refreshPrompts.js';
|
|
151
|
+
export { BACKEND_ENVIRONMENT_KEY, BACKEND_ENVIRONMENT_QUERY_PARAM, DEFAULT_BACKEND_ENVIRONMENT, getBackendEnvironment, setBackendEnvironment, usesStagingBackend } from './utils/backendEnvironment.js';
|
|
147
152
|
export { createWixAuthFetch } from './client/wixAuthFetch.js';
|
|
148
153
|
export { getOrCreateSessionId, getSessionId, getChatId, startNewChatId, setChatId, resetChatIdForTests } from './utils/sessionManager.js';
|
|
149
154
|
|
|
150
155
|
// Component parser orchestrator — lifted from web50-server-ui (DL #088 B9.5)
|
|
151
156
|
export { parseMarkdownToComponents, tryParseComponent, mergeSectionsWithStableReferences } from './component/componentParser.js';
|
|
157
|
+
// Host-mount scope contract — shared by web50-server-ui (which stamps the
|
|
158
|
+
// class and mounts), embed-placement (which mounts the same bundle elsewhere),
|
|
159
|
+
// and the client CDN build (which compiles every selector against it).
|
|
160
|
+
export { WEB5_ROOT_ID, WEB5_ROOT_CLASS, WEB5_SCOPES, WEB5_SCOPE, WEB5_GLOBAL_TOKENS } from './hostScope.js';
|
|
152
161
|
//# sourceMappingURL=index.js.map
|
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","ComparisonSectionDefinition","TextBlockSectionDefinition","CtaBannerSectionDefinition","CalloutSectionDefinition","NextStepsSectionDefinition","FeatureSection9PlusDefinition","ListItemsSectionDefinition","SkipNodesSectionDefinition","HtmlCommentSectionDefinition","SearchSectionDefinition","ErrorSectionDefinition","FallbackSectionDefinition","createSdkRegistry","ComponentRegistry","Intent","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","ChipsProvider","useChips","defaultExtractor","enrichEntitiesFromPayload","fetchEntityListData","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","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","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","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","CONVERSATION_MODE","resolveConversationMode","CONVERSATION_API_KEY","DEFAULT_CONVERSATION_API","getConversationApi","setConversationApi","usesTurnApi","createWixAuthFetch","getOrCreateSessionId","getSessionId","getChatId","startNewChatId","setChatId","resetChatIdForTests","parseMarkdownToComponents","tryParseComponent","mergeSectionsWithStableReferences"],"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 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, Intent } 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// 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 getEntityExtractor,\n registerEntityExtractor,\n transformToSolutionEntityData,\n transformToBlogPostEntityData,\n transformToGenericEntityData,\n} from './entity';\nexport type {\n EntityExtractor,\n FetchEntityListDataOptions,\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 { 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 { UserQuery, type UserQueryProps } from './components/ui/UserQuery';\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// 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 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 CONVERSATION_MODE,\n resolveConversationMode,\n} from './utils/conversationMode';\nexport {\n type ConversationApiKind,\n CONVERSATION_API_KEY,\n DEFAULT_CONVERSATION_API,\n getConversationApi,\n setConversationApi,\n usesTurnApi,\n} from './utils/conversationApi';\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"],"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;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,2BAA2B,EAC3BC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,wBAAwB,EACxBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,uBAAuB,EACvBC,sBAAsB,EACtBC,yBAAyB,EACzBC,iBAAiB,QACZ,kCAAkC;;AAEzC;AACA,SAASC,iBAAiB,EAAEC,MAAM,QAAQ,YAAY;AAgBtD;AACA,SACEC,eAAe,EACfC,qBAAqB,EACrBC,yBAAyB,QAMpB,oBAAoB;;AAE3B;AACA,SACEC,sBAAsB,EACtBC,iCAAiC,QAE5B,kBAAkB;;AAEzB;AACA,SACEC,WAAW,EAgBXC,YAAY,EACZC,eAAe,EACfC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,eAAe,EACfC,SAAS,EACTC,cAAc,EACdC,cAAc,EACdC,WAAW,QACN,oBAAoB;;AAE3B;AACA,SACEC,Y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A,SACEC,yBAAyB,QAGpB,4BAA4B;;AAEnC;AACA,SACEC,mBAAmB,QAId,uBAAuB;AAC9B;AACA;AACA;;AAEA;AACA,SAASC,gBAAgB,QAAQ,2BAA2B;;AAE5D;AACA;AACA,SACEC,uBAAuB,EACvBC,mBAAmB,QACd,+BAA+B;;AAEtC;AACA,SACEC,yBAAyB,EACzBC,qBAAqB,QAIhB,kDAAkD;AACzD,SACEC,0BAA0B,QAErB,mDAAmD;AAC1D,SACEC,wBAAwB,EACxBC,mBAAmB,QAEd,gDAAgD;;AAEvD;AACA,SACEC,qBAAqB,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,QAGhB,yBAAyB;AAEhC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,UAAU,EACVC,eAAe,EACfC,mBAAmB,QAId,wBAAwB;AAC/B,SACEC,oBAAoB,QAEf,8BAA8B;AACrC,SACEC,iBAAiB,EACjBC,uBAAuB,QAClB,0BAA0B;AACjC,SAEEC,oBAAoB,EACpBC,wBAAwB,EACxBC,kBAAkB,EAClBC,kBAAkB,EAClBC,WAAW,QACN,yBAAyB;AAChC,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","ignoreList":[]}
|
|
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","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","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","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 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// 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 { 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;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,2BAA2B,EAC3BC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,wBAAwB,EACxBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,uBAAuB,EACvBC,sBAAsB,EACtBC,yBAAyB,EACzBC,iBAAiB,QACZ,kCAAkC;;AAEzC;AACA,SAASC,iBAAiB,QAAQ,YAAY;AAgB9C;AACA,SACEC,eAAe,EACfC,qBAAqB,EACrBC,yBAAyB,QAMpB,oBAAoB;;AAE3B;AACA,SACEC,sBAAsB,EAC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rC,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,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":[]}
|
|
@@ -92,7 +92,7 @@ function createMockAstNodes(blockElements) {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// Handle entity links for testing (e.g., 'entity_link:
|
|
95
|
+
// Handle entity links for testing (e.g., 'entity_link:news_item:abc123')
|
|
96
96
|
const elementStr = String(element);
|
|
97
97
|
if (elementStr.startsWith('entity_link:')) {
|
|
98
98
|
const parts = elementStr.slice('entity_link:'.length).split(':');
|
|
@@ -867,7 +867,7 @@ describe('Pattern Validator', () => {
|
|
|
867
867
|
it('validates link attribute selector syntax', () => {
|
|
868
868
|
// Basic attribute selectors
|
|
869
869
|
expect(validatePatternSyntax('link[entityType]').valid).toBe(true);
|
|
870
|
-
expect(validatePatternSyntax('link[entityType="
|
|
870
|
+
expect(validatePatternSyntax('link[entityType="news_item"]').valid).toBe(true);
|
|
871
871
|
expect(validatePatternSyntax('link[protocol="entity"]').valid).toBe(true);
|
|
872
872
|
expect(validatePatternSyntax('link[entityId="abc123"]').valid).toBe(true);
|
|
873
873
|
});
|
|
@@ -880,35 +880,35 @@ describe('Pattern Validator', () => {
|
|
|
880
880
|
expect(validatePatternSyntax('link[entityId$="123"]').valid).toBe(true);
|
|
881
881
|
});
|
|
882
882
|
it('validates multiple link attributes', () => {
|
|
883
|
-
expect(validatePatternSyntax('link[entityType="
|
|
883
|
+
expect(validatePatternSyntax('link[entityType="news_item"][entityId]').valid).toBe(true);
|
|
884
884
|
expect(validatePatternSyntax('link[protocol="entity"][entityType="product"]').valid).toBe(true);
|
|
885
885
|
});
|
|
886
886
|
it('validates link attributes with quantifiers', () => {
|
|
887
|
-
expect(validatePatternSyntax('link[entityType="
|
|
888
|
-
expect(validatePatternSyntax('link[entityType="
|
|
889
|
-
expect(validatePatternSyntax('link[entityType="
|
|
890
|
-
expect(validatePatternSyntax('link[entityType="
|
|
891
|
-
expect(validatePatternSyntax('link[entityType="
|
|
887
|
+
expect(validatePatternSyntax('link[entityType="news_item"]?').valid).toBe(true);
|
|
888
|
+
expect(validatePatternSyntax('link[entityType="news_item"]*').valid).toBe(true);
|
|
889
|
+
expect(validatePatternSyntax('link[entityType="news_item"]+').valid).toBe(true);
|
|
890
|
+
expect(validatePatternSyntax('link[entityType="news_item"][2]').valid).toBe(true);
|
|
891
|
+
expect(validatePatternSyntax('link[entityType="news_item"][1-3]').valid).toBe(true);
|
|
892
892
|
});
|
|
893
893
|
it('validates link attributes in sequences', () => {
|
|
894
|
-
expect(validatePatternSyntax('h2 > link[entityType="
|
|
894
|
+
expect(validatePatternSyntax('h2 > link[entityType="news_item"] > t').valid).toBe(true);
|
|
895
895
|
expect(validatePatternSyntax('link[protocol="entity"] > image > t').valid).toBe(true);
|
|
896
896
|
});
|
|
897
897
|
it('validates link attributes in groups and alternation', () => {
|
|
898
|
-
expect(validatePatternSyntax('(link[entityType="
|
|
898
|
+
expect(validatePatternSyntax('(link[entityType="news_item"] | link[entityType="product"])').valid).toBe(true);
|
|
899
899
|
expect(validatePatternSyntax('(t > link[entityType])+').valid).toBe(true);
|
|
900
900
|
});
|
|
901
901
|
});
|
|
902
902
|
describe('Entity Link Matching', () => {
|
|
903
903
|
it('matches entity link with exact entityType', () => {
|
|
904
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
905
|
-
const result = validatePattern(nodes, 'link[entityType="
|
|
904
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
905
|
+
const result = validatePattern(nodes, 'link[entityType="news_item"] > t');
|
|
906
906
|
expect(result.valid).toBe(true);
|
|
907
907
|
expect(result.endIndex).toBe(1);
|
|
908
908
|
});
|
|
909
909
|
it('does not match entity link with different entityType', () => {
|
|
910
910
|
const nodes = createMockAstNodes(['entity_link:product:xyz789', 't']);
|
|
911
|
-
const result = validatePattern(nodes, 'link[entityType="
|
|
911
|
+
const result = validatePattern(nodes, 'link[entityType="news_item"] > t');
|
|
912
912
|
expect(result.valid).toBe(false);
|
|
913
913
|
});
|
|
914
914
|
it('matches entity link with entityType exists check', () => {
|
|
@@ -922,17 +922,17 @@ describe('Pattern Validator', () => {
|
|
|
922
922
|
expect(result.valid).toBe(false);
|
|
923
923
|
});
|
|
924
924
|
it('matches entity link with exact entityId', () => {
|
|
925
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
925
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
926
926
|
const result = validatePattern(nodes, 'link[entityId="abc123"] > t');
|
|
927
927
|
expect(result.valid).toBe(true);
|
|
928
928
|
});
|
|
929
929
|
it('matches entity link with protocol="web5"', () => {
|
|
930
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
930
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
931
931
|
const result = validatePattern(nodes, 'link[protocol="web5"] > t');
|
|
932
932
|
expect(result.valid).toBe(true);
|
|
933
933
|
});
|
|
934
934
|
it('does not match entity link when http protocol is required', () => {
|
|
935
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
935
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
936
936
|
const result = validatePattern(nodes, 'link[protocol="http"] > t');
|
|
937
937
|
expect(result.valid).toBe(false);
|
|
938
938
|
});
|
|
@@ -949,39 +949,39 @@ describe('Pattern Validator', () => {
|
|
|
949
949
|
});
|
|
950
950
|
describe('Entity Link Attribute Operators', () => {
|
|
951
951
|
it('matches entityType containing substring (*=)', () => {
|
|
952
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
953
|
-
expect(validatePattern(nodes, 'link[entityType*="
|
|
954
|
-
expect(validatePattern(nodes, 'link[entityType*="
|
|
955
|
-
expect(validatePattern(nodes, 'link[entityType*="
|
|
952
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
953
|
+
expect(validatePattern(nodes, 'link[entityType*="news"] > t').valid).toBe(true);
|
|
954
|
+
expect(validatePattern(nodes, 'link[entityType*="item"] > t').valid).toBe(true);
|
|
955
|
+
expect(validatePattern(nodes, 'link[entityType*="ws_it"] > t').valid).toBe(true);
|
|
956
956
|
expect(validatePattern(nodes, 'link[entityType*="product"] > t').valid).toBe(false);
|
|
957
957
|
});
|
|
958
958
|
it('matches entityType starting with prefix (^=)', () => {
|
|
959
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
960
|
-
expect(validatePattern(nodes, 'link[entityType^="
|
|
961
|
-
expect(validatePattern(nodes, 'link[entityType^="
|
|
962
|
-
expect(validatePattern(nodes, 'link[entityType^="
|
|
959
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
960
|
+
expect(validatePattern(nodes, 'link[entityType^="news"] > t').valid).toBe(true);
|
|
961
|
+
expect(validatePattern(nodes, 'link[entityType^="news_"] > t').valid).toBe(true);
|
|
962
|
+
expect(validatePattern(nodes, 'link[entityType^="item"] > t').valid).toBe(false);
|
|
963
963
|
});
|
|
964
964
|
it('matches entityType ending with suffix ($=)', () => {
|
|
965
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
966
|
-
expect(validatePattern(nodes, 'link[entityType$="
|
|
967
|
-
expect(validatePattern(nodes, 'link[entityType$="
|
|
968
|
-
expect(validatePattern(nodes, 'link[entityType$="
|
|
965
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
966
|
+
expect(validatePattern(nodes, 'link[entityType$="item"] > t').valid).toBe(true);
|
|
967
|
+
expect(validatePattern(nodes, 'link[entityType$="_item"] > t').valid).toBe(true);
|
|
968
|
+
expect(validatePattern(nodes, 'link[entityType$="news"] > t').valid).toBe(false);
|
|
969
969
|
});
|
|
970
970
|
it('matches entityId ending with suffix ($=)', () => {
|
|
971
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
971
|
+
const nodes = createMockAstNodes(['entity_link:news_item:post123', 't']);
|
|
972
972
|
expect(validatePattern(nodes, 'link[entityId$="123"] > t').valid).toBe(true);
|
|
973
973
|
expect(validatePattern(nodes, 'link[entityId$="789"] > t').valid).toBe(false);
|
|
974
974
|
});
|
|
975
975
|
});
|
|
976
976
|
describe('Multiple Link Attributes', () => {
|
|
977
977
|
it('matches with both entityType and entityId', () => {
|
|
978
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
979
|
-
const result = validatePattern(nodes, 'link[entityType="
|
|
978
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
979
|
+
const result = validatePattern(nodes, 'link[entityType="news_item"][entityId="abc123"] > t');
|
|
980
980
|
expect(result.valid).toBe(true);
|
|
981
981
|
});
|
|
982
982
|
it('does not match if one attribute fails', () => {
|
|
983
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
984
|
-
const result = validatePattern(nodes, 'link[entityType="
|
|
983
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
984
|
+
const result = validatePattern(nodes, 'link[entityType="news_item"][entityId="xyz789"] > t');
|
|
985
985
|
expect(result.valid).toBe(false);
|
|
986
986
|
});
|
|
987
987
|
it('matches with protocol and entityType', () => {
|
|
@@ -993,49 +993,49 @@ describe('Pattern Validator', () => {
|
|
|
993
993
|
describe('Optional Entity Links', () => {
|
|
994
994
|
it('matches pattern without link when optional', () => {
|
|
995
995
|
const nodes = createMockAstNodes(['h2', 't']);
|
|
996
|
-
const result = validatePattern(nodes, 'h2 > link[entityType="
|
|
996
|
+
const result = validatePattern(nodes, 'h2 > link[entityType="news_item"]? > t');
|
|
997
997
|
expect(result.valid).toBe(true);
|
|
998
998
|
expect(result.endIndex).toBe(1);
|
|
999
999
|
});
|
|
1000
1000
|
it('matches pattern with matching link when optional', () => {
|
|
1001
|
-
const nodes = createMockAstNodes(['h2', 'entity_link:
|
|
1002
|
-
const result = validatePattern(nodes, 'h2 > link[entityType="
|
|
1001
|
+
const nodes = createMockAstNodes(['h2', 'entity_link:news_item:abc123', 't']);
|
|
1002
|
+
const result = validatePattern(nodes, 'h2 > link[entityType="news_item"]? > t');
|
|
1003
1003
|
expect(result.valid).toBe(true);
|
|
1004
1004
|
expect(result.endIndex).toBe(2);
|
|
1005
1005
|
});
|
|
1006
1006
|
it('skips non-matching optional entity link', () => {
|
|
1007
1007
|
// When optional entity link doesn't match, pattern should try to match without it
|
|
1008
1008
|
const nodes = createMockAstNodes(['h2', 'http_link', 't']);
|
|
1009
|
-
const result = validatePattern(nodes, 'h2 > link[entityType="
|
|
1009
|
+
const result = validatePattern(nodes, 'h2 > link[entityType="news_item"]? > link > t');
|
|
1010
1010
|
expect(result.valid).toBe(true);
|
|
1011
1011
|
});
|
|
1012
1012
|
});
|
|
1013
1013
|
describe('Entity Links with Quantifiers', () => {
|
|
1014
1014
|
it('matches zero or more entity links (*)', () => {
|
|
1015
1015
|
const nodes1 = createMockAstNodes(['h2', 't']);
|
|
1016
|
-
const nodes2 = createMockAstNodes(['h2', 'entity_link:
|
|
1017
|
-
const nodes3 = createMockAstNodes(['h2', 'entity_link:
|
|
1018
|
-
expect(validatePattern(nodes1, 'h2 > link[entityType="
|
|
1019
|
-
expect(validatePattern(nodes2, 'h2 > link[entityType="
|
|
1020
|
-
expect(validatePattern(nodes3, 'h2 > link[entityType="
|
|
1016
|
+
const nodes2 = createMockAstNodes(['h2', 'entity_link:news_item:1', 't']);
|
|
1017
|
+
const nodes3 = createMockAstNodes(['h2', 'entity_link:news_item:1', 'entity_link:news_item:2', 't']);
|
|
1018
|
+
expect(validatePattern(nodes1, 'h2 > link[entityType="news_item"]* > t').valid).toBe(true);
|
|
1019
|
+
expect(validatePattern(nodes2, 'h2 > link[entityType="news_item"]* > t').valid).toBe(true);
|
|
1020
|
+
expect(validatePattern(nodes3, 'h2 > link[entityType="news_item"]* > t').valid).toBe(true);
|
|
1021
1021
|
});
|
|
1022
1022
|
it('matches one or more entity links (+)', () => {
|
|
1023
1023
|
const nodes1 = createMockAstNodes(['h2', 't']);
|
|
1024
|
-
const nodes2 = createMockAstNodes(['h2', 'entity_link:
|
|
1025
|
-
const nodes3 = createMockAstNodes(['h2', 'entity_link:
|
|
1026
|
-
expect(validatePattern(nodes1, 'h2 > link[entityType="
|
|
1027
|
-
expect(validatePattern(nodes2, 'h2 > link[entityType="
|
|
1028
|
-
expect(validatePattern(nodes3, 'h2 > link[entityType="
|
|
1024
|
+
const nodes2 = createMockAstNodes(['h2', 'entity_link:news_item:1', 't']);
|
|
1025
|
+
const nodes3 = createMockAstNodes(['h2', 'entity_link:news_item:1', 'entity_link:news_item:2', 't']);
|
|
1026
|
+
expect(validatePattern(nodes1, 'h2 > link[entityType="news_item"]+ > t').valid).toBe(false);
|
|
1027
|
+
expect(validatePattern(nodes2, 'h2 > link[entityType="news_item"]+ > t').valid).toBe(true);
|
|
1028
|
+
expect(validatePattern(nodes3, 'h2 > link[entityType="news_item"]+ > t').valid).toBe(true);
|
|
1029
1029
|
});
|
|
1030
1030
|
it('matches exact count of entity links ([N])', () => {
|
|
1031
|
-
const nodes = createMockAstNodes(['h2', 'entity_link:
|
|
1032
|
-
expect(validatePattern(nodes, 'h2 > link[entityType="
|
|
1033
|
-
expect(validatePattern(nodes, 'h2 > link[entityType="
|
|
1031
|
+
const nodes = createMockAstNodes(['h2', 'entity_link:news_item:1', 'entity_link:news_item:2', 't']);
|
|
1032
|
+
expect(validatePattern(nodes, 'h2 > link[entityType="news_item"][2] > t').valid).toBe(true);
|
|
1033
|
+
expect(validatePattern(nodes, 'h2 > link[entityType="news_item"][3] > t').valid).toBe(false);
|
|
1034
1034
|
});
|
|
1035
1035
|
});
|
|
1036
1036
|
describe('Backward Compatibility', () => {
|
|
1037
1037
|
it('plain link matches entity links', () => {
|
|
1038
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
1038
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't']);
|
|
1039
1039
|
const result = validatePattern(nodes, 'link > t');
|
|
1040
1040
|
expect(result.valid).toBe(true);
|
|
1041
1041
|
});
|
|
@@ -1053,32 +1053,32 @@ describe('Pattern Validator', () => {
|
|
|
1053
1053
|
});
|
|
1054
1054
|
describe('Complex Entity Link Patterns', () => {
|
|
1055
1055
|
it('matches mixed entity and regular links in sequence', () => {
|
|
1056
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
1056
|
+
const nodes = createMockAstNodes(['entity_link:news_item:abc123', 't', 'http_link', 't']);
|
|
1057
1057
|
const result = validatePattern(nodes, 'link[protocol="web5"] > t > link[protocol="http"] > t');
|
|
1058
1058
|
expect(result.valid).toBe(true);
|
|
1059
1059
|
});
|
|
1060
1060
|
it('matches entity links in alternation', () => {
|
|
1061
|
-
const nodes1 = createMockAstNodes(['h2', 'entity_link:
|
|
1061
|
+
const nodes1 = createMockAstNodes(['h2', 'entity_link:news_item:1', 't']);
|
|
1062
1062
|
const nodes2 = createMockAstNodes(['h2', 'entity_link:product:1', 't']);
|
|
1063
|
-
const pattern = 'h2 > (link[entityType="
|
|
1063
|
+
const pattern = 'h2 > (link[entityType="news_item"] | link[entityType="product"]) > t';
|
|
1064
1064
|
expect(validatePattern(nodes1, pattern).valid).toBe(true);
|
|
1065
1065
|
expect(validatePattern(nodes2, pattern).valid).toBe(true);
|
|
1066
1066
|
});
|
|
1067
1067
|
it('matches entity links in groups with quantifiers', () => {
|
|
1068
|
-
const nodes = createMockAstNodes(['h2', 'entity_link:
|
|
1069
|
-
const result = validatePattern(nodes, 'h2 > (link[entityType="
|
|
1068
|
+
const nodes = createMockAstNodes(['h2', 'entity_link:news_item:1', 't', 'entity_link:news_item:2', 't']);
|
|
1069
|
+
const result = validatePattern(nodes, 'h2 > (link[entityType="news_item"] > t)+');
|
|
1070
1070
|
expect(result.valid).toBe(true);
|
|
1071
1071
|
expect(result.endIndex).toBe(4);
|
|
1072
1072
|
});
|
|
1073
1073
|
it('matches real-world blog post pattern with entity links', () => {
|
|
1074
|
-
const nodes = createMockAstNodes(['h2', 't', 'entity_link:
|
|
1075
|
-
const pattern = 'h2 > t > (link[entityType="
|
|
1074
|
+
const nodes = createMockAstNodes(['h2', 't', 'entity_link:news_item:123', 'image', 't', 'entity_link:news_item:456', 'image', 't']);
|
|
1075
|
+
const pattern = 'h2 > t > (link[entityType="news_item"] > image > t)+';
|
|
1076
1076
|
expect(validatePattern(nodes, pattern).valid).toBe(true);
|
|
1077
1077
|
});
|
|
1078
1078
|
it('matches pattern with entity type prefix matching', () => {
|
|
1079
|
-
const nodes = createMockAstNodes(['entity_link:
|
|
1080
|
-
// Match any link where entityType starts with "
|
|
1081
|
-
const result = validatePattern(nodes, 'link[entityType^="
|
|
1079
|
+
const nodes = createMockAstNodes(['entity_link:news_item:1', 'entity_link:news_flash:2', 't']);
|
|
1080
|
+
// Match any link where entityType starts with "news"
|
|
1081
|
+
const result = validatePattern(nodes, 'link[entityType^="news"]+ > t');
|
|
1082
1082
|
expect(result.valid).toBe(true);
|
|
1083
1083
|
});
|
|
1084
1084
|
});
|