@epam/ai-dial-chat-hooks 1.4.0-dev.12 → 1.4.0-dev.34

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/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.4.0-dev.12",
4
+ "version": "1.4.0-dev.34",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -131,7 +131,7 @@
131
131
  }
132
132
  },
133
133
  "dependencies": {
134
- "@epam/ai-dial-chat-api-client": "1.4.0-dev.12",
134
+ "@epam/ai-dial-chat-api-client": "1.4.0-dev.34",
135
135
  "dompurify": "3.4.17",
136
136
  "fflate": "^0.8.3",
137
137
  "lru-cache": "^10.4.3",
@@ -140,25 +140,25 @@
140
140
  },
141
141
  "peerDependencies": {
142
142
  "react": "^19.2.8",
143
- "@epam/ai-dial-attachment-canvas": "1.4.0-dev.12",
144
- "@epam/ai-dial-attachment-input": "1.4.0-dev.12",
145
- "@epam/ai-dial-catalog": "1.4.0-dev.12",
146
- "@epam/ai-dial-chat-overlay": "1.4.0-dev.12",
147
- "@epam/ai-dial-chat-shared": "1.4.0-dev.12",
148
- "@epam/ai-dial-conversation-input": "1.4.0-dev.12",
149
- "@epam/ai-dial-mcp-apps": "1.4.0-dev.12",
150
- "@epam/ai-dial-projects": "1.4.0-dev.12",
151
- "@epam/ai-dial-publish-panel": "1.4.0-dev.12",
152
- "@epam/ai-dial-quotations": "1.4.0-dev.12",
143
+ "@epam/ai-dial-attachment-canvas": "1.4.0-dev.34",
144
+ "@epam/ai-dial-attachment-input": "1.4.0-dev.34",
145
+ "@epam/ai-dial-catalog": "1.4.0-dev.34",
146
+ "@epam/ai-dial-chat-overlay": "1.4.0-dev.34",
147
+ "@epam/ai-dial-chat-shared": "1.4.0-dev.34",
148
+ "@epam/ai-dial-conversation-input": "1.4.0-dev.34",
149
+ "@epam/ai-dial-mcp-apps": "1.4.0-dev.34",
150
+ "@epam/ai-dial-projects": "1.4.0-dev.34",
151
+ "@epam/ai-dial-publish-panel": "1.4.0-dev.34",
152
+ "@epam/ai-dial-quotations": "1.4.0-dev.34",
153
153
  "@epam/ai-dial-react-file-manager": "^0.4.1",
154
- "@epam/ai-dial-scheduled-tasks": "1.4.0-dev.12",
155
- "@epam/ai-dial-share": "1.4.0-dev.12",
156
- "@epam/ai-dial-skill-editor": "1.4.0-dev.12",
157
- "@epam/ai-dial-source-panel": "1.4.0-dev.12",
154
+ "@epam/ai-dial-scheduled-tasks": "1.4.0-dev.34",
155
+ "@epam/ai-dial-share": "1.4.0-dev.34",
156
+ "@epam/ai-dial-skill-editor": "1.4.0-dev.34",
157
+ "@epam/ai-dial-source-panel": "1.4.0-dev.34",
158
158
  "@epam/ai-dial-ui-kit": "^0.16.0",
159
- "@epam/ai-dial-usage-dashboard": "1.4.0-dev.12",
159
+ "@epam/ai-dial-usage-dashboard": "1.4.0-dev.34",
160
160
  "@modelcontextprotocol/sdk": "^1.32.2",
161
- "@epam/pdf-highlighter-kit": "^0.0.21"
161
+ "@epam/pdf-highlighter-kit": "^0.0.22"
162
162
  },
