@wix/web5-core 1.63.9 → 1.63.10

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.
@@ -61,22 +61,36 @@ async function listEntityItems(ids, opts) {
61
61
  continue;
62
62
  }
63
63
  // Rows travel as-is apart from the `doc_id` → `id` alias both callers key
64
- // off. Nothing here rewrites a field the backend owns:
64
+ // off, and the image alias below.
65
65
  //
66
- // - `url` used to be rebuilt as `/products/<handle>` for product rows to
67
- // keep the link same-origin. That threw away the query string, and
68
- // `?variant=…` is exactly how a resolved variant travels. The client
69
- // already strips the origin without losing the query —
70
- // `canonicalizeFeatureProductUrl` (w5-client-feature-com) and
71
- // `toRelativeUrl` (web50-server-ui/src/utils/linkResolver.ts) both
72
- // keep `search` and `hash` — so the rewrite was redundant as well as
73
- // lossy.
74
- // - the image used to be guessed onto `img` from `thumbnail`/`images[0]`.
75
- // The backend sends the field the client reads.
76
- result.set(id, {
66
+ // `url` is deliberately NOT rewritten. It used to be rebuilt as
67
+ // `/products/<handle>` for product rows to keep the link same-origin, which
68
+ // threw away the query string — and `?variant=…` is exactly how a resolved
69
+ // variant travels. The client already strips the origin without losing the
70
+ // query: `canonicalizeFeatureProductUrl` (w5-client-feature-com) and
71
+ // `toRelativeUrl` (web50-server-ui/src/utils/linkResolver.ts) both keep
72
+ // `search` and `hash`.
73
+ const normalized = {
77
74
  ...rec,
78
75
  id
79
- });
76
+ };
77
+ // `list-items` product rows carry the image as `thumbnail` / `images[]`
78
+ // (the Vespa doc shape — see `bo-web5-history`'s `ragDocShared.tsx`), but
79
+ // the shared transform (`transformToGenericEntityData`) reads `img`. Alias
80
+ // it so product cards keep their image.
81
+ //
82
+ // This is a bridge, not a contract: rows that already carry `img` — CMS
83
+ // docs, and any row where retrieval overlaid a matched child's
84
+ // presentation fields server-side — pass through untouched. Drop the
85
+ // alias once `list-items` emits `img` for product rows too.
86
+ if (normalized.img == null) {
87
+ if (typeof rec.thumbnail === 'string' && rec.thumbnail) {
88
+ normalized.img = rec.thumbnail;
89
+ } else if (Array.isArray(rec.images) && typeof rec.images[0] === 'string' && rec.images[0]) {
90
+ normalized.img = rec.images[0];
91
+ }
92
+ }
93
+ result.set(id, normalized);
80
94
  }
81
95
  return result;
82
96
  }
@@ -1 +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","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 // Rows travel as-is apart from the `doc_id` → `id` alias both callers key\n // off. Nothing here rewrites a field the backend owns:\n //\n // - `url` used to be rebuilt as `/products/<handle>` for product rows to\n // keep the link same-origin. That threw away the query string, and\n // `?variant=…` is exactly how a resolved variant travels. The client\n // already strips the origin without losing the query —\n // `canonicalizeFeatureProductUrl` (w5-client-feature-com) and\n // `toRelativeUrl` (web50-server-ui/src/utils/linkResolver.ts) both\n // keep `search` and `hash` — so the rewrite was redundant as well as\n // lossy.\n // - the image used to be guessed onto `img` from `thumbnail`/`images[0]`.\n // The backend sends the field the client reads.\n result.set(id, { ...rec, id } 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;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAlB,MAAM,CAACoB,GAAG,CAACF,EAAE,EAAE;MAAE,GAAGD,GAAG;MAAEC;IAAG,CAA8B,CAAC;EAC7D;EACA,OAAOlB,MAAM;AACf","ignoreList":[]}
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","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 // Rows travel as-is apart from the `doc_id` → `id` alias both callers key\n // off, and the image alias below.\n //\n // `url` is deliberately NOT rewritten. It used to be rebuilt as\n // `/products/<handle>` for product rows to keep the link same-origin, which\n // threw away the query string and `?variant=…` is exactly how a resolved\n // variant travels. The client already strips the origin without losing the\n // query: `canonicalizeFeatureProductUrl` (w5-client-feature-com) and\n // `toRelativeUrl` (web50-server-ui/src/utils/linkResolver.ts) both keep\n // `search` and `hash`.\n const normalized: Record<string, unknown> = { ...rec, id };\n // `list-items` product rows carry the image as `thumbnail` / `images[]`\n // (the Vespa doc shape see `bo-web5-history`'s `ragDocShared.tsx`), but\n // the shared transform (`transformToGenericEntityData`) reads `img`. Alias\n // it so product cards keep their image.\n //\n // This is a bridge, not a contract: rows that already carry `img` CMS\n // docs, and any row where retrieval overlaid a matched child's\n // presentation fields server-side — pass through untouched. Drop the\n // alias once `list-items` emits `img` for product rows too.\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;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAME,UAAmC,GAAG;MAAE,GAAGH,GAAG;MAAEC;IAAG,CAAC;IAC1D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAIE,UAAU,CAACC,GAAG,IAAI,IAAI,EAAE;MAC1B,IAAI,OAAOJ,GAAG,CAACK,SAAS,KAAK,QAAQ,IAAIL,GAAG,CAACK,SAAS,EAAE;QACtDF,UAAU,CAACC,GAAG,GAAGJ,GAAG,CAACK,SAAS;MAChC,CAAC,MAAM,IACLC,KAAK,CAACC,OAAO,CAACP,GAAG,CAACQ,MAAM,CAAC,IACzB,OAAOR,GAAG,CAACQ,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,IACjCR,GAAG,CAACQ,MAAM,CAAC,CAAC,CAAC,EACb;QACAL,UAAU,CAACC,GAAG,GAAGJ,GAAG,CAACQ,MAAM,CAAC,CAAC,CAAC;MAChC;IACF;IACAzB,MAAM,CAAC0B,GAAG,CAACR,EAAE,EAAEE,UAAuC,CAAC;EACzD;EACA,OAAOpB,MAAM;AACf","ignoreList":[]}
@@ -56,22 +56,36 @@ export async function listEntityItems(ids, opts) {
56
56
  continue;
57
57
  }
