@epam/ai-dial-chat-hooks 1.2.0-dev.15 → 1.2.0-dev.20

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.
@@ -26,9 +26,16 @@ var o = 700, s = 5, c = (e) => t(e.split("/").filter(Boolean).pop() ?? "file").r
26
26
  })).url,
27
27
  name: a.fileName
28
28
  };
29
- } catch (t) {
30
- if (l(t)) {
29
+ } catch (c) {
30
+ if (l(c)) {
31
31
  if (i.markTaken(a.fileName), o < s) {
32
+ if (t.listFiles) try {
33
+ let e = await t.listFiles({
34
+ bucket: u,
35
+ path: a.path.slice(0, a.path.lastIndexOf("/"))
36
+ });
37
+ for (let t of e.items) i.markTaken(t.name);
38
+ } catch {}
32
39
  a = i.allocate(n);
33
40
  continue;
34
41
  }
@@ -38,10 +45,10 @@ var o = 700, s = 5, c = (e) => t(e.split("/").filter(Boolean).pop() ?? "file").r
38
45
  let e = p.current.splice(0);
39
46
  d?.(e), m.current = null;
40
47
  }, f);
41
- let n = t instanceof Error ? t : /* @__PURE__ */ Error("Network upload failed");
42
- throw n.errorReason = r.Network, n;
48
+ let t = c instanceof Error ? c : /* @__PURE__ */ Error("Network upload failed");
49
+ throw t.errorReason = r.Network, t;
43
50
  }
44
- throw t;
51
+ throw c;
45
52
  }
