@epam/ai-dial-chat-hooks 1.2.0-dev.217 → 1.2.0-dev.219

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.
@@ -1,34 +1,53 @@
1
1
  import { safeDecodeURIComponent as e } from "../../shared/string-utils.js";
2
- import { findDeploymentByIdOrReference as t } from "../../catalog/deployment-id.js";
3
- import { getModelIdFromConversationId as n } from "../get-model-id-from-conversation-id.js";
4
- import { FilterTab as r } from "@epam/ai-dial-chat-shared";
5
- import { useMemo as i } from "react";
2
+ import { getModelIdFromConversationId as t } from "../get-model-id-from-conversation-id.js";
3
+ import { FilterTab as n } from "@epam/ai-dial-chat-shared";
4
+ import { useEffect as r, useMemo as i, useRef as a } from "react";
6
5
  //#region src/conversation/useConversationPanelItems/useConversationPanelItems.ts
7
- var a = (e) => e.sharedWithMe ? r.Shared : e.publishedWithMe ? r.Organization : r.MyChats, o = ({ items: r, deployments: o, isDeploymentsLoading: s, toPanelConversationId: c, resolveIconUrl: l, resolveIconTooltip: u, resolveHref: d, resolveTaskPresentation: f }) => i(() => r.map((r) => {
8
- let i = c(r.id), p = n(r.id), m = p ? t(o, p) : void 0, h = p ? e(p.split("/").pop() ?? p) : "", g = f?.(r);
9
- return {
10
- id: i,
11
- title: r.title,
12
- isPinned: r.isPinned ?? !1,
13
- iconUrl: l(m),
14
- iconTooltip: u(m, h),
15
- isIconLoading: s,
16
- source: a(r),
17
- href: d(i),
18
- ...g == null ? {} : {
19
- leadingIcon: g.leadingIcon,
20
- isUnread: g.isUnread
21
- }
22
- };
23
- }), [
24
- r,
25
- o,
26
- s,
27
- c,
28
- l,
29
- u,
30
- d,
31
- f
32
- ]);
6
+ var o = (e) => e.sharedWithMe ? n.Shared : e.publishedWithMe ? n.Organization : n.MyChats, s = (e) => {
7
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
8
+ for (let r of e) t.has(r.id) || t.set(r.id, r), r.reference && !n.has(r.reference) && n.set(r.reference, r);
9
+ return (e) => t.get(e) ?? n.get(e);
10
+ }, c = ({ items: n, deployments: c, isDeploymentsLoading: l, toPanelConversationId: u, resolveIconUrl: d, resolveIconTooltip: f, resolveHref: p, resolveTaskPresentation: m }) => {
11
+ let h = i(() => s(c), [c]), g = i(() => (n) => {
12
+ let r = u(n.id), i = t(n.id), a = i ? h(i) : void 0, s = i ? e(i.split("/").pop() ?? i) : "", c = m?.(n);
13
+ return {
14
+ id: r,
15
+ title: n.title,
16
+ isPinned: n.isPinned ?? !1,
17
+ iconUrl: d(a),
18
+ iconTooltip: f(a, s),
19
+ isIconLoading: l,
20
+ source: o(n),
21
+ href: p(r),
22
+ ...c == null ? {} : {
23
+ leadingIcon: c.leadingIcon,
24
+ isUnread: c.isUnread
25
+ }
26
+ };
27
+ }, [
28
+ h,
29
+ l,
30
+ u,
31
+ d,
32
+ f,
33
+ p,
34
+ m
35
+ ]), _ = a(null), v = i(() => {
36
+ let e = _.current, t = e?.mapItem === g ? e.byDto : void 0, r = /* @__PURE__ */ new Map();
37
+ return {
38
+ mapped: n.map((e) => {
39
+ let n = t?.get(e) ?? g(e);
40
+ return r.set(e, n), n;
41
+ }),
42
+ cache: {
43
+ mapItem: g,
44
+ byDto: r
45
+ }
46
+ };
47
+ }, [n, g]);
48
+ return r(() => {
49
+ _.current = v.cache;
50
+ }, [v]), v.mapped;
51
+ };
33
52
  //#endregion
34
- export { a as getConversationSource, o as useConversationPanelItems };
53
+ export { o as getConversationSource, c as useConversationPanelItems };
package/conversation.d.ts CHANGED
@@ -1072,6 +1072,11 @@ export declare interface UseConversationLookupMapsParams {
1072
1072
  * Returns a memoised array whose shape is compatible with the conversation
1073
1073
  * panel's item contract. All app-specific concerns (icon URL resolution,
1074
1074
  * route generation, id normalisation) are injected via resolver callbacks.
