@wix/web5-core 1.56.1 → 1.57.1
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 +100 -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 +100 -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 +100 -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
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.__resetEntityListDataCache = __resetEntityListDataCache;
|
|
5
5
|
exports.fetchEntityListData = fetchEntityListData;
|
|
6
|
+
var _listEntityItems = require("./listEntityItems");
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
* by id. Pure async helper — no React, no host environment. Shared
|
|
9
|
-
* the main app's `useEntityListData` hook (web50-server-ui) and the
|
|
8
|
+
* Resolves entities via the `list-items` RPC (POST `{ ids }`) and returns a
|
|
9
|
+
* Map keyed by id. Pure async helper — no React, no host environment. Shared
|
|
10
|
+
* between the main app's `useEntityListData` hook (web50-server-ui) and the
|
|
10
11
|
* placement bundle's `useResolveGenericEntityData` impl (DL #099). Both
|
|
11
12
|
* pass an injected `fetchImpl` so the call rides on whichever auth
|
|
12
13
|
* strategy the surface uses (`@wix/sdk` Wix-auth in the placement,
|
|
@@ -17,13 +18,6 @@ exports.fetchEntityListData = fetchEntityListData;
|
|
|
17
18
|
* again inside a placement (or vice-versa) reuses the same lookup.
|
|
18
19
|
*/
|
|
19
20
|
const entityCache = new Map();
|
|
20
|
-
const DEFAULT_ENDPOINT = 'https://www.wixapis.com/wix-assistant-web5/v1/items';
|
|
21
|
-
function buildUrl(endpoint, ids) {
|
|
22
|
-
const url = new URL(endpoint);
|
|
23
|
-
ids.forEach(id => url.searchParams.append('id', id));
|
|
24
|
-
return url;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
21
|
/**
|
|
28
22
|
* Returns a Map of `id → ApiPayloadItem`. Hits the cache first; only
|
|
29
23
|
* uncached ids ride the network. The Map includes both cached and freshly
|
|
@@ -47,26 +41,19 @@ async function fetchEntityListData(ids, opts = {}) {
|
|
|
47
41
|
}
|
|
48
42
|
if (uncachedIds.length === 0) return result;
|
|
49
43
|
const fetchImpl = opts.fetchImpl ?? (typeof window !== 'undefined' ? fetch.bind(window) : fetch);
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
|
|
45
|
+
// Entities resolve via the new-RAG `list-items` RPC (POST `{ ids }`).
|
|
46
|
+
// See listEntityItems.ts.
|
|
52
47
|
try {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
headers: {
|
|
56
|
-
'Content-Type': 'application/json'
|
|
57
|
-
}
|
|
48
|
+
const items = await (0, _listEntityItems.listEntityItems)(uncachedIds, {
|
|
49
|
+
fetchImpl
|
|
58
50
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const id = item.id;
|
|
63
|
-
if (id) {
|
|
64
|
-
entityCache.set(id, item);
|
|
65
|
-
result.set(id, item);
|
|
66
|
-
}
|
|
51
|
+
for (const [id, item] of items) {
|
|
52
|
+
entityCache.set(id, item);
|
|
53
|
+
result.set(id, item);
|
|
67
54
|
}
|
|
68
55
|
} catch {
|
|
69
|
-
// network / parse error — return whatever we have from cache
|
|
56
|
+
// network / HTTP / parse error — return whatever we have from cache
|
|
70
57
|
}
|
|
71
58
|
return result;
|
|
72
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_listEntityItems","require","entityCache","Map","fetchEntityListData","ids","opts","result","length","uncachedIds","id","cached","get","set","push","fetchImpl","window","fetch","bind","items","listEntityItems","item","__resetEntityListDataCache","clear"],"sources":["../../../src/entity/fetchEntityListData.ts"],"sourcesContent":["import type { ApiPayloadItem } from '../types/entity';\nimport { listEntityItems } from './listEntityItems';\n\n/**\n * Resolves entities via the `list-items` RPC (POST `{ ids }`) and returns a\n * Map keyed by id. Pure async helper — no React, no host environment. Shared\n * between the main app's `useEntityListData` hook (web50-server-ui) and the\n * placement bundle's `useResolveGenericEntityData` impl (DL #099). Both\n * pass an injected `fetchImpl` so the call rides on whichever auth\n * strategy the surface uses (`@wix/sdk` Wix-auth in the placement,\n * the app's `client.fetchWithAuth` in the main app).\n *\n * The same singleton cache used to live inside `useEntityListData`. Hoisting\n * it here means a section that renders first in the main app and then\n * again inside a placement (or vice-versa) reuses the same lookup.\n */\nconst entityCache = new Map<string, ApiPayloadItem>();\n\nexport interface FetchEntityListDataOptions {\n /** Auth-aware fetch. Required when the host needs Wix OAuth (any cross-origin call). */\n fetchImpl?: typeof fetch;\n}\n\n/**\n * Returns a Map of `id → ApiPayloadItem`. Hits the cache first; only\n * uncached ids ride the network. The Map includes both cached and freshly\n * fetched rows.\n *\n * On HTTP error or network failure, the returned Map omits the requested\n * id; callers decide whether to fire a diagnostic. The promise resolves\n * either way — the caller's UI should keep rendering with whatever it has.\n */\nexport async function fetchEntityListData(\n ids: string[],\n opts: FetchEntityListDataOptions = {},\n): Promise<Map<string, ApiPayloadItem>> {\n const result = new Map<string, ApiPayloadItem>();\n if (!ids.length) return result;\n\n const uncachedIds: string[] = [];\n for (const id of ids) {\n const cached = entityCache.get(id);\n if (cached) {\n result.set(id, cached);\n } else {\n uncachedIds.push(id);\n }\n }\n if (uncachedIds.length === 0) return result;\n\n const fetchImpl =\n opts.fetchImpl ??\n (typeof window !== 'undefined' ? fetch.bind(window) : fetch);\n\n // Entities resolve via the new-RAG `list-items` RPC (POST `{ ids }`).\n // See listEntityItems.ts.\n try {\n const items = await listEntityItems(uncachedIds, { fetchImpl });\n for (const [id, item] of items) {\n entityCache.set(id, item);\n result.set(id, item);\n }\n } catch {\n // network / HTTP / parse error — return whatever we have from cache\n }\n\n return result;\n}\n\n/** Test helper — drops the singleton cache so specs start clean. */\nexport function __resetEntityListDataCache(): void {\n entityCache.clear();\n}\n"],"mappings":";;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAyB,CAAC;AAOrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeC,mBAAmBA,CACvCC,GAAa,EACbC,IAAgC,GAAG,CAAC,CAAC,EACC;EACtC,MAAMC,MAAM,GAAG,IAAIJ,GAAG,CAAyB,CAAC;EAChD,IAAI,CAACE,GAAG,CAACG,MAAM,EAAE,OAAOD,MAAM;EAE9B,MAAME,WAAqB,GAAG,EAAE;EAChC,KAAK,MAAMC,EAAE,IAAIL,GAAG,EAAE;IACpB,MAAMM,MAAM,GAAGT,WAAW,CAACU,GAAG,CAACF,EAAE,CAAC;IAClC,IAAIC,MAAM,EAAE;MACVJ,MAAM,CAACM,GAAG,CAACH,EAAE,EAAEC,MAAM,CAAC;IACxB,CAAC,MAAM;MACLF,WAAW,CAACK,IAAI,CAACJ,EAAE,CAAC;IACtB;EACF;EACA,IAAID,WAAW,CAACD,MAAM,KAAK,CAAC,EAAE,OAAOD,MAAM;EAE3C,MAAMQ,SAAS,GACbT,IAAI,CAACS,SAAS,KACb,OAAOC,MAAM,KAAK,WAAW,GAAGC,KAAK,CAACC,IAAI,CAACF,MAAM,CAAC,GAAGC,KAAK,CAAC;;EAE9D;EACA;EACA,IAAI;IACF,MAAME,KAAK,GAAG,MAAM,IAAAC,gCAAe,EAACX,WAAW,EAAE;MAAEM;IAAU,CAAC,CAAC;IAC/D,KAAK,MAAM,CAACL,EAAE,EAAEW,IAAI,CAAC,IAAIF,KAAK,EAAE;MAC9BjB,WAAW,CAACW,GAAG,CAACH,EAAE,EAAEW,IAAI,CAAC;MACzBd,MAAM,CAACM,GAAG,CAACH,EAAE,EAAEW,IAAI,CAAC;IACtB;EACF,CAAC,CAAC,MAAM;IACN;EAAA;EAGF,OAAOd,MAAM;AACf;;AAEA;AACO,SAASe,0BAA0BA,CAAA,EAAS;EACjDpB,WAAW,CAACqB,KAAK,CAAC,CAAC;AACrB","ignoreList":[]}
|
package/dist/cjs/entity/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.fetchEntityListData = exports.enrichEntitiesFromPayload = void 0;
|
|
4
|
+
exports.fetchEntityListData = exports.enrichEntitiesFromPayload = exports.LIST_ITEMS_ENDPOINT = void 0;
|
|
5
5
|
exports.getEntityExtractor = getEntityExtractor;
|
|
6
|
+
exports.listEntityItems = void 0;
|
|
6
7
|
exports.registerEntityExtractor = registerEntityExtractor;
|
|
7
8
|
exports.transformToSolutionEntityData = exports.transformToGenericEntityData = exports.transformToBlogPostEntityData = void 0;
|
|
8
9
|
var _defaultExtractor = require("./defaultExtractor");
|
|
@@ -14,6 +15,9 @@ var _enrichEntitiesFromPayload = require("./enrichEntitiesFromPayload");
|
|
|
14
15
|
exports.enrichEntitiesFromPayload = _enrichEntitiesFromPayload.enrichEntitiesFromPayload;
|
|
15
16
|
var _fetchEntityListData = require("./fetchEntityListData");
|
|
16
17
|
exports.fetchEntityListData = _fetchEntityListData.fetchEntityListData;
|
|
18
|
+
var _listEntityItems = require("./listEntityItems");
|
|
19
|
+
exports.listEntityItems = _listEntityItems.listEntityItems;
|
|
20
|
+
exports.LIST_ITEMS_ENDPOINT = _listEntityItems.LIST_ITEMS_ENDPOINT;
|
|
17
21
|
/**
|
|
18
22
|
* Registry of client-specific entity extractors.
|
|
19
23
|
* Only needed if a client requires custom extraction logic beyond the config-driven default.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_defaultExtractor","require","exports","defaultExtractor","transformToSolutionEntityData","transformToBlogPostEntityData","transformToGenericEntityData","_enrichEntitiesFromPayload","enrichEntitiesFromPayload","_fetchEntityListData","fetchEntityListData","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 {\n fetchEntityListData,\n type FetchEntityListDataOptions,\n} from './fetchEntityListData';\n\nexport type { EntityExtractor } from './types';\n\n/**\n * Registry of client-specific entity extractors.\n * Only needed if a client requires custom extraction logic beyond the config-driven default.\n */\nconst extractorRegistry: Record<string, EntityExtractor> = {};\n\n/**\n * Get the entity extractor for a specific client.\n * The default extractor is config-driven and works for any client with entityConfig.\n */\nexport function getEntityExtractor(clientId?: string): EntityExtractor {\n if (clientId && extractorRegistry[clientId]) {\n return extractorRegistry[clientId];\n }\n return defaultExtractor;\n}\n\n/**\n * Register a custom entity extractor for a client\n * Useful for runtime registration or testing\n */\nexport function registerEntityExtractor(\n clientId: string,\n extractor: EntityExtractor,\n): void {\n extractorRegistry[clientId] = extractor;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_defaultExtractor","require","exports","defaultExtractor","transformToSolutionEntityData","transformToBlogPostEntityData","transformToGenericEntityData","_enrichEntitiesFromPayload","enrichEntitiesFromPayload","_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 {\n fetchEntityListData,\n type FetchEntityListDataOptions,\n} from './fetchEntityListData';\nexport {\n listEntityItems,\n LIST_ITEMS_ENDPOINT,\n type ListEntityItemsOptions,\n} from './listEntityItems';\n\nexport type { EntityExtractor } from './types';\n\n/**\n * Registry of client-specific entity extractors.\n * Only needed if a client requires custom extraction logic beyond the config-driven default.\n */\nconst extractorRegistry: Record<string, EntityExtractor> = {};\n\n/**\n * Get the entity extractor for a specific client.\n * The default extractor is config-driven and works for any client with entityConfig.\n */\nexport function getEntityExtractor(clientId?: string): EntityExtractor {\n if (clientId && extractorRegistry[clientId]) {\n return extractorRegistry[clientId];\n }\n return defaultExtractor;\n}\n\n/**\n * Register a custom entity extractor for a client\n * Useful for runtime registration or testing\n */\nexport function registerEntityExtractor(\n clientId: string,\n extractor: EntityExtractor,\n): void {\n extractorRegistry[clientId] = extractor;\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAAsDC,OAAA,CAAAC,gBAAA,GAAAH,iBAAA,CAAAG,gBAAA;AAAAD,OAAA,CAAAE,6BAAA,GAAAJ,iBAAA,CAAAI,6BAAA;AAAAF,OAAA,CAAAG,6BAAA,GAAAL,iBAAA,CAAAK,6BAAA;AAAAH,OAAA,CAAAI,4BAAA,GAAAN,iBAAA,CAAAM,4BAAA;AAStD,IAAAC,0BAAA,GAAAN,OAAA;AAAwEC,OAAA,CAAAM,yBAAA,GAAAD,0BAAA,CAAAC,yBAAA;AACxE,IAAAC,oBAAA,GAAAR,OAAA;AAG+BC,OAAA,CAAAQ,mBAAA,GAAAD,oBAAA,CAAAC,mBAAA;AAC/B,IAAAC,gBAAA,GAAAV,OAAA;AAI2BC,OAAA,CAAAU,eAAA,GAAAD,gBAAA,CAAAC,eAAA;AAAAV,OAAA,CAAAW,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,OAAOb,kCAAgB;AACzB;;AAEA;AACA;AACA;AACA;AACO,SAASc,uBAAuBA,CACrCD,QAAgB,EAChBE,SAA0B,EACpB;EACNJ,iBAAiB,CAACE,QAAQ,CAAC,GAAGE,SAAS;AACzC","ignoreList":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.LIST_ITEMS_ENDPOINT = void 0;
|
|
5
|
+
exports.listEntityItems = listEntityItems;
|
|
6
|
+
/**
|
|
7
|
+
* Entity resolution via the `list-items` RPC on the ConversationConfiguration
|
|
8
|
+
* service.
|
|
9
|
+
*
|
|
10
|
+
* Entities are resolved through `list-items` (POST `{ ids }`). The response is
|
|
11
|
+
* `{ items: [...] }` where each row is keyed by `doc_id`. We normalize to
|
|
12
|
+
* `ApiPayloadItem` keyed by that id (and alias it onto `id`) so both callers
|
|
13
|
+
* get back the same `Map<id, ApiPayloadItem>` contract.
|
|
14
|
+
*
|
|
15
|
+
* TODO(ambassador): the `@wix/ambassador-enterprise-web-five-v1-configuration`
|
|
16
|
+
* `listItems` builder does NOT yet emit the public URL below — as of 1.0.27 it
|
|
17
|
+
* resolves to the internal `/v1/conversation-configuration/list-items` path,
|
|
18
|
+
* which 405s at the www edge (no public mapping). The gateway mapping was added
|
|
19
|
+
* out-of-band (`/web5/conversation-configuration` → service root), giving the
|
|
20
|
+
* URL below. Once an ambassador version ships with that mapping, replace the
|
|
21
|
+
* hand-built request with the builder + `client.fetchWithAuth`, mirroring
|
|
22
|
+
* `web50-server-ui/src/services/backendConfigService.ts`:
|
|
23
|
+
* const options = listItems({ ids })({ isSSR: false, host: 'www.wixapis.com' });
|
|
24
|
+
* const url = new URL(options.url!, 'https://www.wixapis.com');
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Public URL for the `list-items` RPC on `www.wixapis.com`. The `/web5/conversation-configuration`
|
|
29
|
+
* gateway prefix is prepended to the proto path, hence the repeated segment.
|
|
30
|
+
*/
|
|
31
|
+
const LIST_ITEMS_ENDPOINT = exports.LIST_ITEMS_ENDPOINT = 'https://www.wixapis.com/web5/conversation-configuration/v1/conversation-configuration/list-items';
|
|
32
|
+
|
|
33
|
+
/** Minimal fetch shape accepted by both the placement `fetchImpl` and the main app's `client.fetchWithAuth`. */
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* POSTs `{ ids }` to the `list-items` endpoint and returns a Map of
|
|
37
|
+
* `doc_id → ApiPayloadItem`. Throws on network/HTTP error so callers keep their
|
|
38
|
+
* own diagnostics; on success returns only the rows the BE resolved.
|
|
39
|
+
*/
|
|
40
|
+
async function listEntityItems(ids, opts) {
|
|
41
|
+
const result = new Map();
|
|
42
|
+
if (!ids.length) return result;
|
|
43
|
+
const res = await opts.fetchImpl(LIST_ITEMS_ENDPOINT, {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
headers: {
|
|
46
|
+
'Content-Type': 'application/json'
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
ids
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
if (!res.ok) {
|
|
53
|
+
throw new Error(`list-items ${res.status} ${res.statusText}`);
|
|
54
|
+
}
|
|
55
|
+
const body = await res.json();
|
|
56
|
+
const items = body.items ?? [];
|
|
57
|
+
for (const item of items) {
|
|
58
|
+
const rec = item;
|
|
59
|
+
const id = rec.doc_id;
|
|
60
|
+
if (!id) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const normalized = {
|
|
64
|
+
...rec,
|
|
65
|
+
id
|
|
66
|
+
};
|
|
67
|
+
// Product docs carry the Shopify slug in `handle`; the raw `url` is the
|
|
68
|
+
// absolute canonical storefront URL (https://www.feature.com/products/…).
|
|
69
|
+
// Rebuild a host-relative `/products/<handle>` so the link stays same-origin
|
|
70
|
+
// on whatever host serves the page. `handle` is authoritative here
|
|
71
|
+
// (no origin/`www.`/path-parsing, unlike deriving it from `url`).
|
|
72
|
+
if (rec.doc_domain === 'product' && typeof rec.handle === 'string' && rec.handle) {
|
|
73
|
+
normalized.url = `/products/${rec.handle}`;
|
|
74
|
+
}
|
|
75
|
+
// `list-items` carries the image directly (`thumbnail` / `images[]`), but
|
|
76
|
+
// the shared transform (`transformToGenericEntityData`) reads `img`. Alias
|
|
77
|
+
// the image onto `img` so images resolve from the payload itself — no
|
|
78
|
+
// dependence on the SearchSpring catalog, which may not index every product.
|
|
79
|
+
if (normalized.img == null) {
|
|
80
|
+
if (typeof rec.thumbnail === 'string' && rec.thumbnail) {
|
|
81
|
+
normalized.img = rec.thumbnail;
|
|
82
|
+
} else if (Array.isArray(rec.images) && typeof rec.images[0] === 'string' && rec.images[0]) {
|
|
83
|
+
normalized.img = rec.images[0];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
result.set(id, normalized);
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=listEntityItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LIST_ITEMS_ENDPOINT","exports","listEntityItems","ids","opts","result","Map","length","res","fetchImpl","method","headers","body","JSON","stringify","ok","Error","status","statusText","json","items","item","rec","id","doc_id","normalized","doc_domain","handle","url","img","thumbnail","Array","isArray","images","set"],"sources":["../../../src/entity/listEntityItems.ts"],"sourcesContent":["import type { ApiPayloadItem } from '../types/entity';\n\n/**\n * Entity resolution via the `list-items` RPC on the ConversationConfiguration\n * service.\n *\n * Entities are resolved through `list-items` (POST `{ ids }`). The response is\n * `{ items: [...] }` where each row is keyed by `doc_id`. We normalize to\n * `ApiPayloadItem` keyed by that id (and alias it onto `id`) so both callers\n * get back the same `Map<id, ApiPayloadItem>` contract.\n *\n * TODO(ambassador): the `@wix/ambassador-enterprise-web-five-v1-configuration`\n * `listItems` builder does NOT yet emit the public URL below — as of 1.0.27 it\n * resolves to the internal `/v1/conversation-configuration/list-items` path,\n * which 405s at the www edge (no public mapping). The gateway mapping was added\n * out-of-band (`/web5/conversation-configuration` → service root), giving the\n * URL below. Once an ambassador version ships with that mapping, replace the\n * hand-built request with the builder + `client.fetchWithAuth`, mirroring\n * `web50-server-ui/src/services/backendConfigService.ts`:\n * const options = listItems({ ids })({ isSSR: false, host: 'www.wixapis.com' });\n * const url = new URL(options.url!, 'https://www.wixapis.com');\n */\n\n/**\n * Public URL for the `list-items` RPC on `www.wixapis.com`. The `/web5/conversation-configuration`\n * gateway prefix is prepended to the proto path, hence the repeated segment.\n */\nexport const LIST_ITEMS_ENDPOINT =\n 'https://www.wixapis.com/web5/conversation-configuration/v1/conversation-configuration/list-items';\n\n/** Minimal fetch shape accepted by both the placement `fetchImpl` and the main app's `client.fetchWithAuth`. */\ntype FetchLike = (\n input: string | URL,\n init?: RequestInit,\n) => Promise<Response>;\n\ninterface ListItemsResponse {\n items?: Record<string, unknown>[] | null;\n}\n\nexport interface ListEntityItemsOptions {\n /** Auth-aware fetch (`client.fetchWithAuth` in the main app, the placement's Wix-auth fetch). */\n fetchImpl: FetchLike;\n}\n\n/**\n * POSTs `{ ids }` to the `list-items` endpoint and returns a Map of\n * `doc_id → ApiPayloadItem`. Throws on network/HTTP error so callers keep their\n * own diagnostics; on success returns only the rows the BE resolved.\n */\nexport async function listEntityItems(\n ids: string[],\n opts: ListEntityItemsOptions,\n): Promise<Map<string, ApiPayloadItem>> {\n const result = new Map<string, ApiPayloadItem>();\n if (!ids.length) return result;\n\n const res = await opts.fetchImpl(LIST_ITEMS_ENDPOINT, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ ids }),\n });\n\n if (!res.ok) {\n throw new Error(`list-items ${res.status} ${res.statusText}`);\n }\n\n const body = (await res.json()) as ListItemsResponse;\n const items = body.items ?? [];\n for (const item of items) {\n const rec = item as Record<string, unknown>;\n const id = rec.doc_id as string | undefined;\n if (!id) {\n continue;\n }\n const normalized: Record<string, unknown> = { ...rec, id };\n // Product docs carry the Shopify slug in `handle`; the raw `url` is the\n // absolute canonical storefront URL (https://www.feature.com/products/…).\n // Rebuild a host-relative `/products/<handle>` so the link stays same-origin\n // on whatever host serves the page. `handle` is authoritative here\n // (no origin/`www.`/path-parsing, unlike deriving it from `url`).\n if (\n rec.doc_domain === 'product' &&\n typeof rec.handle === 'string' &&\n rec.handle\n ) {\n normalized.url = `/products/${rec.handle}`;\n }\n // `list-items` carries the image directly (`thumbnail` / `images[]`), but\n // the shared transform (`transformToGenericEntityData`) reads `img`. Alias\n // the image onto `img` so images resolve from the payload itself — no\n // dependence on the SearchSpring catalog, which may not index every product.\n if (normalized.img == null) {\n if (typeof rec.thumbnail === 'string' && rec.thumbnail) {\n normalized.img = rec.thumbnail;\n } else if (\n Array.isArray(rec.images) &&\n typeof rec.images[0] === 'string' &&\n rec.images[0]\n ) {\n normalized.img = rec.images[0];\n }\n }\n result.set(id, normalized as unknown as ApiPayloadItem);\n }\n return result;\n}\n"],"mappings":";;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAC9B,kGAAkG;;AAEpG;;AAeA;AACA;AACA;AACA;AACA;AACO,eAAeE,eAAeA,CACnCC,GAAa,EACbC,IAA4B,EACU;EACtC,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAChD,IAAI,CAACH,GAAG,CAACI,MAAM,EAAE,OAAOF,MAAM;EAE9B,MAAMG,GAAG,GAAG,MAAMJ,IAAI,CAACK,SAAS,CAACT,mBAAmB,EAAE;IACpDU,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MAAE,cAAc,EAAE;IAAmB,CAAC;IAC/CC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;MAAEX;IAAI,CAAC;EAC9B,CAAC,CAAC;EAEF,IAAI,CAACK,GAAG,CAACO,EAAE,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,cAAcR,GAAG,CAACS,MAAM,IAAIT,GAAG,CAACU,UAAU,EAAE,CAAC;EAC/D;EAEA,MAAMN,IAAI,GAAI,MAAMJ,GAAG,CAACW,IAAI,CAAC,CAAuB;EACpD,MAAMC,KAAK,GAAGR,IAAI,CAACQ,KAAK,IAAI,EAAE;EAC9B,KAAK,MAAMC,IAAI,IAAID,KAAK,EAAE;IACxB,MAAME,GAAG,GAAGD,IAA+B;IAC3C,MAAME,EAAE,GAAGD,GAAG,CAACE,MAA4B;IAC3C,IAAI,CAACD,EAAE,EAAE;MACP;IACF;IACA,MAAME,UAAmC,GAAG;MAAE,GAAGH,GAAG;MAAEC;IAAG,CAAC;IAC1D;IACA;IACA;IACA;IACA;IACA,IACED,GAAG,CAACI,UAAU,KAAK,SAAS,IAC5B,OAAOJ,GAAG,CAACK,MAAM,KAAK,QAAQ,IAC9BL,GAAG,CAACK,MAAM,EACV;MACAF,UAAU,CAACG,GAAG,GAAG,aAAaN,GAAG,CAACK,MAAM,EAAE;IAC5C;IACA;IACA;IACA;IACA;IACA,IAAIF,UAAU,CAACI,GAAG,IAAI,IAAI,EAAE;MAC1B,IAAI,OAAOP,GAAG,CAACQ,SAAS,KAAK,QAAQ,IAAIR,GAAG,CAACQ,SAAS,EAAE;QACtDL,UAAU,CAACI,GAAG,GAAGP,GAAG,CAACQ,SAAS;MAChC,CAAC,MAAM,IACLC,KAAK,CAACC,OAAO,CAACV,GAAG,CAACW,MAAM,CAAC,IACzB,OAAOX,GAAG,CAACW,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,IACjCX,GAAG,CAACW,MAAM,CAAC,CAAC,CAAC,EACb;QACAR,UAAU,CAACI,GAAG,GAAGP,GAAG,CAACW,MAAM,CAAC,CAAC,CAAC;MAChC;IACF;IACA5B,MAAM,CAAC6B,GAAG,CAACX,EAAE,EAAEE,UAAuC,CAAC;EACzD;EACA,OAAOpB,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.WEB5_SCOPES = exports.WEB5_SCOPE = exports.WEB5_ROOT_ID = exports.WEB5_ROOT_CLASS = exports.WEB5_GLOBAL_TOKENS = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* The mount-scope contract.
|
|
7
|
+
*
|
|
8
|
+
* Several packages have to agree on where Web5 content begins in a host
|
|
9
|
+
* document:
|
|
10
|
+
*
|
|
11
|
+
* - **web5-core** scopes its own CSS to it (`base-utilities.css` already
|
|
12
|
+
* targets `#root`).
|
|
13
|
+
* - **the client build** compiles every selector against it (`scopeCss` in
|
|
14
|
+
* `web5-core/scripts/scope-css.ts`).
|
|
15
|
+
* - **web50-server-ui** stamps `WEB5_ROOT_CLASS` on the element it mounts
|
|
16
|
+
* into, and renders the debug panel into `.debug-view`.
|
|
17
|
+
* - **embed-placement** mounts the *same* client bundle into
|
|
18
|
+
* `[data-web5-placement]` slots on host pages.
|
|
19
|
+
*
|
|
20
|
+
* One home for the list, so those cannot drift.
|
|
21
|
+
*
|
|
22
|
+
* ## Why it is a list and not just `#root`
|
|
23
|
+
*
|
|
24
|
+
* A placement renders client components **outside** `#root`, on the merchant's
|
|
25
|
+
* own PDP. A stylesheet scoped to `#root` alone leaves every placement — and the
|
|
26
|
+
* debug panel — completely unstyled. `w5-client-circana` and
|
|
27
|
+
* `w5-client-feature-com` each discovered this and each hardcoded their own
|
|
28
|
+
* list; this constant is what replaces both.
|
|
29
|
+
*/
|
|
30
|
+
const WEB5_ROOT_ID = exports.WEB5_ROOT_ID = 'root';
|
|
31
|
+
const WEB5_ROOT_CLASS = exports.WEB5_ROOT_CLASS = 'w5-root';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Every place Web5 content can be mounted.
|
|
35
|
+
*
|
|
36
|
+
* `#root` is the id the host runtime has always created, kept so the compiled
|
|
37
|
+
* stylesheet matches before any script runs. `.w5-root` is stamped at mount and
|
|
38
|
+
* keeps the contract working if the host ever renames the element.
|
|
39
|
+
*/
|
|
40
|
+
const WEB5_SCOPES = exports.WEB5_SCOPES = [`#${WEB5_ROOT_ID}`, `.${WEB5_ROOT_CLASS}`, '[data-web5-placement]', '.debug-view'];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* `:is()` takes the specificity of its most specific argument, so this is worth
|
|
44
|
+
* (1,0,0) whichever branch matches — enough to outrank the (0,1,1) descendant
|
|
45
|
+
* selectors host themes use for rich-text typography.
|
|
46
|
+
*/
|
|
47
|
+
const WEB5_SCOPE = exports.WEB5_SCOPE = `:is(${WEB5_SCOPES.join(',')})`;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Custom properties the **host** sets on `:root` at runtime. Their declarations
|
|
51
|
+
* must stay global: moved into the scope they would shadow the host's value for
|
|
52
|
+
* our own subtree, which is precisely where it is needed.
|
|
53
|
+
*
|
|
54
|
+
* Kept in sync with what `web50-server-ui` and the host offset injectors write.
|
|
55
|
+
*/
|
|
56
|
+
const WEB5_GLOBAL_TOKENS = exports.WEB5_GLOBAL_TOKENS = [/^--web5-host-left-offset$/, /^--web5-host-right-offset$/, /^--web5-window-scroll-top-offset$/];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Per-client overrides for the host adaptation web50-server-ui performs at
|
|
60
|
+
* mount. Shared behaviour, client values — a client package supplies this on
|
|
61
|
+
* `clientConfig.hostFit` and never forks the implementation.
|
|
62
|
+
*/
|
|
63
|
+
//# sourceMappingURL=hostScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WEB5_ROOT_ID","exports","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;AACO,MAAMA,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,MAAM;AAE3B,MAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,SAAS;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,GAAAF,OAAA,CAAAE,WAAA,GAAG,CACzB,IAAIH,YAAY,EAAE,EAClB,IAAIE,eAAe,EAAE,EACrB,uBAAuB,EACvB,aAAa,CACL;;AAEV;AACA;AACA;AACA;AACA;AACO,MAAME,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAG,OAAOD,WAAW,CAACE,IAAI,CAAC,GAAG,CAAC,GAAG;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAqC,GAAAL,OAAA,CAAAK,kBAAA,GAAG,CACnD,2BAA2B,EAC3B,4BAA4B,EAC5B,mCAAmC,CACpC;;AAED;AACA;AACA;AACA;AACA","ignoreList":[]}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.validatePatternWithBlocks = exports.validatePatternSyntax = exports.validatePattern = exports.validateLinkUrl = exports.
|
|
4
|
+
exports.deriveLightColor = exports.deriveDarkGradient = exports.deriveDarkColor = exports.defaultExtractor = exports.decodeLinkText = exports.createWixAuthFetch = exports.createSdkRegistry = exports.createPageSection = exports.createFeatureToggleReader = exports.createErrorMarkdown = exports.convertToBlockElementsWithMapping = exports.convertToBlockElements = exports.computeContentBBox = exports.cn = exports.clearForwardStack = exports.buildProbeUrl = exports.buildPlacementDependencies = exports.buildImageSearchFilter = exports.backgroundFilter = exports.analyzeBackdrop = exports.addToCart = exports.Web5UrlType = 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.UserQueryProvider = exports.UserQuery = exports.UnifiedMarkdownParser = exports.UnifiedLink = exports.TextBlockSectionDefinition = exports.TableRow = exports.TableHeader = exports.TableHead = exports.TableFooter = exports.TableCell = exports.TableCaption = exports.TableBody = exports.Table = 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.OptimizedImage = exports.NextStepsSectionDefinition = exports.MarkdownText = exports.Loader = exports.ListItemsSectionDefinition = exports.LinkType = exports.LIST_ITEMS_ENDPOINT = exports.KpiSectionDefinition = exports.ImageSearchFilterToken = exports.HtmlCommentSectionDefinition = exports.HeroSectionDefinition = exports.HeroEntitySectionDefinition = exports.FeedbackBar = exports.FeatureToggleProvider = exports.FeatureSection9PlusDefinition = exports.FeatureCardsSectionDefinition = exports.FallbackSectionDefinition = exports.ErrorSectionDefinition = exports.EntitySectionDefinition = exports.EXPERIMENT_IDS = exports.ERROR_MARKDOWN = exports.Disclaimer = exports.DiagnosticsCollector = 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.COLLECTION_BY_HANDLE_QUERY = exports.CLIENT_IDS = exports.CALLOUT_KINDS = exports.BottomContainer = exports.BACKEND_ENVIRONMENT_QUERY_PARAM = exports.BACKEND_ENVIRONMENT_KEY = exports.ARTICLE_BY_HANDLE_QUERY = void 0;
|
|
5
|
+
exports.transformShopifyProduct = exports.transformShopifyEntityToItemData = exports.transformShopifyCollection = exports.transformShopifyArticle = exports.transformSSProductToEntityItemData = exports.toRgb = exports.stripMarkdown = exports.startNewChatId = exports.shouldRefreshPrompts = exports.setForwardStack = exports.setChatId = exports.setBackendEnvironment = exports.rgbToHsl = exports.resolveShopifyEntity = exports.resolveShopifyConfig = exports.resolveErrorTemplate = exports.resetChatIdForTests = exports.registerEntityExtractor = exports.readProductBackHandoff = exports.pushToForwardStack = exports.pushPromptSubmit = exports.pushLinkClick = exports.pushExit = exports.pushEvent = exports.pushError = exports.pushEntityFiltered = exports.preprocessMarkdown = exports.popFromForwardStack = exports.parseWeb5Url = exports.parseMarkdownToComponents = exports.parseMarkdownToAst = exports.parseEntityLink = exports.parseAstToMarkdown = exports.normalizeImageUrl = exports.normalizeIconUrls = exports.nodesToParts = exports.mergeSectionsWithStableReferences = exports.matchMarkdown = exports.matchAllSections = 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.isValidLinkUrl = exports.isTrustedBundleHost = exports.isNavigableUrl = exports.isLegacyUrl = exports.isHtmlComment = exports.isEntityLink = exports.hslToRgb = exports.hasImage = exports.hasAnalyticsConsent = exports.getSessionId = exports.getResizedImageUrl = exports.getRefreshPromptsExpiry = exports.getPartsByType = exports.getPartByRole = exports.getOrCreateSessionId = exports.getLinks = exports.getIntentFromMarkdown = exports.getImages = exports.getHeading = exports.getForwardStack = exports.getErrorTypeFromStatus = exports.getEntityExtractor = exports.getContextualImageFilename = exports.getClientBundleOverride = exports.getChatId = exports.getBackendEnvironment = exports.getAllByRole = exports.generateSectionId = exports.generateId = 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.ensureMinLightness = exports.enrichEntitiesFromPayload = exports.enableRefreshPrompts = exports.disableRefreshPrompts = exports.detectLinkType = exports.deriveRole = void 0;
|
|
6
|
+
exports.writeProductBackHandoff = exports.validatePatternWithBlocks = exports.validatePatternSyntax = exports.validatePattern = exports.validateLinkUrl = exports.usesStagingBackend = exports.useWeb5Link = exports.useUserQuery = exports.useResolvedImageSources = exports.useResolveShopifyEntityData = exports.useResolveSearchSpringEntityData = exports.useResolveGenericEntityData = exports.usePlacementPayload = exports.useMarkdownUtils = exports.useFeatureToggles = exports.useFeatureToggle = exports.useEntityTransforms = exports.useDebugImageContext = exports.useConversation = exports.useComponentDependencies = exports.useChips = exports.tryParseComponent = exports.trimTrailingWhitespace = exports.transformToSolutionEntityData = exports.transformToGenericEntityData = exports.transformToBlogPostEntityData = void 0;
|
|
7
7
|
var _clients = require("./clients");
|
|
8
8
|
exports.CLIENT_IDS = _clients.CLIENT_IDS;
|
|
9
9
|
exports.EXPERIMENT_IDS = _clients.EXPERIMENT_IDS;
|
|
@@ -50,7 +50,6 @@ exports.FallbackSectionDefinition = _componentDefinitions.FallbackSectionDefinit
|
|
|
50
50
|
exports.createSdkRegistry = _componentDefinitions.createSdkRegistry;
|
|
51
51
|
var _registry = require("./registry");
|
|
52
52
|
exports.ComponentRegistry = _registry.ComponentRegistry;
|
|
53
|
-
exports.Intent = _registry.Intent;
|
|
54
53
|
var _patternValidator = require("./patternValidator");
|
|
55
54
|
exports.validatePattern = _patternValidator.validatePattern;
|
|
56
55
|
exports.validatePatternSyntax = _patternValidator.validatePatternSyntax;
|
|
@@ -90,6 +89,9 @@ exports.nodesToParts = _match.nodesToParts;
|
|
|
90
89
|
var _ComponentDependenciesContext = require("./context/ComponentDependenciesContext");
|
|
91
90
|
exports.ComponentDependenciesProvider = _ComponentDependenciesContext.ComponentDependenciesProvider;
|
|
92
91
|
exports.useComponentDependencies = _ComponentDependenciesContext.useComponentDependencies;
|
|
92
|
+
var _UserQueryContext = require("./context/UserQueryContext");
|
|
93
|
+
exports.UserQueryProvider = _UserQueryContext.UserQueryProvider;
|
|
94
|
+
exports.useUserQuery = _UserQueryContext.useUserQuery;
|
|
93
95
|
var _ChipsContext = require("./context/ChipsContext");
|
|
94
96
|
exports.ChipsProvider = _ChipsContext.ChipsProvider;
|
|
95
97
|
exports.useChips = _ChipsContext.useChips;
|
|
@@ -97,6 +99,8 @@ var _entity = require("./entity");
|
|
|
97
99
|
exports.defaultExtractor = _entity.defaultExtractor;
|
|
98
100
|
exports.enrichEntitiesFromPayload = _entity.enrichEntitiesFromPayload;
|
|
99
101
|
exports.fetchEntityListData = _entity.fetchEntityListData;
|
|
102
|
+
exports.listEntityItems = _entity.listEntityItems;
|
|
103
|
+
exports.LIST_ITEMS_ENDPOINT = _entity.LIST_ITEMS_ENDPOINT;
|
|
100
104
|
exports.getEntityExtractor = _entity.getEntityExtractor;
|
|
101
105
|
exports.registerEntityExtractor = _entity.registerEntityExtractor;
|
|
102
106
|
exports.transformToSolutionEntityData = _entity.transformToSolutionEntityData;
|
|
@@ -144,6 +148,12 @@ exports.cn = _utils.cn;
|
|
|
144
148
|
var _imageUtils = require("./utils/image-utils");
|
|
145
149
|
exports.normalizeImageUrl = _imageUtils.normalizeImageUrl;
|
|
146
150
|
exports.getResizedImageUrl = _imageUtils.getResizedImageUrl;
|
|
151
|
+
var _imageBackdrop = require("./utils/imageBackdrop");
|
|
152
|
+
exports.analyzeBackdrop = _imageBackdrop.analyzeBackdrop;
|
|
153
|
+
exports.computeContentBBox = _imageBackdrop.computeContentBBox;
|
|
154
|
+
exports.buildProbeUrl = _imageBackdrop.buildProbeUrl;
|
|
155
|
+
exports.loadImagePixels = _imageBackdrop.loadImagePixels;
|
|
156
|
+
exports.loadBackdropAnalysis = _imageBackdrop.loadBackdropAnalysis;
|
|
147
157
|
var _parseUtils = require("./component/componentDefinitions/parse-utils");
|
|
148
158
|
exports.stripMarkdown = _parseUtils.stripMarkdown;
|
|
149
159
|
var _colorUtils = require("./color/colorUtils");
|
|
@@ -177,6 +187,10 @@ exports.pushToForwardStack = _navigationStack.pushToForwardStack;
|
|
|
177
187
|
exports.popFromForwardStack = _navigationStack.popFromForwardStack;
|
|
178
188
|
var _UserQuery = require("./components/ui/UserQuery");
|
|
179
189
|
exports.UserQuery = _UserQuery.UserQuery;
|
|
190
|
+
var _productBackHandoff = require("./utils/productBackHandoff");
|
|
191
|
+
exports.PRODUCT_BACK_SESSION_KEY = _productBackHandoff.PRODUCT_BACK_SESSION_KEY;
|
|
192
|
+
exports.writeProductBackHandoff = _productBackHandoff.writeProductBackHandoff;
|
|
193
|
+
exports.readProductBackHandoff = _productBackHandoff.readProductBackHandoff;
|
|
180
194
|
var _PromptEntryEmptyState = require("./components/ui/PromptEntryEmptyState");
|
|
181
195
|
exports.PromptEntryEmptyState = _PromptEntryEmptyState.PromptEntryEmptyState;
|
|
182
196
|
var _SearchSection = require("./components/ui/SearchSection");
|
|
@@ -260,15 +274,20 @@ exports.findImageInNode = _propsExtractor.findImageInNode;
|
|
|
260
274
|
exports.findImageInChildren = _propsExtractor.findImageInChildren;
|
|
261
275
|
var _diagnosticsCollector = require("./utils/diagnosticsCollector");
|
|
262
276
|
exports.DiagnosticsCollector = _diagnosticsCollector.DiagnosticsCollector;
|
|
263
|
-
var
|
|
264
|
-
exports.
|
|
265
|
-
exports.
|
|
266
|
-
|
|
267
|
-
exports.
|
|
268
|
-
exports.
|
|
269
|
-
exports.
|
|
270
|
-
|
|
271
|
-
exports.
|
|
277
|
+
var _refreshPrompts = require("./utils/refreshPrompts");
|
|
278
|
+
exports.REFRESH_PROMPTS_UNTIL_KEY = _refreshPrompts.REFRESH_PROMPTS_UNTIL_KEY;
|
|
279
|
+
exports.REFRESH_PROMPTS_WINDOW_MS = _refreshPrompts.REFRESH_PROMPTS_WINDOW_MS;
|
|
280
|
+
exports.getRefreshPromptsExpiry = _refreshPrompts.getRefreshPromptsExpiry;
|
|
281
|
+
exports.shouldRefreshPrompts = _refreshPrompts.shouldRefreshPrompts;
|
|
282
|
+
exports.enableRefreshPrompts = _refreshPrompts.enableRefreshPrompts;
|
|
283
|
+
exports.disableRefreshPrompts = _refreshPrompts.disableRefreshPrompts;
|
|
284
|
+
var _backendEnvironment = require("./utils/backendEnvironment");
|
|
285
|
+
exports.BACKEND_ENVIRONMENT_KEY = _backendEnvironment.BACKEND_ENVIRONMENT_KEY;
|
|
286
|
+
exports.BACKEND_ENVIRONMENT_QUERY_PARAM = _backendEnvironment.BACKEND_ENVIRONMENT_QUERY_PARAM;
|
|
287
|
+
exports.DEFAULT_BACKEND_ENVIRONMENT = _backendEnvironment.DEFAULT_BACKEND_ENVIRONMENT;
|
|
288
|
+
exports.getBackendEnvironment = _backendEnvironment.getBackendEnvironment;
|
|
289
|
+
exports.setBackendEnvironment = _backendEnvironment.setBackendEnvironment;
|
|
290
|
+
exports.usesStagingBackend = _backendEnvironment.usesStagingBackend;
|
|
272
291
|
var _wixAuthFetch = require("./client/wixAuthFetch");
|
|
273
292
|
exports.createWixAuthFetch = _wixAuthFetch.createWixAuthFetch;
|
|
274
293
|
var _sessionManager = require("./utils/sessionManager");
|
|
@@ -282,4 +301,10 @@ var _componentParser = require("./component/componentParser");
|
|
|
282
301
|
exports.parseMarkdownToComponents = _componentParser.parseMarkdownToComponents;
|
|
283
302
|
exports.tryParseComponent = _componentParser.tryParseComponent;
|
|
284
303
|
exports.mergeSectionsWithStableReferences = _componentParser.mergeSectionsWithStableReferences;
|
|
304
|
+
var _hostScope = require("./hostScope");
|
|
305
|
+
exports.WEB5_ROOT_ID = _hostScope.WEB5_ROOT_ID;
|
|
306
|
+
exports.WEB5_ROOT_CLASS = _hostScope.WEB5_ROOT_CLASS;
|
|
307
|
+
exports.WEB5_SCOPES = _hostScope.WEB5_SCOPES;
|
|
308
|
+
exports.WEB5_SCOPE = _hostScope.WEB5_SCOPE;
|
|
309
|
+
exports.WEB5_GLOBAL_TOKENS = _hostScope.WEB5_GLOBAL_TOKENS;
|
|
285
310
|
//# sourceMappingURL=index.js.map
|