163
163
  "peerDependenciesMeta": {
164
164
  "@epam/ai-dial-attachment-canvas": {
@@ -0,0 +1,21 @@
1
+ import { ProjectDetailsDto } from '@epam/ai-dial-chat-api-client';
2
+ /** Whether a project was shared with the caller, so they may drop it from their list but not delete it. */
3
+ export declare const isProjectSharedWithMe: (project: Pick<ProjectDetailsDto, "source" | "canManage"> | null | undefined) => boolean;
4
+ /** An action of a pinned project's sidebar menu; the values are the menu item keys. */
5
+ export declare enum PinnedProjectMenuAction {
6
+ /** Removes the project from the pins. */
7
+ Unpin = "unpin",
8
+ /** Opens the edit page. */
9
+ Edit = "edit",
10
+ /** Opens the publish panel. */
11
+ Publish = "publish",
12
+ /** Opens the share popover. */
13
+ Share = "share",
14
+ /** Opens the delete confirmation. */
15
+ Delete = "delete",
16
+ /** Opens the confirmation that drops a shared project from the caller's list. */
17
+ RemoveFromMyList = "removeFromMyList"
18
+ }
19
+ /** Returns the actions a pinned project's menu offers the caller, in display order; the host maps each to its label, icon and handler. */
20
+ export declare const getPinnedProjectMenuActions: (project: Pick<ProjectDetailsDto, "source" | "canEdit" | "canManage"> | null | undefined) => PinnedProjectMenuAction[];
21
+ //# sourceMappingURL=project-sharing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-sharing.d.ts","sourceRoot":"","sources":["../../src/project/project-sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,+BAA+B,CAAC;AAEvC,2GAA2G;AAC3G,eAAO,MAAM,qBAAqB,GAChC,SAAS,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,WAAW,CAAC,GAAG,IAAI,GAAG,SAAS,KAC1E,OAGiB,CAAC;AAErB,uFAAuF;AACvF,oBAAY,uBAAuB;IACjC,yCAAyC;IACzC,KAAK,UAAU;IACf,2BAA2B;IAC3B,IAAI,SAAS;IACb,+BAA+B;IAC/B,OAAO,YAAY;IACnB,+BAA+B;IAC/B,KAAK,UAAU;IACf,qCAAqC;IACrC,MAAM,WAAW;IACjB,iFAAiF;IACjF,gBAAgB,qBAAqB;CACtC;AAED,0IAA0I;AAC1I,eAAO,MAAM,2BAA2B,GACtC,SACI,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC,GAC3D,IAAI,GACJ,SAAS,KACZ,uBAAuB,EAwBzB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ProjectSource as e } from "@epam/ai-dial-chat-api-client";
2
+ //#region src/project/project-sharing.ts
3
+ var t = (t) => t != null && t.source === e.Shared && !t.canManage, n = /* @__PURE__ */ function(e) {
4
+ return e.Unpin = "unpin", e.Edit = "edit", e.Publish = "publish", e.Share = "share", e.Delete = "delete", e.RemoveFromMyList = "removeFromMyList", e;
5
+ }({}), r = (e) => {
6
+ if (e == null) return ["unpin"];
7
+ let n = t(e) ? ["removeFromMyList"] : [];
8
+ return e.canEdit ? e.canManage ? [
9
+ "unpin",
10
+ "edit",
11
+ "publish",
12
+ "share",
13
+ "delete"
14
+ ] : [
15
+ "unpin",
16
+ "edit",
17
+ ...n
18
+ ] : ["unpin", ...n];
19
+ };
20
+ //#endregion
21
+ export { n as PinnedProjectMenuAction, r as getPinnedProjectMenuActions, t as isProjectSharedWithMe };
@@ -1 +1 @@
1
- {"version":3,"file":"use-project-conversations.d.ts","sourceRoot":"","sources":["../../src/project/use-project-conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAG1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AA8E/D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,IAAI,CACV,iBAAiB,EACf,0BAA0B,GAC1B,8BAA8B,GAC9B,2BAA2B,GAC3B,kCAAkC,GAClC,2BAA2B,GAC3B,+BAA+B,CAClC,EACD,WAAW,MAAM,GAAG,IAAI;;;;IAqOtB,8CAA8C;;IAE9C,2DAA2D;;;;iBAlDhD,MAAM,YAAY,MAAM;wBAaxB,MAAM;iBAQN,MAAM;;qBA1CZ,MAAM;CAiFd,CAAC"}
1
+ {"version":3,"file":"use-project-conversations.d.ts","sourceRoot":"","sources":["../../src/project/use-project-conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAG1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AA8E/D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,IAAI,CACV,iBAAiB,EACf,0BAA0B,GAC1B,8BAA8B,GAC9B,2BAA2B,GAC3B,kCAAkC,GAClC,2BAA2B,GAC3B,+BAA+B,CAClC,EACD,WAAW,MAAM,GAAG,IAAI;;;;IA4OtB,8CAA8C;;IAE9C,2DAA2D;;;;iBAzDhD,MAAM,YAAY,MAAM;wBAoBxB,MAAM;iBAQN,MAAM;;qBAjDZ,MAAM;CAwFd,CAAC"}
@@ -167,8 +167,8 @@ var o = 20, s = 100, c = {
167
167
  title: r,
168
168
  isTitlePending: !1
169
169
  } : e)
170
- }));
171
- }, [e]), M = t(async (t) => {
170
+ })), k();
171
+ }, [e, k]), M = t(async (t) => {
172
172
  let { name: n } = await e.generateProjectConversationTitle(t);
173
173
  return n;
174
174
  }, [e]), N = t(async (t) => {
@@ -0,0 +1,30 @@
1
+ import { ProjectDetailsDto } from '@epam/ai-dial-chat-api-client';
2
+ /** Host behaviour the removal delegates to. */
3
+ export interface ProjectRemoveFromListHandlers {
4
+ /** Discards the caller's own access to the project; rejects on failure. */
5
+ discardShared: (projectId: string) => Promise<unknown>;
6
+ /** Persists the pin state; rejects on failure. */
7
+ setPinned: (projectId: string, isPinned: boolean) => Promise<void>;
8
+ /** Called when the unpin could not be saved, so the host can mirror it locally and the entry still leaves the sidebar. */
9
+ onUnpinFailed?: (project: ProjectDetailsDto) => void;
10
+ /** Called after the project left the caller's list; the host notifies and navigates away. */
11
+ onRemoved: (project: ProjectDetailsDto) => void;
12
+ /** Called when the discard failed, with the request's trace id; the host shows the message. */
13
+ onError: (project: ProjectDetailsDto, requestId?: string) => void;
14
+ /** Called once the request settles, whether it succeeded or failed, so the host can close its confirmation. */
15
+ onSettled?: () => void;
16
+ }
17
+ /**
18
+ * Drops a project shared with the caller from their own list: discards only
19
+ * the caller's access, then unpins it. The owner's project and the other
20
+ * recipients' access are untouched. Messages, notifications and navigation
21
+ * stay with the host through `handlers`.
22
+ *
23
+ * @param project - The project to remove, or `null` while none is chosen.
24
+ * @param handlers - Host behaviour the removal delegates to.
25
+ */
26
+ export declare const useProjectRemoveFromList: (project: ProjectDetailsDto | null, { discardShared, setPinned, onUnpinFailed, onRemoved, onError, onSettled, }: ProjectRemoveFromListHandlers) => {
27
+ isRemoving: boolean;
28
+ confirmRemove: () => Promise<void>;
29
+ };
30
+ //# sourceMappingURL=use-project-remove-from-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-project-remove-from-list.d.ts","sourceRoot":"","sources":["../../src/project/use-project-remove-from-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,+CAA+C;AAC/C,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,kDAAkD;IAClD,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,0HAA0H;IAC1H,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACrD,6FAA6F;IAC7F,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAChD,+FAA+F;IAC/F,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,+GAA+G;IAC/G,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,iBAAiB,GAAG,IAAI,EACjC,6EAOG,6BAA6B;;;CA0CjC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { getApiErrorDetails as e } from "../api-error/api-error.js";
2
+ import { useCallback as t, useRef as n, useState as r } from "react";
3
+ //#region src/project/use-project-remove-from-list.ts
4
+ var i = (i, { discardShared: a, setPinned: o, onUnpinFailed: s, onRemoved: c, onError: l, onSettled: u }) => {
5
+ let [d, f] = r(!1), p = n(!1);
6
+ return {
7
+ isRemoving: d,
8
+ confirmRemove: t(async () => {
9
+ if (i == null || p.current) return;
10
+ p.current = !0, f(!0);
11
+ let t = () => {
12
+ p.current = !1, f(!1), u?.();
13
+ };
14
+ try {
15
+ await a(i.id);
16
+ } catch (n) {
17
+ let { traceId: r } = await e(n);
18
+ l(i, r), t();
19
+ return;
20
+ }
21
+ try {
22
+ await o(i.id, !1);
23
+ } catch {
24
+ s?.(i);
25
+ }
26
+ t(), c(i);
27
+ }, [
28
+ i,
29
+ a,
30
+ o,
31
+ s,
32
+ c,
33
+ l,
34
+ u
35
+ ])
36
+ };
37
+ };
38
+ //#endregion
39
+ export { i as useProjectRemoveFromList };
@@ -23,5 +23,6 @@ export declare const useProjects: (client: Pick<ProjectsApiClient, "listProjects
23
23
  isLoading: boolean;
24
24
  hasError: boolean;
25
25
  retry: () => void;
26
+ refresh: () => Promise<void>;
26
27
  };
27
28
  //# sourceMappingURL=use-projects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-projects.d.ts","sourceRoot":"","sources":["../../src/project/use-projects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAoC/D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,IAAI,CAAC,iBAAiB,EAAE,cAAc,GAAG,eAAe,CAAC,EACjE,SAAS,OAAO;;;;;;CAmGjB,CAAC"}
1
+ {"version":3,"file":"use-projects.d.ts","sourceRoot":"","sources":["../../src/project/use-projects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAoC/D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,IAAI,CAAC,iBAAiB,EAAE,cAAc,GAAG,eAAe,CAAC,EACjE,SAAS,OAAO;;;;;;;CAoGjB,CAAC"}
@@ -85,7 +85,8 @@ var c = 1e3, l = "\n", u = ({ items: n, incompleteSources: r }, i) => {
85
85
  incompleteSources: _?.incompleteSources ?? [],
86
86
  isLoading: t && _ == null,
87
87
  hasError: _?.hasError ?? !1,
88
- retry: b
88
+ retry: b,
89
+ refresh: g
89
90
  };
90
91
  };
91
92
  //#endregion
package/project.js CHANGED
@@ -16,5 +16,7 @@ import { useProjectConversations as z } from "./project/use-project-conversation
16
16
  import { PINNED_PROJECT_CHATS_LIMIT as B, usePinnedProjectChats as V } from "./project/use-pinned-project-chats.js";
17
17
  import { useProjectArtifacts as H } from "./project/use-project-artifacts.js";
18
18
  import { ProjectActionError as U, useProjectActions as W } from "./project/use-project-actions.js";
19
- import { createSerializedKeyedWriter as G } from "./shared/serialized-writer.js";
20
- export { l as DEFAULT_PROJECT_CONTEXT_ALLOWED_EXTENSIONS, u as DEFAULT_PROJECT_CONTEXT_FILE_MAX_BYTES, d as DEFAULT_PROJECT_CONTEXT_TOTAL_MAX_BYTES, B as PINNED_PROJECT_CHATS_LIMIT, U as ProjectActionError, k as ProjectChatCreateFailure, D as ProjectDraftMode, h as ProjectFormErrorField, g as ProjectFormErrorReason, P as ProjectRefreshOutcome, e as buildCreateConversationDto, A as classifyProjectChatCreateError, j as createProjectChat, M as createProjectConversationDataSource, t as createProjectsApiClient, G as createSerializedKeyedWriter, v as downloadProjectFileAttachment, y as fromProjectOutputCardId, b as fromProjectPreviewKey, f as getMimeTypesForExtensions, _ as getProjectFormError, r as mapProjectArtifactsToOutputs, i as mapProjectDetailsToViewModel, a as mapProjectDtoToItem, o as mapProjectSource, s as mapProjectSourceToFilterTab, c as mapStoredContextFiles, p as resolveByteLimit, m as resolveExtensionList, n as splitProjectConversationId, x as toProjectContextFileAttachment, S as toProjectOutputAttachment, C as toProjectOutputCardId, w as toProjectPreviewKey, T as toStoredProjectFileAttachment, L as useCreateProject, V as usePinnedProjectChats, F as useProject, W as useProjectActions, H as useProjectArtifacts, z as useProjectConversations, O as useProjectDraft, E as useProjectFilePreview, I as useProjectWatch, N as useProjects, R as useSaveProject };
19
+ import { PinnedProjectMenuAction as G, getPinnedProjectMenuActions as K, isProjectSharedWithMe as q } from "./project/project-sharing.js";
20
+ import { useProjectRemoveFromList as J } from "./project/use-project-remove-from-list.js";
21
+ import { createSerializedKeyedWriter as Y } from "./shared/serialized-writer.js";
22
+ export { l as DEFAULT_PROJECT_CONTEXT_ALLOWED_EXTENSIONS, u as DEFAULT_PROJECT_CONTEXT_FILE_MAX_BYTES, d as DEFAULT_PROJECT_CONTEXT_TOTAL_MAX_BYTES, B as PINNED_PROJECT_CHATS_LIMIT, G as PinnedProjectMenuAction, U as ProjectActionError, k as ProjectChatCreateFailure, D as ProjectDraftMode, h as ProjectFormErrorField, g as ProjectFormErrorReason, P as ProjectRefreshOutcome, e as buildCreateConversationDto, A as classifyProjectChatCreateError, j as createProjectChat, M as createProjectConversationDataSource, t as createProjectsApiClient, Y as createSerializedKeyedWriter, v as downloadProjectFileAttachment, y as fromProjectOutputCardId, b as fromProjectPreviewKey, f as getMimeTypesForExtensions, K as getPinnedProjectMenuActions, _ as getProjectFormError, q as isProjectSharedWithMe, r as mapProjectArtifactsToOutputs, i as mapProjectDetailsToViewModel, a as mapProjectDtoToItem, o as mapProjectSource, s as mapProjectSourceToFilterTab, c as mapStoredContextFiles, p as resolveByteLimit, m as resolveExtensionList, n as splitProjectConversationId, x as toProjectContextFileAttachment, S as toProjectOutputAttachment, C as toProjectOutputCardId, w as toProjectPreviewKey, T as toStoredProjectFileAttachment, L as useCreateProject, V as usePinnedProjectChats, F as useProject, W as useProjectActions, H as useProjectArtifacts, z as useProjectConversations, O as useProjectDraft, E as useProjectFilePreview, J as useProjectRemoveFromList, I as useProjectWatch, N as useProjects, R as useSaveProject };