@epam/ai-dial-chat-hooks 1.2.0-dev.3 → 1.2.0-dev.6
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.
|
@@ -34,9 +34,20 @@ var t = {
|
|
|
34
34
|
e.addHook("afterSanitizeAttributes", (e) => {
|
|
35
35
|
e.tagName === "A" && e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
|
|
36
36
|
});
|
|
37
|
-
var r = (n) => e.sanitize(n, t), i = (t) => e.sanitize(t, n), a = (e) => typeof e == "string" && e.length > 0, o = ({ title: e, description: t }) => a(e) || a(t), s = (e) => o(e) || a(e.html), c = (e) =>
|
|
38
|
-
title: e.title
|
|
39
|
-
description: e.description ?? ""
|
|
40
|
-
|
|
37
|
+
var r = (n) => e.sanitize(n, t), i = (t) => e.sanitize(t, n), a = (e) => typeof e == "string" && e.length > 0, o = ({ title: e, description: t }) => a(e) || a(t), s = (e) => o(e) || a(e.html), c = (e) => e.map((e) => ({
|
|
38
|
+
title: e.title,
|
|
39
|
+
description: e.description ?? "",
|
|
40
|
+
link: e.link ? {
|
|
41
|
+
label: e.link.label,
|
|
42
|
+
href: e.link.href
|
|
43
|
+
} : null
|
|
44
|
+
})), l = (e) => {
|
|
45
|
+
if (!o(e)) return e.html ?? "";
|
|
46
|
+
let t = {
|
|
47
|
+
title: e.title ?? "",
|
|
48
|
+
description: e.description ?? ""
|
|
49
|
+
}, n = e.items ?? [];
|
|
50
|
+
return n.length > 0 && (t.items = c(n)), JSON.stringify(t);
|
|
51
|
+
};
|
|
41
52
|
//#endregion
|
|
42
|
-
export {
|
|
53
|
+
export { l as buildAnnouncementSignature, s as hasAnnouncementContent, o as hasStructuredAnnouncement, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AudioTranscriptionError as e, AudioTranscriptionErrorReason as t } from "./audio-transcription-error.js";
|
|
2
2
|
//#region src/conversation/useTranscribeAudio/transcription-retry.ts
|
|
3
|
-
var n = 2, r =
|
|
3
|
+
var n = 2, r = 6e3, i = (e, t) => (t.throwIfAborted(), new Promise((n, r) => {
|
|
4
4
|
let i = () => {
|
|
5
5
|
clearTimeout(a), r(t.reason);
|
|
6
6
|
}, a = setTimeout(() => {
|
|
@@ -28,9 +28,10 @@ var n = 2, r = 9e4, i = (e, t) => (t.throwIfAborted(), new Promise((n, r) => {
|
|
|
28
28
|
503,
|
|
29
29
|
504
|
|
30
30
|
].includes(u.status)) throw o;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
c
|
|
31
|
+
if ([429, 503].includes(u.status)) throw new e(t.Busy);
|
|
32
|
+
let d = Math.max(1e3, a(u.headers.get("retry-after")) ?? 2e3 * 2 ** l);
|
|
33
|
+
if (l >= n || c + d > r) throw new e(t.Busy);
|
|
34
|
+
c += d, await i(d, s);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
};
|
package/conversation.d.ts
CHANGED
|
@@ -36,6 +36,26 @@ export declare interface AnnouncementContent {
|
|
|
36
36
|
title: string | null;
|
|
37
37
|
description: string | null;
|
|
38
38
|
html: string | null;
|
|
39
|
+
/** Entries of the popover the banner opens. */
|
|
40
|
+
items?: readonly AnnouncementListItem[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** One entry of the announcements popover behind the banner's `+N` pill. */
|
|
44
|
+
export declare interface AnnouncementListItem {
|
|
45
|
+
/** Plain-text heading of the entry. */
|
|
46
|
+
title: string;
|
|
47
|
+
/** Supporting copy of the entry, sanitized before it is rendered. */
|
|
48
|
+
description?: string | null;
|
|
49
|
+
/** Optional call to action shown at the end of the entry. */
|
|
50
|
+
link?: AnnouncementListItemLink | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** A link rendered as the call to action of an announcements-popover entry. */
|
|
54
|
+
export declare interface AnnouncementListItemLink {
|
|
55
|
+
/** Visible text of the call to action. */
|
|
56
|
+
label: string;
|
|
57
|
+
/** Absolute `http`/`https` target the call to action opens. */
|
|
58
|
+
href: string;
|
|
39
59
|
}
|
|
40
60
|
|
|
41
61
|
/** State and controls returned by `useAsyncConfirmDialog`. */
|
|
@@ -95,7 +115,7 @@ export declare enum AudioTranscriptionErrorReason {
|
|
|
95
115
|
Unavailable = "unavailable",
|
|
96
116
|
/** The recording exceeds the caller's configured size limit. */
|
|
97
117
|
TooLarge = "tooLarge",
|
|
98
|
-
/**
|
|
118
|
+
/** Recognition is rate-limited, unavailable, or exhausted short gateway retries. */
|
|
99
119
|
Busy = "busy",
|
|
100
120
|
/** Recognition failed for any other reason. */
|
|
101
121
|
Failed = "failed"
|
|
@@ -107,9 +127,18 @@ export declare enum AudioTranscriptionErrorReason {
|
|
|
107
127
|
* hidden only while the current announcement produces the same signature, so
|
|
108
128
|
* editing any part of it brings the banner back with no version counter.
|
|
109
129
|
*
|
|
130
|
+
* Every piece of content the banner surface renders feeds the signature — the
|
|
131
|
+
* title, the description, and the popover entries behind the pill, which live
|
|
132
|
+
* inside the banner and are hidden along with it. Publishing a new entry in
|
|
133
|
+
* that list therefore invalidates an earlier dismissal on its own, even when
|
|
134
|
+
* the banner line itself is untouched.
|
|
135
|
+
*
|
|
110
136
|
* A legacy-only announcement returns the raw HTML string — byte-identical to
|
|
111
137
|
* what shipped before the structured fields existed — so dismissals recorded
|
|
112
|
-
* by older builds keep working without a storage migration.
|
|
138
|
+
* by older builds keep working without a storage migration. `items` is left
|
|
139
|
+
* out of the payload entirely when the list is empty for the same reason: a
|
|
140
|
+
* deployment that never configured the popover keeps matching the signatures
|
|
141
|
+
* its users already have stored.
|
|
113
142
|
*/
|
|
114
143
|
export declare const buildAnnouncementSignature: (content: AnnouncementContent) => string;
|
|
115
144
|
|
package/index.d.ts
CHANGED
|
@@ -212,6 +212,26 @@ export declare interface AnnouncementContent {
|
|
|
212
212
|
title: string | null;
|
|
213
213
|
description: string | null;
|
|
214
214
|
html: string | null;
|
|
215
|
+
/** Entries of the popover the banner opens. */
|
|
216
|
+
items?: readonly AnnouncementListItem[];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** One entry of the announcements popover behind the banner's `+N` pill. */
|
|
220
|
+
export declare interface AnnouncementListItem {
|
|
221
|
+
/** Plain-text heading of the entry. */
|
|
222
|
+
title: string;
|
|
223
|
+
/** Supporting copy of the entry, sanitized before it is rendered. */
|
|
224
|
+
description?: string | null;
|
|
225
|
+
/** Optional call to action shown at the end of the entry. */
|
|
226
|
+
link?: AnnouncementListItemLink | null;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** A link rendered as the call to action of an announcements-popover entry. */
|
|
230
|
+
export declare interface AnnouncementListItemLink {
|
|
231
|
+
/** Visible text of the call to action. */
|
|
232
|
+
label: string;
|
|
233
|
+
/** Absolute `http`/`https` target the call to action opens. */
|
|
234
|
+
href: string;
|
|
215
235
|
}
|
|
216
236
|
|
|
217
237
|
/** Normalized shape returned by {@link getApiErrorDetails}. */
|
|
@@ -353,7 +373,7 @@ export declare enum AudioTranscriptionErrorReason {
|
|
|
353
373
|
Unavailable = "unavailable",
|
|
354
374
|
/** The recording exceeds the caller's configured size limit. */
|
|
355
375
|
TooLarge = "tooLarge",
|
|
356
|
-
/**
|
|
376
|
+
/** Recognition is rate-limited, unavailable, or exhausted short gateway retries. */
|
|
357
377
|
Busy = "busy",
|
|
358
378
|
/** Recognition failed for any other reason. */
|
|
359
379
|
Failed = "failed"
|
|
@@ -379,9 +399,18 @@ export declare const buildAdditionalLocaleOptions: (additionalLocaleCodes: strin
|
|
|
379
399
|
* hidden only while the current announcement produces the same signature, so
|
|
380
400
|
* editing any part of it brings the banner back with no version counter.
|
|
381
401
|
*
|
|
402
|
+
* Every piece of content the banner surface renders feeds the signature — the
|
|
403
|
+
* title, the description, and the popover entries behind the pill, which live
|
|
404
|
+
* inside the banner and are hidden along with it. Publishing a new entry in
|
|
405
|
+
* that list therefore invalidates an earlier dismissal on its own, even when
|
|
406
|
+
* the banner line itself is untouched.
|
|
407
|
+
*
|
|
382
408
|
* A legacy-only announcement returns the raw HTML string — byte-identical to
|
|
383
409
|
* what shipped before the structured fields existed — so dismissals recorded
|
|
384
|
-
* by older builds keep working without a storage migration.
|
|
410
|
+
* by older builds keep working without a storage migration. `items` is left
|
|
411
|
+
* out of the payload entirely when the list is empty for the same reason: a
|
|
412
|
+
* deployment that never configured the popover keeps matching the signatures
|
|
413
|
+
* its users already have stored.
|
|
385
414
|
*/
|
|
386
415
|
export declare const buildAnnouncementSignature: (content: AnnouncementContent) => string;
|
|
387
416
|
|
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.
|
|
4
|
+
"version": "1.2.0-dev.6",
|
|
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.
|
|
99
|
+
"@epam/ai-dial-chat-api-client": "1.2.0-dev.6",
|
|
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.
|
|
109
|
-
"@epam/ai-dial-attachment-input": "1.2.0-dev.
|
|
110
|
-
"@epam/ai-dial-builder-form": "1.2.0-dev.
|
|
111
|
-
"@epam/ai-dial-catalog": "1.2.0-dev.
|
|
112
|
-
"@epam/ai-dial-chat-overlay": "1.2.0-dev.
|
|
113
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
114
|
-
"@epam/ai-dial-mcp-apps": "1.2.0-dev.
|
|
115
|
-
"@epam/ai-dial-publish-panel": "1.2.0-dev.
|
|
116
|
-
"@epam/ai-dial-quotations": "1.2.0-dev.
|
|
108
|
+
"@epam/ai-dial-attachment-canvas": "1.2.0-dev.6",
|
|
109
|
+
"@epam/ai-dial-attachment-input": "1.2.0-dev.6",
|
|
110
|
+
"@epam/ai-dial-builder-form": "1.2.0-dev.6",
|
|
111
|
+
"@epam/ai-dial-catalog": "1.2.0-dev.6",
|
|
112
|
+
"@epam/ai-dial-chat-overlay": "1.2.0-dev.6",
|
|
113
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.6",
|
|
114
|
+
"@epam/ai-dial-mcp-apps": "1.2.0-dev.6",
|
|
115
|
+
"@epam/ai-dial-publish-panel": "1.2.0-dev.6",
|
|
116
|
+
"@epam/ai-dial-quotations": "1.2.0-dev.6",
|
|
117
117
|
"@epam/ai-dial-react-file-manager": "^0.2.0",
|
|
118
|
-
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.
|
|
119
|
-
"@epam/ai-dial-share": "1.2.0-dev.
|
|
120
|
-
"@epam/ai-dial-skill-editor": "1.2.0-dev.
|
|
121
|
-
"@epam/ai-dial-source-panel": "1.2.0-dev.
|
|
118
|
+
"@epam/ai-dial-scheduled-tasks": "1.2.0-dev.6",
|
|
119
|
+
"@epam/ai-dial-share": "1.2.0-dev.6",
|
|
120
|
+
"@epam/ai-dial-skill-editor": "1.2.0-dev.6",
|
|
121
|
+
"@epam/ai-dial-source-panel": "1.2.0-dev.6",
|
|
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",
|