@epam/ai-dial-attachment-canvas 1.3.0-rc.0 → 1.4.0-dev.5

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-attachment-canvas",
3
3
  "description": "Canvas viewer for rendering attachment content — images, PDFs, Office documents, CSV, JSON, markdown, and plain text",
4
- "version": "1.3.0-rc.0",
4
+ "version": "1.4.0-dev.5",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -22,17 +22,17 @@
22
22
  "react-json-view-lite": "^2.5.0",
23
23
  "react-syntax-highlighter": "^16.1.2",
24
24
  "@epam/ai-dial-react-pdf-highlighter": "0.3.1",
25
- "@epam/ai-dial-visualizer-connector": "1.3.0-rc.0",
25
+ "@epam/ai-dial-visualizer-connector": "1.4.0-dev.5",
26
26
  "@epam/pdf-highlighter-kit": "^0.0.21",
27
27
  "@mcp-ui/client": "^7.1.1",
28
28
  "@modelcontextprotocol/sdk": "^1.32.2",
29
29
  "@modelcontextprotocol/ext-apps": "1.7.5",
30
30
  "zod": "^4.6.6",
31
31
  "pdfjs-dist": "^6.5.438",
32
- "@epam/ai-dial-sidebar": "1.3.0-rc.0"
32
+ "@epam/ai-dial-sidebar": "1.4.0-dev.5"
33
33
  },
34
34
  "peerDependencies": {
35
- "@epam/ai-dial-chat-shared": "1.3.0-rc.0",
35
+ "@epam/ai-dial-chat-shared": "1.4.0-dev.5",
36
36
  "@epam/ai-dial-ui-kit": "^0.16.0",
37
37
  "react": "^19.2.8"
38
38
  },