58
58
  // Rows travel as-is apart from the `doc_id` → `id` alias both callers key
59
- // off. Nothing here rewrites a field the backend owns:
59
+ // off, and the image alias below.
60
60
  //
61
- // - `url` used to be rebuilt as `/products/<handle>` for product rows to
62
- // keep the link same-origin. That threw away the query string, and
63
- // `?variant=…` is exactly how a resolved variant travels. The client
64
- // already strips the origin without losing the query —
65
- // `canonicalizeFeatureProductUrl` (w5-client-feature-com) and
66
- // `toRelativeUrl` (web50-server-ui/src/utils/linkResolver.ts) both
67
- // keep `search` and `hash` — so the rewrite was redundant as well as
68
- // lossy.
69
- // - the image used to be guessed onto `img` from `thumbnail`/`images[0]`.
70
- // The backend sends the field the client reads.
71
- result.set(id, {
61
+ // `url` is deliberately NOT rewritten. It used to be rebuilt as
62
+ // `/products/<handle>` for product rows to keep the link same-origin, which
63
+ // threw away the query string — and `?variant=…` is exactly how a resolved
64
+ // variant travels. The client already strips the origin without losing the
65
+ // query: `canonicalizeFeatureProductUrl` (w5-client-feature-com) and
66
+ // `toRelativeUrl` (web50-server-ui/src/utils/linkResolver.ts) both keep
67
+ // `search` and `hash`.
68
+ const normalized = {
72
69
  ...rec,
73
70
  id
74
- });
71
+ };
72
+ // `list-items` product rows carry the image as `thumbnail` / `images[]`
73
+ // (the Vespa doc shape — see `bo-web5-history`'s `ragDocShared.tsx`), but
74
+ // the shared transform (`transformToGenericEntityData`) reads `img`. Alias
75
+ // it so product cards keep their image.
76
+ //
77
+ // This is a bridge, not a contract: rows that already carry `img` — CMS
78
+ // docs, and any row where retrieval overlaid a matched child's
79
+ // presentation fields server-side — pass through untouched. Drop the
80
+ // alias once `list-items` emits `img` for product rows too.
81
+ if (normalized.img == null) {
82
+ if (typeof rec.thumbnail === 'string' && rec.thumbnail) {
83
+ normalized.img = rec.thumbnail;
84
+ } else if (Array.isArray(rec.images) && typeof rec.images[0] === 'string' && rec.images[0]) {
85
+ normalized.img = rec.images[0];
86
+ }
87
+ }
88
+ result.set(id, normalized);
75
89
  }
76
90
  return result;
77
91
  }
