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

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.
Files changed (89) hide show
  1. package/api-error/api-error.js +5 -4
  2. package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
  3. package/attachments.d.ts +10 -4
  4. package/catalog/catalog-derivations.js +1 -1
  5. package/catalog/deployment-id.js +8 -2
  6. package/catalog/map-deployment-limits-to-input.js +81 -9
  7. package/catalog/map-deployment-to-catalog-item.js +34 -34
  8. package/catalog/map-entity-details-to-catalog.js +7 -0
  9. package/catalog/map-skill-to-catalog-item.js +30 -27
  10. package/catalog/publish.js +6 -5
  11. package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
  12. package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
  13. package/catalog/useSkillItemDetails.js +17 -13
  14. package/catalog.d.ts +116 -20
  15. package/catalog.js +23 -22
  16. package/conversation/conversation-transfer/export-conversation.js +24 -16
  17. package/conversation/conversation-transfer/import-conversation.js +80 -31
  18. package/conversation/conversation-transfer/queue.js +8 -5
  19. package/conversation/create-chat-stream-api.js +85 -49
  20. package/conversation/message-utils.js +44 -2
  21. package/conversation/stage.js +23 -0
  22. package/conversation/useConversationExport/useConversationExport.js +9 -9
  23. package/conversation/useConversationHandlers/useConversationHandlers.js +16 -5
  24. package/conversation/useConversationImport/useConversationImport.js +123 -121
  25. package/conversation/useConversationPanelItems/useConversationPanelItems.js +2 -3
  26. package/conversation/useConversationScroll/useConversationScroll.js +68 -64
  27. package/conversation/useConversationStream/apply-chunk.js +1 -1
  28. package/conversation/useConversationStream/generation-resume.js +104 -63
  29. package/conversation/useConversationStream/useConversationStream.js +183 -108
  30. package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
  31. package/conversation-overlay.d.ts +7 -0
  32. package/conversation-overlay.js +2 -0
  33. package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
  34. package/conversation-sources.d.ts +1 -1
  35. package/conversation-transfer.d.ts +2 -1
  36. package/conversation.d.ts +241 -13
  37. package/conversation.js +32 -30
  38. package/file-manager-canvas.d.ts +398 -0
  39. package/file-manager-canvas.js +2 -0
  40. package/file-manager.d.ts +153 -350
  41. package/file-manager.js +25 -24
  42. package/files/attachment-canvas.js +40 -1
  43. package/files/attachment-types.js +14 -13
  44. package/files/dial-file-manager-mapping.util.js +2 -1
  45. package/files/dial-file-manager-path.util.js +23 -1
  46. package/files/dial-file-manager.model.js +23 -19
  47. package/files/dial-file-manager.types.js +3 -3
  48. package/files/useDialFileListing/useDialFileListing.js +157 -145
  49. package/files/useDialFileManager/useDialFileManager.js +132 -128
  50. package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
  51. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -19
  52. package/files/useDialFileMutations/useDialFileMutations.js +33 -32
  53. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
  54. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
  55. package/index.d.ts +1068 -81
  56. package/index.js +136 -122
  57. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
  58. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
  59. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
  60. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
  61. package/mcp-apps.d.ts +8 -6
  62. package/oauth/toolset-id.js +5 -3
  63. package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
  64. package/oauth.d.ts +32 -0
  65. package/oauth.js +9 -9
  66. package/package.json +36 -21
  67. package/scheduled-task/scheduled-task-description.js +77 -0
  68. package/scheduled-task/scheduled-task-preparation.js +24 -0
  69. package/scheduled-task/scheduled-task-trigger.js +7 -2
  70. package/scheduled-task/scheduled-tasks-api-client.js +19 -0
  71. package/scheduled-task/use-scheduled-task-runs.js +194 -0
  72. package/scheduled-task/use-scheduled-tasks.js +93 -0
  73. package/scheduled-tasks.d.ts +195 -3
  74. package/scheduled-tasks.js +7 -2
  75. package/skill/skill-archive.js +19 -0
  76. package/skill/skill-types.js +8 -7
  77. package/skill/skill.js +42 -27
  78. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +79 -0
  79. package/skill/useSkillEditorLoad.js +29 -28
  80. package/skill/useSkillEditorSubmit.js +108 -84
  81. package/skill/useSkillFileActions.js +70 -58
  82. package/skill-editor.d.ts +133 -3
  83. package/skill-editor.js +9 -8
  84. package/usage/map-usage-data-to-dashboard.js +66 -0
  85. package/usage/map-user-usage-to-model-limits.js +202 -0
  86. package/usage.d.ts +125 -0
  87. package/usage.js +3 -0
  88. package/usePageFileDrag/usePageFileDrag.js +3 -3
  89. package/utils.d.ts +8 -6