@@ -0,0 +1,7 @@
1
+ /** `UseOpenAttachmentCanvasResolvers` method the open routing calls for a MIME type or file extension. */
2
+ export declare enum OpenResolverName {
3
+ Pdf = "resolvePdfContent",
4
+ Markdown = "resolveMarkdownContent",
5
+ Json = "resolveJsonContent"
6
+ }
7
+ //# sourceMappingURL=open-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-resolver.d.ts","sourceRoot":"","sources":["../../src/types/open-resolver.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,oBAAY,gBAAgB;IAC1B,GAAG,sBAAsB;IACzB,QAAQ,2BAA2B;IACnC,IAAI,uBAAuB;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/utils/download.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAoB3E,kEAAkE;AAClE,eAAO,MAAM,cAAc,GAAI,SAAS,uBAAuB,KAAG,OA8BjE,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,IAAI,CAIhE,CAAC;AAuCF,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,GACpC,SAAS,uBAAuB,EAChC,WAAW,MAAM,KAChB,IA8DF,CAAC"}
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/utils/download.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAmI3E,kEAAkE;AAClE,eAAO,MAAM,cAAc,GAAI,SAAS,uBAAuB,KAAG,OACpB,CAAC;AAE/C,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,IAAI,CAIhE,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,GACpC,SAAS,uBAAuB,EAChC,WAAW,MAAM,KAChB,IAKF,CAAC"}
@@ -1,184 +0,0 @@
1
- import { n as e, r as t, t as n } from "./attachment-canvas-BgwyzrRC.js";
2
- import { MIMEType as r, ensureDownloadFilename as i, mergeClasses as a, triggerAnchorDownload as o, triggerBlobDownload as s } from "@epam/ai-dial-chat-shared";
3
- import { Button as c, LiveRegion as l, Spinner as u } from "@epam/ai-dial-ui-kit";
4
- import { Component as d, Suspense as f, useState as p } from "react";
5
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
6
- //#region src/utils/download.ts
7
- var _ = {
8
- [t.Docx]: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
9
- [t.Xlsx]: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
10
- [t.Pptx]: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
11
- [t.Csv]: r.CSV
12
- }, v = (t) => {
13
- switch (t.type) {
14
- case n.PlainText:
15
- case n.Markdown:
16
- case n.Json:
17
- case n.Image:
18
- case n.Audio:
19
- case n.Pdf:
20
- case n.Ooxml:
21
- case n.Code: return !0;
22
- case n.Html: return t.url != null;
23
- case n.MarkdownTable:
24
- case n.Visualizer:
25
- case n.GroupedVisualizer:
26
- case n.McpApp: return !1;
27
- case n.Unsupported: return t.url != null;
28
- case n.Error: return t.errorType !== e.Forbidden && t.url != null;
29
- }
30
- }, y = async (e) => {
31
- let t = await fetch(e);
32
- if (!t.ok) throw Error(`HTTP ${t.status}`);
33
- return t.blob();
34
- }, b = (e) => {
35
- switch (e.type) {
36
- case n.Image: return {
37
- url: e.url,
38
- mimeType: void 0
39
- };
40
- case n.Audio: return {
41
- url: e.url,
42
- mimeType: e.mimeType
43
- };
44
- case n.Pdf: return {
45
- url: e.url,
46
- mimeType: r.PDF
47
- };
48
- case n.Ooxml: return {
49
- url: e.url,
50
- mimeType: _[e.format]
51
- };
52
- case n.Html: return {
53
- url: e.url,
54
- mimeType: r.HTML
55
- };
56
- case n.Unsupported:
57
- case n.Error: return {
58
- url: e.url,
59
- mimeType: void 0
60
- };
61
- case n.PlainText:
62
- case n.Code: return {
63
- url: void 0,
64
- mimeType: r.Plain
65
- };
66
- case n.Markdown:
67
- case n.MarkdownTable: return {
68
- url: void 0,
69
- mimeType: r.Markdown
70
- };
71
- case n.Json: return {
72
- url: void 0,
73
- mimeType: r.JSON
74
- };
75
- default: return {
76
- url: void 0,
77
- mimeType: void 0
78
- };
79
- }
80
- }, x = (e, t) => {
81
- let { url: a, mimeType: c } = b(e), l = i(t ?? "attachment", a, c);
82
- switch (e.type) {
83
- case n.PlainText:
84
- if (e.text === "") return;
85
- s(new Blob([e.text], { type: r.Plain }), l);
86
- return;
87
- case n.Markdown:
88
- if (e.text === "") return;
89
- s(new Blob([e.text], { type: r.Markdown }), l);
90
- return;
91
- case n.Json:
92
- s(new Blob([JSON.stringify(e.value, null, 2)], { type: r.JSON }), l);
93
- return;
94
- case n.Image:
95
- case n.Audio:
96
- case n.Pdf:
97
- case n.Ooxml:
98
- o(e.url, l);
99
- return;
100
- case n.Code:
101
- if (e.text === "") return;
102
- s(new Blob([e.text], { type: r.Plain }), l);
103
- return;
104
- case n.Html:
105
- if (e.url == null) return;
106
- o(e.url, l);
107
- return;
108
- case n.MarkdownTable:
109
- case n.Visualizer:
110
- case n.McpApp: return;
111
- case n.Unsupported:
112
- if (e.url == null) return;
113
- o(e.url, l);
114
- return;
115
- case n.Error:
116
- if (!v(e) || e.url == null) return;
117
- o(e.url, l);
118
- return;
119
- }
120
- }, S = { errorLabel: "_errorLabel_3lihu_2" }, C = ({ loadingLabel: e, pendingContent: t }) => /* @__PURE__ */ g("div", {
121
- role: "status",
122
- "aria-live": "polite",
123
- className: "flex h-full items-center justify-center",
124
- children: [t ?? /* @__PURE__ */ h("span", {
125
- "aria-hidden": !0,
126
- children: /* @__PURE__ */ h(u, {})
127
- }), /* @__PURE__ */ h("span", {
128
- className: "sr-only",
129
- children: e
130
- })]
131
- }), w = ({ errorLabel: e, retryLabel: t, onRetry: n, errorContent: r, errorLabelClassName: i = "dial-body-text" }) => /* @__PURE__ */ g("div", {
132
- className: "flex h-full flex-col items-center justify-center gap-3 p-4",
133
- children: [r, /* @__PURE__ */ g("div", {
134
- className: "flex flex-col items-center gap-3 text-center",
135
- children: [/* @__PURE__ */ h("p", {
136
- "aria-hidden": !0,
137
- className: a(i, S.errorLabel),
138
- children: e
139
- }), /* @__PURE__ */ h(c, {
140
- label: t,
141
- "aria-label": t,
142
- onClick: n
143
- })]
144
- })]
145
- }), T = class extends d {
146
- state = { hasError: !1 };
147
- static getDerivedStateFromError() {
148
- return { hasError: !0 };
149
- }
150
- componentDidCatch() {
151
- this.props.onError();
152
- }
153
- componentDidUpdate(e) {
154
- e.retryKey !== this.props.retryKey && this.state.hasError && this.setState({ hasError: !1 });
155
- }
156
- render() {
157
- return this.state.hasError ? this.props.errorFallback : this.props.children;
158
- }
159
- }, E = ({ children: e, retryKey: t, onRetry: n, pendingContent: r, errorContent: i, errorLabelClassName: a, labels: { loadingLabel: o = "Loading…", errorLabel: s = "Failed to load content", retryLabel: c = "Retry" } = {} }) => {
160
- let [u, d] = p(null);
161
- return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(l, {
162
- visuallyHidden: !0,
163
- children: u === t ? s : ""
164
- }), /* @__PURE__ */ h(T, {
165
- retryKey: t,
166
- onError: () => d(t),
167
- errorFallback: /* @__PURE__ */ h(w, {
168
- errorLabel: s,
169
- retryLabel: c,
170
- onRetry: n,
171
- errorContent: i,
172
- errorLabelClassName: a
173
- }),
174
- children: /* @__PURE__ */ h(f, {
175
- fallback: /* @__PURE__ */ h(C, {
176
- loadingLabel: o,
177
- pendingContent: r
178
- }),
179
- children: e
180
- })
181
- })] });
182
- };
183
- //#endregion
184
- export { y as a, x as i, w as n, v as o, C as r, E as t };