1075
+ *
1076
+ * While every input except `items` is unchanged, a DTO that is referentially
1077
+ * the same as in the previous render maps to the same item object, so a list
1078
+ * change (or a navigation that re-derives the list) re-renders only the rows
1079
+ * whose DTO actually changed.
1075
1080
  */
1076
1081
  export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskPresentation, }: UseConversationPanelItemsParams) => {
1077
1082
  leadingIcon?: ReactNode;
package/index.d.ts CHANGED
@@ -5098,6 +5098,11 @@ export declare interface UseConversationLookupMapsParams {
5098
5098
  * Returns a memoised array whose shape is compatible with the conversation
5099
5099
  * panel's item contract. All app-specific concerns (icon URL resolution,
5100
5100
  * route generation, id normalisation) are injected via resolver callbacks.
5101
+ *
5102
+ * While every input except `items` is unchanged, a DTO that is referentially
5103
+ * the same as in the previous render maps to the same item object, so a list
5104
+ * change (or a navigation that re-derives the list) re-renders only the rows
5105
+ * whose DTO actually changed.
5101
5106
  */
5102
5107
  export declare const useConversationPanelItems: ({ items, deployments, isDeploymentsLoading, toPanelConversationId, resolveIconUrl, resolveIconTooltip, resolveHref, resolveTaskPresentation, }: UseConversationPanelItemsParams) => {
5103
5108
  leadingIcon?: ReactNode;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-chat-hooks",
3
3
  "description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
4
- "version": "1.2.0-dev.217",
4
+ "version": "1.2.0-dev.219",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -111,7 +111,7 @@
111
111
  }
112
112
  },
113
113
  "dependencies": {
114
- "@epam/ai-dial-chat-api-client": "1.2.0-dev.217",
114
+ "@epam/ai-dial-chat-api-client": "1.2.0-dev.219",
115
115
  "dompurify": "3.4.15",
116
116
  "fflate": "^0.8.3",
117
117
  "lru-cache": "^10.4.3",
@@ -120,21 +120,21 @@
120
120
  },
121
121
  "peerDependencies": {
122
122
  "react": "^19.2.8",
123
- "@epam/ai-dial-attachment-canvas": "1.2.0-dev.217",
124
- "@epam/ai-dial-attachment-input": "1.2.0-dev.217",
125
- "@epam/ai-dial-catalog": "1.2.0-dev.217",
126
- "@epam/ai-dial-chat-overlay": "1.2.0-dev.217",
127
- "@epam/ai-dial-chat-shared": "1.2.0-dev.217",
128
- "@epam/ai-dial-mcp-apps": "1.2.0-dev.217",
129
- "@epam/ai-dial-publish-panel": "1.2.0-dev.217",
130
- "@epam/ai-dial-quotations": "1.2.0-dev.217",
123
+ "@epam/ai-dial-attachment-canvas": "1.2.0-dev.219",
124
+ "@epam/ai-dial-attachment-input": "1.2.0-dev.219",
125
+ "@epam/ai-dial-catalog": "1.2.0-dev.219",
126
+ "@epam/ai-dial-chat-overlay": "1.2.0-dev.219",
127
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.219",
128
+ "@epam/ai-dial-mcp-apps": "1.2.0-dev.219",
129
+ "@epam/ai-dial-publish-panel": "1.2.0-dev.219",
130
+ "@epam/ai-dial-quotations": "1.2.0-dev.219",
131
131
  "@epam/ai-dial-react-file-manager": "^0.3.0-dev.19",
132
- "@epam/ai-dial-scheduled-tasks": "1.2.0-dev.217",
133
- "@epam/ai-dial-share": "1.2.0-dev.217",
134
- "@epam/ai-dial-skill-editor": "1.2.0-dev.217",
135
- "@epam/ai-dial-source-panel": "1.2.0-dev.217",
132
+ "@epam/ai-dial-scheduled-tasks": "1.2.0-dev.219",
133
+ "@epam/ai-dial-share": "1.2.0-dev.219",
134
+ "@epam/ai-dial-skill-editor": "1.2.0-dev.219",
135
+ "@epam/ai-dial-source-panel": "1.2.0-dev.219",
136
136
  "@epam/ai-dial-ui-kit": "^0.15.0-dev.27",
137
- "@epam/ai-dial-usage-dashboard": "1.2.0-dev.217",
137
+ "@epam/ai-dial-usage-dashboard": "1.2.0-dev.219",
138
138
  "@modelcontextprotocol/sdk": "^1.29.0",
139
139
  "@epam/pdf-highlighter-kit": "^0.0.19",
140
140
  "@mcp-ui/client": "^7.1.1"