@@ -0,0 +1,66 @@
1
+ import { formatCost as e } from "@epam/ai-dial-chat-shared";
2
+ import { UsageLimitStatus as t } from "@epam/ai-dial-usage-dashboard";
3
+ //#region src/usage/map-usage-data-to-dashboard.ts
4
+ var n = {
5
+ todayTitle: "usage.todayTitle",
6
+ todayPeriodDescription: "usage.todayPeriodDescription",
7
+ thisWeekTitle: "usage.thisWeekTitle",
8
+ thisWeekPeriodDescription: "usage.thisWeekPeriodDescription",
9
+ thisMonthTitle: "usage.thisMonthTitle",
10
+ thisMonthPeriodDescription: "usage.thisMonthPeriodDescription",
11
+ unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel",
12
+ progressAriaLabel: "usage.progressAriaLabel"
13
+ }, r = 2 ** 53, i = 75, a = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used), o = (e) => e >= 100 ? t.LimitReached : e >= i ? t.RunningLow : t.Default, s = (e) => e ? {
14
+ resetLabel: e.label,
15
+ resetIsoValue: e.isoValue,
16
+ resetAriaLabel: e.ariaLabel
17
+ } : {}, c = (i, a, c, l, u) => {
18
+ let d = Math.max(0, i.used), f = e(d), p = s(u);
19
+ if (i.total >= r) return {
20
+ title: a,
21
+ periodDescription: c,
22
+ used: d,
23
+ total: i.total,
24
+ usedLabel: f,
25
+ isUnlimited: !0,
26
+ status: t.Default,
27
+ progressAriaLabel: l(n.unlimitedProgressAriaLabel, { used: f }),
28
+ ...p
29
+ };
30
+ let m = Math.max(i.total, 0), h = Math.max(m - d, 0), g = m > 0 ? d / m * 100 : 100, _ = e(m);
31
+ return {
32
+ title: a,
33
+ periodDescription: c,
34
+ used: d,
35
+ total: m,
36
+ usedLabel: f,
37
+ totalLabel: _,
38
+ remainingLabel: e(h),
39
+ usedPercent: g,
40
+ status: o(g),
41
+ progressAriaLabel: l(n.progressAriaLabel, {
42
+ used: f,
43
+ total: _,
44
+ percent: Math.round(g)
45
+ }),
46
+ ...p
47
+ };
48
+ }, l = (e, t, r) => [
49
+ {
50
+ stats: e?.dayCostStats,
51
+ titleKey: n.todayTitle,
52
+ periodDescriptionKey: n.todayPeriodDescription
53
+ },
54
+ {
55
+ stats: e?.weekCostStats,
56
+ titleKey: n.thisWeekTitle,
57
+ periodDescriptionKey: n.thisWeekPeriodDescription
58
+ },
59
+ {
60
+ stats: e?.monthCostStats,
61
+ titleKey: n.thisMonthTitle,
62
+ periodDescriptionKey: n.thisMonthPeriodDescription
63
+ }
64
+ ].flatMap(({ stats: e, titleKey: n, periodDescriptionKey: i }) => a(e) ? [c(e, t(n), t(i), t, r(e.resetsAt))] : []);
65
+ //#endregion
66
+ export { n as USAGE_DATA_I18N_KEYS, l as mapUsageDataToDashboard };
@@ -0,0 +1,202 @@
1
+ import { normalizeDeploymentId as e } from "../catalog/deployment-id.js";
2
+ import { formatCost as t } from "@epam/ai-dial-chat-shared";
3
+ import { DeploymentItemDtoTypeEnum as n } from "@epam/ai-dial-chat-api-client";
4
+ import { ModelLimitMetricKind as r, ModelLimitStatus as i } from "@epam/ai-dial-usage-dashboard";
5
+ //#region src/usage/map-user-usage-to-model-limits.ts
6
+ var a = 2 ** 53, o = 75, s = new Intl.NumberFormat(void 0, {
7
+ notation: "compact",
8
+ maximumFractionDigits: 1
9
+ }), c = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), l = {
10
+ todayPeriodDescription: "usage.todayPeriodDescription",
11
+ thisWeekPeriodDescription: "usage.thisWeekPeriodDescription",
12
+ thisMonthPeriodDescription: "usage.thisMonthPeriodDescription",
13
+ overallCostLimitRunningLowTooltip: "usage.overallCostLimitRunningLowTooltip",
14
+ overallCostLimitReachedTooltip: "usage.overallCostLimitReachedTooltip",
15
+ unavailableLabel: "usage.unavailableLabel",
16
+ followsCostLimitLabel: "usage.followsCostLimitLabel",
17
+ noLimitLabel: "usage.noLimitLabel",
18
+ followsCostLimitAriaLabel: "usage.followsCostLimitAriaLabel",
19
+ unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel",
20
+ progressAriaLabel: "usage.progressAriaLabel",
21
+ spentLabel: "usage.spentLabel",
22
+ applicationTypeLabel: "usage.applicationTypeLabel",
23
+ includesCalledModelsLabel: "usage.includesCalledModelsLabel"
24
+ }, u = {
25
+ day: {
26
+ cost: "dayCostStats",
27
+ tokens: "dayTokenStats"
28
+ },
29
+ week: {
30
+ cost: "weekCostStats",
31
+ tokens: "weekTokenStats"
32
+ },
33
+ month: {
34
+ cost: "monthCostStats",
35
+ tokens: "monthTokenStats"
36
+ }
37
+ }, d = {
38
+ day: {
39
+ field: "dayCostStats",
40
+ labelKey: l.todayPeriodDescription
41
+ },
42
+ week: {
43
+ field: "weekCostStats",
44
+ labelKey: l.thisWeekPeriodDescription
45
+ },
46
+ month: {
47
+ field: "monthCostStats",
48
+ labelKey: l.thisMonthPeriodDescription
49
+ }
50
+ }, f = (e) => e != null && Number.isFinite(e.total) && Number.isFinite(e.used), p = (e) => e >= 100 ? i.LimitReached : e >= o ? i.RunningLow : i.WithinLimits, m = (e) => {
51
+ if (!f(e)) return i.Unavailable;
52
+ if (e.total >= a) return i.NoLimit;
53
+ let t = Math.max(0, e.used), n = Math.max(0, e.total);
54
+ return p(n > 0 ? t / n * 100 : 100);
55
+ }, h = (e) => e === i.WithinLimits || e === i.RunningLow || e === i.LimitReached, g = (e, t, n, r, a) => {
56
+ let o = e?.[t.field], s = m(o), c = a(o?.resetsAt), u = r(t.labelKey).toLocaleLowerCase(n);
57
+ return {
58
+ status: s,
59
+ tooltipLabel: s === i.LimitReached ? r(l.overallCostLimitReachedTooltip, { period: u }) : s === i.RunningLow ? r(l.overallCostLimitRunningLowTooltip, { period: u }) : void 0,
60
+ ...c ? {
61
+ resetLabel: c.label,
62
+ resetIsoValue: c.isoValue,
63
+ resetAriaLabel: c.ariaLabel
64
+ } : {}
65
+ };
66
+ }, _ = () => void 0, v = (e, t, n, r = _) => ({
67
+ day: g(e, d.day, t, n, r),
68
+ week: g(e, d.week, t, n, r),
69
+ month: g(e, d.month, t, n, r)
70
+ }), y = (e) => ({
71
+ kind: r.Unavailable,
72
+ ariaLabel: e(l.unavailableLabel)
73
+ }), b = (e, t, n) => {
74
+ if (!f(e)) return y(n);
75
+ let i = Math.max(0, e.used), o = s.format(i);
76
+ if (e.total >= a) {
77
+ let e = h(t);
78
+ return {
79
+ kind: r.Unlimited,
80
+ usedLabel: o,
81
+ supportingLabel: n(e ? l.followsCostLimitLabel : l.noLimitLabel),
82
+ ariaLabel: n(e ? l.followsCostLimitAriaLabel : l.unlimitedProgressAriaLabel, { used: c.format(i) })
83
+ };
84
+ }
85
+ let u = Math.max(e.total, 0), d = s.format(u), m = u > 0 ? i / u * 100 : 100, g = p(m);
86
+ return {
87
+ kind: r.Finite,
88
+ usedLabel: o,
89
+ totalLabel: d,
90
+ usedPercent: m,
91
+ status: g,
92
+ ariaLabel: n(l.progressAriaLabel, {
93
+ used: c.format(i),
94
+ total: c.format(u),
95
+ percent: Math.round(m)
96
+ })
97
+ };
98
+ }, x = (e, n) => {
99
+ if (!f(e)) return y(n);
100
+ let i = Math.max(0, e.used), o = n(l.spentLabel, { amount: t(i) });
101
+ if (e.total >= a) return {
102
+ kind: r.Unlimited,
103
+ usedLabel: o,
104
+ ariaLabel: o
105
+ };
106
+ let s = Math.max(e.total, 0), c = s > 0 ? i / s * 100 : 100;
107
+ return {
108
+ kind: r.Finite,
109
+ usedLabel: o,
110
+ totalLabel: t(s),
111
+ usedPercent: c,
112
+ status: p(c),
113
+ ariaLabel: n(l.progressAriaLabel, {
114
+ used: t(i),
115
+ total: t(s),
116
+ percent: Math.round(c)
117
+ })
118
+ };
119
+ }, S = (e, t, n, r) => ({
120
+ tokens: b(e[t.tokens], n, r),
121
+ cost: x(e[t.cost], r)
122
+ }), C = (e) => e.filter((e) => e.kind === r.Finite).map((e) => e.status), w = (e, t, n) => {
123
+ let a = [
124
+ ...C(e),
125
+ ...C(t),
126
+ ...n
127
+ ].filter((e) => e != null && h(e));
128
+ return a.includes(i.LimitReached) ? i.LimitReached : a.includes(i.RunningLow) ? i.RunningLow : a.includes(i.WithinLimits) ? i.WithinLimits : e.some((e) => e.kind === r.Unlimited) || n.includes(i.NoLimit) ? i.NoLimit : i.Unavailable;
129
+ }, T = (e, t, n) => {
130
+ let i = x(e[t.cost], n);
131
+ return {
132
+ tokens: y(n),
133
+ cost: i.kind === r.Unlimited ? {
134
+ ...i,
135
+ supportingLabel: n(l.includesCalledModelsLabel)
136
+ } : i
137
+ };
138
+ }, E = (e) => e.some((e) => f(e) && e.used > 0), D = (t, r, i, a, o, s) => {
139
+ let c = t?.deployments;
140
+ if (c == null) return [];
141
+ let d = new Map(r.filter((e) => e.type === n.Model || e.type === n.Application).map((t) => [e(t.id), t])), f = v(t, i, a);
142
+ return Object.keys(c).map((t) => {
143
+ let r = d.get(e(t)), p = r == null ? t : s(r.displayName, i) || r.id, m = c[t], h = o(r?.iconUrl);
144
+ if (r?.type === n.Application) {
145
+ let e = T(m, u.day, a), n = T(m, u.week, a), i = T(m, u.month, a);
146
+ return {
147
+ row: {
148
+ id: t,
149
+ name: p,
150
+ version: r.displayVersion,
151
+ avatarSrc: h,
152
+ typeLabel: a(l.applicationTypeLabel),
153
+ day: e,
154
+ week: n,
155
+ month: i,
156
+ status: w([
157
+ e.tokens,
158
+ n.tokens,
159
+ i.tokens
160
+ ], [
161
+ e.cost,
162
+ n.cost,
163
+ i.cost
164
+ ], [
165
+ f.day.status,
166
+ f.week.status,
167
+ f.month.status
168
+ ])
169
+ },
170
+ hasUsage: E(Object.values(u).map(({ cost: e }) => m[e]))
171
+ };
172
+ }
173
+ let g = S(m, u.day, f.day.status, a), _ = S(m, u.week, f.week.status, a), v = S(m, u.month, f.month.status, a), y = Object.values(u).flatMap(({ cost: e, tokens: t }) => [m[e], m[t]]);
174
+ return {
175
+ row: {
176
+ id: t,
177
+ name: p,
178
+ version: r?.displayVersion,
179
+ avatarSrc: h,
180
+ day: g,
181
+ week: _,
182
+ month: v,
183
+ status: w([
184
+ g.tokens,
185
+ _.tokens,
186
+ v.tokens
187
+ ], [
188
+ g.cost,
189
+ _.cost,
190
+ v.cost
191
+ ], [
192
+ f.day.status,
193
+ f.week.status,
194
+ f.month.status
195
+ ])
196
+ },
197
+ hasUsage: E(y)
198
+ };
199
+ }).filter(({ hasUsage: e }) => e).map(({ row: e }) => e);
200
+ };
201
+ //#endregion
202
+ export { l as USAGE_MODEL_LIMITS_I18N_KEYS, v as mapOverallCostLimitsToPeriodStatuses, D as mapUserUsageToModelLimits };
package/usage.d.ts ADDED
@@ -0,0 +1,125 @@
1
+ import { DeploymentItemDto } from '@epam/ai-dial-chat-api-client';
2
+ import { ModelLimitPeriodStatuses } from '@epam/ai-dial-usage-dashboard';
3
+ import { ModelLimitRow } from '@epam/ai-dial-usage-dashboard';
4
+ import { UsageLimitCardData } from '@epam/ai-dial-usage-dashboard';
5
+ import { UserLimitStatsResponseDto } from '@epam/ai-dial-chat-api-client';
6
+
7
+ /** Formats a raw `resetsAt` into display strings, or returns `undefined` when it cannot be formatted. */
8
+ export declare type FormatResetTime = (resetsAt: string | undefined) => ResetTimeDisplay | undefined;
9
+
10
+ /**
11
+ * Maps the same top-level Cost budgets used by the aggregate cards into table-header state.
12
+ *
13
+ * @param formatResetTime - Formats each period's top-level `resetsAt` into the header's reset trio. Omit it to produce statuses with no reset fields.
14
+ */
15
+ export declare const mapOverallCostLimitsToPeriodStatuses: (usage: UserLimitStatsResponseDto | undefined, activeLocale: string, t: Translate_2, formatResetTime?: FormatResetTime) => ModelLimitPeriodStatuses;
16
+
17
+ /**
18
+ * Maps a `UserLimitStatsResponseDto` into `UsageLimitCardGroup`'s `cards` prop,
19
+ * in Today / This week / This month order. A period is omitted entirely when
20
+ * the response carries no usable stat for it. Each card's reset trio comes from
21
+ * `formatResetTime`, and is absent when that callback returns `undefined`.
22
+ */
23
+ export declare const mapUsageDataToDashboard: (usage: UserLimitStatsResponseDto | undefined, t: Translate, formatResetTime: FormatResetTime) => UsageLimitCardData[];
24
+
25
+ /**
26
+ * Maps `usage.deployments` into `ModelLimitsSection`'s `rows` prop, joined with model or application
27
+ * identity from `deploymentItems`. Rows are included only when any displayed period stat has nonzero
28
+ * usage (Cost stats only, for an application). Order follows `Object.keys(deployments)` —
29
+ * `deploymentItems` is enrichment-only.
30
+ *
31
+ * @param resolveIconUrl - Resolves a deployment's raw `iconUrl` to the URL the avatar should load.
32
+ * @param resolveDisplayName - Resolves a localized-text map or plain string to the display name for `activeLocale`.
33
+ */
34
+ export declare const mapUserUsageToModelLimits: (usage: UserLimitStatsResponseDto | undefined, deploymentItems: DeploymentItemDto[], activeLocale: string, t: Translate_2, resolveIconUrl: ResolveIconUrl, resolveDisplayName: ResolveDisplayName) => ModelLimitRow[];
35
+
36
+ /**
37
+ * One reset time, already parsed and formatted by the host. Declared
38
+ * structurally here so this library never imports an application type; the
39
+ * host passes a value that satisfies this shape (e.g. `apps/chat`'s own
40
+ * `ResetTimeDisplay`).
41
+ */
42
+ export declare interface ResetTimeDisplay {
43
+ /** Exclusive end of the period as an epoch ms value, for the host's boundary scheduling. */
44
+ resetsAtMs: number;
45
+ /** Machine-readable instant for a `<time dateTime>` attribute. */
46
+ isoValue: string;
47
+ /** Visible reset line. */
48
+ label: string;
49
+ /** Accessible expansion of the reset line. */
50
+ ariaLabel: string;
51
+ }
52
+
53
+ /** A callback that resolves a display name from a localized-text value. */
54
+ declare type ResolveDisplayName = (name: string | Record<string, string> | undefined | null, locale: string) => string;
55
+
56
+ /** A callback that resolves an icon URL from a deployment's raw `iconUrl` field. */
57
+ declare type ResolveIconUrl = (iconUrl: string | undefined) => string | undefined;
58
+
59
+ /** A translate function compatible with i18next's `TFunction`. */
60
+ declare type Translate = (key: string, options?: Record<string, unknown>) => string;
61
+
62
+ /** A translate function compatible with i18next's `TFunction`. */
63
+ declare type Translate_2 = (key: string, options?: Record<string, unknown>) => string;
64
+
65
+ /**
66
+ * i18n key strings that the consuming app's translation bundle must define for
67
+ * `mapUsageDataToDashboard` to produce correctly translated strings. The
68
+ * values are the default key paths used by AI DIAL Chat.
69
+ */
70
+ export declare const USAGE_DATA_I18N_KEYS: {
71
+ /** Title for the current-UTC-day card (e.g. `'Today'`). */
72
+ readonly todayTitle: "usage.todayTitle";
73
+ /** Accessible period description for the current-UTC-day card. */
74
+ readonly todayPeriodDescription: "usage.todayPeriodDescription";
75
+ /** Title for the current-UTC-week card (e.g. `'This week'`). */
76
+ readonly thisWeekTitle: "usage.thisWeekTitle";
77
+ /** Accessible period description for the current-UTC-week card. */
78
+ readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
79
+ /** Title for the current-UTC-month card (e.g. `'This month'`). */
80
+ readonly thisMonthTitle: "usage.thisMonthTitle";
81
+ /** Accessible period description for the current-UTC-month card. */
82
+ readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
83
+ /** Aria label when there is no limit. Receives `{ used: string }`. */
84
+ readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
85
+ /** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
86
+ readonly progressAriaLabel: "usage.progressAriaLabel";
87
+ };
88
+
89
+ /**
90
+ * i18n key strings that the consuming app's translation bundle must define for
91
+ * `mapUserUsageToModelLimits` and `mapOverallCostLimitsToPeriodStatuses` to produce
92
+ * correctly translated strings. The values are the default key paths used by AI DIAL Chat.
93
+ */
94
+ export declare const USAGE_MODEL_LIMITS_I18N_KEYS: {
95
+ /** Period label used in tooltip text. Receives no interpolation. */
96
+ readonly todayPeriodDescription: "usage.todayPeriodDescription";
97
+ /** Period label used in tooltip text. Receives no interpolation. */
98
+ readonly thisWeekPeriodDescription: "usage.thisWeekPeriodDescription";
99
+ /** Period label used in tooltip text. Receives no interpolation. */
100
+ readonly thisMonthPeriodDescription: "usage.thisMonthPeriodDescription";
101
+ /** Tooltip when the overall cost limit is running low. Receives `{ period: string }`. */
102
+ readonly overallCostLimitRunningLowTooltip: "usage.overallCostLimitRunningLowTooltip";
103
+ /** Tooltip when the overall cost limit is reached. Receives `{ period: string }`. */
104
+ readonly overallCostLimitReachedTooltip: "usage.overallCostLimitReachedTooltip";
105
+ /** Aria label for a metric cell with no data. */
106
+ readonly unavailableLabel: "usage.unavailableLabel";
107
+ /** Supporting label when a token limit follows the cost limit. */
108
+ readonly followsCostLimitLabel: "usage.followsCostLimitLabel";
109
+ /** Supporting label when there is no per-deployment token limit. */
110
+ readonly noLimitLabel: "usage.noLimitLabel";
111
+ /** Aria label when token usage has no limit but follows the cost limit. Receives `{ used: string }`. */
112
+ readonly followsCostLimitAriaLabel: "usage.followsCostLimitAriaLabel";
113
+ /** Aria label when there is no limit. Receives `{ used: string }`. */
114
+ readonly unlimitedProgressAriaLabel: "usage.unlimitedProgressAriaLabel";
115
+ /** Aria label for a progress bar with a finite limit. Receives `{ used: string, total: string, percent: number }`. */
116
+ readonly progressAriaLabel: "usage.progressAriaLabel";
117
+ /** Label for the spent-cost cell. Receives `{ amount: string }`. */
118
+ readonly spentLabel: "usage.spentLabel";
119
+ /** Type caption for an application (agent) row. Receives no interpolation. */
120
+ readonly applicationTypeLabel: "usage.applicationTypeLabel";
121
+ /** Supporting label on an application row's spent cost. Receives no interpolation. */
122
+ readonly includesCalledModelsLabel: "usage.includesCalledModelsLabel";
123
+ };
124
+
125
+ export { }
package/usage.js ADDED
@@ -0,0 +1,3 @@
1
+ import { USAGE_DATA_I18N_KEYS as e, mapUsageDataToDashboard as t } from "./usage/map-usage-data-to-dashboard.js";
2
+ import { USAGE_MODEL_LIMITS_I18N_KEYS as n, mapOverallCostLimitsToPeriodStatuses as r, mapUserUsageToModelLimits as i } from "./usage/map-user-usage-to-model-limits.js";
3
+ export { e as USAGE_DATA_I18N_KEYS, n as USAGE_MODEL_LIMITS_I18N_KEYS, r as mapOverallCostLimitsToPeriodStatuses, t as mapUsageDataToDashboard, i as mapUserUsageToModelLimits };
@@ -6,8 +6,8 @@ var a = (a = !0, o = !0) => {
6
6
  f.current = a, p.current = o, o || (d.current = 0, c(!1));
7
7
  }, [a, o]);