46
53
  }, [
47
54
  u,
package/conversation.d.ts CHANGED
@@ -728,8 +728,8 @@ export declare const useAttachmentUpload: ({ filesApi, bucket, onNetworkError, d
728
728
 
729
729
  /** Parameters for {@link useAttachmentUpload}. */
730
730
  export declare interface UseAttachmentUploadParams {
731
- /** Already-configured generated-client instance used to upload the file. */
732
- filesApi: Pick<FilesApi, 'uploadFile'>;
731
+ /** Already-configured client; optional listing skips stored names after a conflict. */
732
+ filesApi: Pick<FilesApi, 'uploadFile'> & Partial<Pick<FilesApi, 'listFiles'>>;
733
733
  /** DIAL Core bucket the file is uploaded into. */
734
734
  bucket: string | undefined;
735
735
  /** Called with batched filenames after a burst of network-error upload failures. */
package/file-manager.d.ts CHANGED
@@ -699,7 +699,7 @@ declare interface OoxmlDocxHighlightLocation {
699
699
  text: string;
700
700
  }
701
701
 
702
- /** Supported document formats rendered by the bundled `@silurus/ooxml` runtime. */
702
+ /** Supported document formats rendered by the installed `@silurus/ooxml` runtime. */
703
703
  declare enum OoxmlFileType {
704
704
  Docx = 'docx',
705
705
  Xlsx = 'xlsx',
@@ -880,10 +880,12 @@ export declare const resolveHtmlCanvasContent: (attachment: DisplayAttachment, r
880
880
 
881
881
  /**
882
882
  * Resolves an image canvas content payload from a DisplayAttachment without
883
- * fetching — returns the BFF download URL (or a local/inline blob URL)
884
- * directly so the browser cache can be shared with the conversation view's
885
- * `<img>` element. Error detection is delegated to `<img onError>` in the
886
- * canvas renderer. Returns `null` if no URL source is available.
883
+ * fetching — returns a local blob URL or the BFF download URL directly so the
884
+ * browser cache can be shared with the conversation view's `<img>` element.
885
+ * A local `File` with bytes takes precedence over the DIAL download URL; a
886
+ * 0-byte `File` (the file-manager placeholder) does not. Error detection is
887
+ * delegated to `<img onError>` in the canvas renderer. Returns `null` if no
888
+ * URL source is available.
887
889
  */
888
890
  export declare const resolveImageCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => ImageCanvasContent | null;
889
891
 
@@ -69,14 +69,14 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
69
69
  if (t.url != null && e(t.url)) return E(t.url);
70
70
  if (t.referenceUrl != null && e(t.referenceUrl)) return E(t.referenceUrl);
71
71
  }, O = async (e, t) => {
72
- if ("file" in e) return URL.createObjectURL(e.file);
73
- let n = t.resolveDialUrl(e);
74
- if (n != null) try {
75
- let r = await w(n, D(e) ?? "", t);
76
- return URL.createObjectURL(r);
72
+ let n = "file" in e ? e.file : void 0, r = n != null && n.size === 0, i = n != null && !r ? void 0 : t.resolveDialUrl(e);
73
+ if (n != null && i == null) return URL.createObjectURL(n);
74
+ if (i != null) try {
75
+ let n = await w(i, D(e) ?? "", t);
76
+ return URL.createObjectURL(n);
77
77
  } catch (e) {
78
78
  let t = e.status;
79
- return t == null ? y(n) : v(t, n);
79
+ return t == null ? y(i) : v(t, i);
80
80
  }
81
81
  if (e.previewUrl != null) return e.previewUrl;
82
82
  if (e.data != null) return g(e.data, e.contentType);
@@ -91,12 +91,11 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
91
91
  }
92
92
  if ("file" in e) return e.file.text();
93
93
  }, A = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, j = (e, n) => {
94
- if ("file" in e) return {
94
+ let r = "file" in e ? e.file : void 0, i = r != null && r.size === 0, a = r != null && !i ? void 0 : n.resolveDialUrl(e);
95
+ return r != null && a == null ? {
95
96
  type: t.Image,
96
- url: URL.createObjectURL(e.file)
97
- };
98
- let r = n.resolveDialUrl(e);
99
- return r == null ? e.previewUrl == null ? e.data == null ? null : {
97
+ url: URL.createObjectURL(r)
98
+ } : a == null ? e.previewUrl == null ? e.data == null ? null : {
100
99
  type: t.Image,
101
100
  url: g(e.data, e.contentType)
102
101
  } : {
@@ -104,7 +103,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
104
103
  url: e.previewUrl
105
104
  } : {
106
105
  type: t.Image,
107
- url: r
106
+ url: a
108
107
  };
109
108
  }, M = async (e, n) => {
110
109
  let r = await k(e, n);
package/index.d.ts CHANGED
@@ -2544,7 +2544,7 @@ declare interface OoxmlDocxHighlightLocation {
2544
2544
  text: string;
2545
2545
  }
2546
2546
 
2547
- /** Supported document formats rendered by the bundled `@silurus/ooxml` runtime. */
2547
+ /** Supported document formats rendered by the installed `@silurus/ooxml` runtime. */
2548
2548
  declare enum OoxmlFileType {
2549
2549
  Docx = 'docx',
2550
2550
  Xlsx = 'xlsx',
@@ -2984,10 +2984,12 @@ export declare const resolveHtmlCanvasContent: (attachment: DisplayAttachment, r
2984
2984
 
2985
2985
  /**
2986
2986
  * Resolves an image canvas content payload from a DisplayAttachment without
2987
- * fetching — returns the BFF download URL (or a local/inline blob URL)
2988
- * directly so the browser cache can be shared with the conversation view's
2989
- * `<img>` element. Error detection is delegated to `<img onError>` in the
2990
- * canvas renderer. Returns `null` if no URL source is available.
2987
+ * fetching — returns a local blob URL or the BFF download URL directly so the
2988
+ * browser cache can be shared with the conversation view's `<img>` element.
2989
+ * A local `File` with bytes takes precedence over the DIAL download URL; a
2990
+ * 0-byte `File` (the file-manager placeholder) does not. Error detection is
2991
+ * delegated to `<img onError>` in the canvas renderer. Returns `null` if no
2992
+ * URL source is available.
2991
2993
  */
2992
2994
  export declare const resolveImageCanvasContent: (attachment: DisplayAttachment, resolvers: AttachmentCanvasUrlResolvers) => ImageCanvasContent | null;
2993
2995
 
@@ -3909,8 +3911,8 @@ export declare const useAttachmentUpload: ({ filesApi, bucket, onNetworkError, d
3909
3911
 
3910
3912
  /** Parameters for {@link useAttachmentUpload}. */
3911
3913
  export declare interface UseAttachmentUploadParams {
3912
- /** Already-configured generated-client instance used to upload the file. */
3913
- filesApi: Pick<FilesApi, 'uploadFile'>;
3914
+ /** Already-configured client; optional listing skips stored names after a conflict. */
3915
+ filesApi: Pick<FilesApi, 'uploadFile'> & Partial<Pick<FilesApi, 'listFiles'>>;
3914
3916
  /** DIAL Core bucket the file is uploaded into. */
3915
3917
  bucket: string | undefined;
3916
3918
  /** Called with batched filenames after a burst of network-error upload failures. */
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.15",
4
+ "version": "1.2.0-dev.20",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -96,7 +96,7 @@
96
96
  }
97
97
  },
98
98
  "dependencies": {
99
- "@epam/ai-dial-chat-api-client": "1.2.0-dev.15",
99
+ "@epam/ai-dial-chat-api-client": "1.2.0-dev.20",
100
100
  "dompurify": "3.4.15",
101
101
  "fflate": "^0.8.3",
102
102
  "lru-cache": "^10.4.3",
@@ -105,20 +105,20 @@
105
105
  },
106
106
  "peerDependencies": {
107
107
  "react": "^19.2.8",
108
- "@epam/ai-dial-attachment-canvas": "1.2.0-dev.15",
109
- "@epam/ai-dial-attachment-input": "1.2.0-dev.15",
110
- "@epam/ai-dial-builder-form": "1.2.0-dev.15",
111
- "@epam/ai-dial-catalog": "1.2.0-dev.15",
112
- "@epam/ai-dial-chat-overlay": "1.2.0-dev.15",
113
- "@epam/ai-dial-chat-shared": "1.2.0-dev.15",
114
- "@epam/ai-dial-mcp-apps": "1.2.0-dev.15",
115
- "@epam/ai-dial-publish-panel": "1.2.0-dev.15",
116
- "@epam/ai-dial-quotations": "1.2.0-dev.15",
108
+ "@epam/ai-dial-attachment-canvas": "1.2.0-dev.20",
109
+ "@epam/ai-dial-attachment-input": "1.2.0-dev.20",
110
+ "@epam/ai-dial-builder-form": "1.2.0-dev.20",
111
+ "@epam/ai-dial-catalog": "1.2.0-dev.20",
112
+ "@epam/ai-dial-chat-overlay": "1.2.0-dev.20",
113
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.20",
114
+ "@epam/ai-dial-mcp-apps": "1.2.0-dev.20",
115
+ "@epam/ai-dial-publish-panel": "1.2.0-dev.20",
116
+ "@epam/ai-dial-quotations": "1.2.0-dev.20",
117
117
  "@epam/ai-dial-react-file-manager": "^0.2.0",
118
- "@epam/ai-dial-scheduled-tasks": "1.2.0-dev.15",
119
- "@epam/ai-dial-share": "1.2.0-dev.15",
120
- "@epam/ai-dial-skill-editor": "1.2.0-dev.15",
121
- "@epam/ai-dial-source-panel": "1.2.0-dev.15",
118
+ "@epam/ai-dial-scheduled-tasks": "1.2.0-dev.20",
119
+ "@epam/ai-dial-share": "1.2.0-dev.20",
120
+ "@epam/ai-dial-skill-editor": "1.2.0-dev.20",
121
+ "@epam/ai-dial-source-panel": "1.2.0-dev.20",
122
122
  "@epam/ai-dial-ui-kit": "^0.14.2",
123
123
  "@modelcontextprotocol/sdk": "^1.29.0",
124
124
  "@epam/pdf-highlighter-kit": "^0.0.19",