@@ -1 +1 @@
1
- {"version":3,"names":["LIST_ITEMS_ENDPOINT","listEntityItems","ids","opts","result","Map","length","res","fetchImpl","method","headers","body","JSON","stringify","ok","Error","status","statusText","json","items","item","rec","id","doc_id","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 // Rows travel as-is apart from the `doc_id` → `id` alias both callers key\n // off. Nothing here rewrites a field the backend owns:\n //\n // - `url` used to be rebuilt as `/products/<handle>` for product rows to\n // keep the link same-origin. That threw away the query string, and\n // `?variant=…` is exactly how a resolved variant travels. The client\n // already strips the origin without losing the query —\n // `canonicalizeFeatureProductUrl` (w5-client-feature-com) and\n // `toRelativeUrl` (web50-server-ui/src/utils/linkResolver.ts) both\n // keep `search` and `hash` — so the rewrite was redundant as well as\n // lossy.\n // - the image used to be guessed onto `img` from `thumbnail`/`images[0]`.\n // The backend sends the field the client reads.\n result.set(id, { ...rec, id } 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;AACA,OAAO,MAAMA,mBAAmB,GAC9B,kGAAkG;;AAEpG;;AAeA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,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,CAACR,mBAAmB,EAAE;IACpDS,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;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAlB,MAAM,CAACoB,GAAG,CAACF,EAAE,EAAE;MAAE,GAAGD,GAAG;MAAEC;IAAG,CAA8B,CAAC;EAC7D;EACA,OAAOlB,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"names":["LIST_ITEMS_ENDPOINT","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","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 // Rows travel as-is apart from the `doc_id` → `id` alias both callers key\n // off, and the image alias below.\n //\n // `url` is deliberately NOT rewritten. It used to be rebuilt as\n // `/products/<handle>` for product rows to keep the link same-origin, which\n // threw away the query string and `?variant=…` is exactly how a resolved\n // variant travels. The client already strips the origin without losing the\n // query: `canonicalizeFeatureProductUrl` (w5-client-feature-com) and\n // `toRelativeUrl` (web50-server-ui/src/utils/linkResolver.ts) both keep\n // `search` and `hash`.\n const normalized: Record<string, unknown> = { ...rec, id };\n // `list-items` product rows carry the image as `thumbnail` / `images[]`\n // (the Vespa doc shape see `bo-web5-history`'s `ragDocShared.tsx`), but\n // the shared transform (`transformToGenericEntityData`) reads `img`. Alias\n // it so product cards keep their image.\n //\n // This is a bridge, not a contract: rows that already carry `img` CMS\n // docs, and any row where retrieval overlaid a matched child's\n // presentation fields server-side — pass through untouched. Drop the\n // alias once `list-items` emits `img` for product rows too.\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;AACA,OAAO,MAAMA,mBAAmB,GAC9B,kGAAkG;;AAEpG;;AAeA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,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,CAACR,mBAAmB,EAAE;IACpDS,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;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAME,UAAmC,GAAG;MAAE,GAAGH,GAAG;MAAEC;IAAG,CAAC;IAC1D;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAIE,UAAU,CAACC,GAAG,IAAI,IAAI,EAAE;MAC1B,IAAI,OAAOJ,GAAG,CAACK,SAAS,KAAK,QAAQ,IAAIL,GAAG,CAACK,SAAS,EAAE;QACtDF,UAAU,CAACC,GAAG,GAAGJ,GAAG,CAACK,SAAS;MAChC,CAAC,MAAM,IACLC,KAAK,CAACC,OAAO,CAACP,GAAG,CAACQ,MAAM,CAAC,IACzB,OAAOR,GAAG,CAACQ,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,IACjCR,GAAG,CAACQ,MAAM,CAAC,CAAC,CAAC,EACb;QACAL,UAAU,CAACC,GAAG,GAAGJ,GAAG,CAACQ,MAAM,CAAC,CAAC,CAAC;MAChC;IACF;IACAzB,MAAM,CAAC0B,GAAG,CAACR,EAAE,EAAEE,UAAuC,CAAC;EACzD;EACA,OAAOpB,MAAM;AACf","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"listEntityItems.d.ts","sourceRoot":"","sources":["../../../src/entity/listEntityItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qGACoE,CAAC;AAErG,gHAAgH;AAChH,KAAK,SAAS,GAAG,CACf,KAAK,EAAE,MAAM,GAAG,GAAG,EACnB,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAMvB,MAAM,WAAW,sBAAsB;IACrC,iGAAiG;IACjG,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EAAE,EACb,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAsCtC"}
1
+ {"version":3,"file":"listEntityItems.d.ts","sourceRoot":"","sources":["../../../src/entity/listEntityItems.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qGACoE,CAAC;AAErG,gHAAgH;AAChH,KAAK,SAAS,GAAG,CACf,KAAK,EAAE,MAAM,GAAG,GAAG,EACnB,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAMvB,MAAM,WAAW,sBAAsB;IACrC,iGAAiG;IACjG,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EAAE,EACb,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAwDtC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wix/web5-core",
3
3
  "license": "MIT",
4
- "version": "1.63.9",
4
+ "version": "1.63.10",
5
5
  "author": {
6
6
  "name": "tsachis",
7
7
  "email": "tsachis@wix.com"
@@ -100,5 +100,5 @@
100
100
  "wallaby": {
101
101
  "autoDetect": true
102
102
  },
103
- "falconPackageHash": "d68ab33ccf14a4366b3a6537d66328384ca8f04c0f3247026e4b49ea"
103
+ "falconPackageHash": "d9dd1b56c171b4b116a3d20f3b7660d0b1bde20209b5f8aee940f2e1"
104
104
  }