8
8
  let m = e(() => {
9
- u([]);
10
- }, []);
9
+ u((e) => e.filter((e) => !l.includes(e)));
10
+ }, [l]);
11
11
  return t(() => {
12
12
  let e = (e) => !!e.dataTransfer?.types.includes("Files"), t = (t) => {
13
13
  !p.current || !e(t) || (d.current += 1, c(!0));
@@ -18,7 +18,7 @@ var a = (a = !0, o = !0) => {
18
18
  }, i = (t) => {
19
19
  if (!(!e(t) || !p.current) && (t.preventDefault(), d.current = 0, c(!1), f.current)) {
20
20
  let e = Array.from(t.dataTransfer?.files ?? []);
21
- e.length > 0 && u(e);
21
+ e.length > 0 && u((t) => [...t, ...e]);
22
22
  }
23
23
  };
24
24
  return document.addEventListener("dragenter", t), document.addEventListener("dragleave", n), document.addEventListener("dragover", r), document.addEventListener("drop", i), () => {
package/utils.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { DeploymentCreationFormLocaleEntry } from '@epam/ai-dial-builder-form';
2
- import { DeploymentCreationFormLocaleOption } from '@epam/ai-dial-builder-form';
3
1
  import { ExportFolder } from '@epam/ai-dial-chat-shared';
2
+ import { LocaleOption } from '@epam/ai-dial-chat-shared';
4
3
  import { LocaleTextEntryDto } from '@epam/ai-dial-chat-api-client';
4
+ import { LocalizedTextEntry } from '@epam/ai-dial-chat-shared';
5
5
  import { Middleware } from '@epam/ai-dial-chat-api-client';
6
6
  import { PromptFolderResponseDto } from '@epam/ai-dial-chat-api-client';
7
7
  import { PromptListResponseDto } from '@epam/ai-dial-chat-api-client';
@@ -10,6 +10,8 @@ import { UserLimitStatsResponseDto } from '@epam/ai-dial-chat-api-client';
10
10
 
11
11
  /** Normalized shape returned by {@link getApiErrorDetails}. */
12
12
  export declare interface ApiErrorDetails {
13
+ /** Stable domain error code supplied by the API, when present. */
14
+ code?: string;
13
15
  /** HTTP status code carried by the error, when available. */
14
16
  status?: number;
15
17
  /** Resolved human-readable error message, or `null` when none could be resolved. */
@@ -29,7 +31,7 @@ export declare const apSchedulerDayToJsDay: (apSchedulerDay: number) => number;
29
31
  * `additionalLocaleCodes` and excluding whichever code is already the
30
32
  * primary Name/Description field.
31
33
  */
32
- export declare const buildAdditionalLocaleOptions: (additionalLocaleCodes: string[], primaryLocale: string) => DeploymentCreationFormLocaleOption[];
34
+ export declare const buildAdditionalLocaleOptions: (additionalLocaleCodes: string[], primaryLocale: string) => LocaleOption[];
33
35
 
34
36
  /** Reconstructs the exact scope id Core expects as `ResourceSignInRequest`/`ResourceSignOutRequest`'s `url` field. */
35
37
  export declare const buildExternalServiceScopeId: (appId: string, serviceName: string) => string;
@@ -52,7 +54,7 @@ export declare const buildPromptPath: (folderId: string, name: string) => string
52
54
  * `undefined` (not `[]`) when nothing remains, so a request untouched by
53
55
  * this feature stays byte-identical to today.
54
56
  */
55
- export declare const composeLocalePayload: (otherLocales: DeploymentCreationFormLocaleEntry[], primaryLocale: string) => LocaleTextEntryDto[] | undefined;
57
+ export declare const composeLocalePayload: (otherLocales: LocalizedTextEntry[], primaryLocale: string) => LocaleTextEntryDto[] | undefined;
56
58
 
57
59
  /**
58
60
  * Builds a generated-client `Middleware` that attaches `X-CSRF-Token` on every
@@ -113,7 +115,7 @@ export declare type CsrfRefreshOutcome = {
113
115
  * present in either map, excluding `primaryLocale` — that key is already the
114
116
  * primary Name/Description field, not a row in the popup.
115
117
  */
116
- export declare const decomposeLocalizedFields: (displayName: LocalizedText | undefined, description: LocalizedText | undefined, primaryLocale: string) => DeploymentCreationFormLocaleEntry[];
118
+ export declare const decomposeLocalizedFields: (displayName: LocalizedText | undefined, description: LocalizedText | undefined, primaryLocale: string) => LocalizedTextEntry[];
117
119
 
118
120
  /** A prompt record as it appears inside a downloaded prompt file. */
119
121
  export declare interface ExportedPrompt {
@@ -132,7 +134,7 @@ export declare interface ExportedPrompt {
132
134
  /** Formats a Unix timestamp (ms) as a locale-formatted calendar date, e.g. `'22/7/2026'`. */
133
135
  export declare const formatCalendarDate: (timestampMs: number) => string;
134
136
 
135
- /** Normalizes any API error into a `{ status?, message, traceId? }` shape. */
137
+ /** Normalizes any API error into a `{ status?, message, traceId?, code? }` shape. */
136
138
  export declare const getApiErrorDetails: (error: unknown) => Promise<ApiErrorDetails>;
137
139
 
138
140
  /** Resolves a human-readable message from an API error's response body, or falls back to `Error.message`. */