@progress/kendo-react-conversational-ui 14.5.0-develop.13 → 14.5.0-develop.15
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/ai-prompt/AIPrompt.d.ts +6 -0
- package/ai-prompt/AIPrompt.js +1 -1
- package/ai-prompt/AIPrompt.mjs +40 -38
- package/chat/ChatPropsAndState.d.ts +17 -0
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +224 -222
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +123 -108
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/messages/index.d.ts +5 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +12 -10
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -11
- package/prompt-box/PromptBox.js +1 -1
- package/prompt-box/PromptBox.mjs +135 -137
package/chat/components/Chat.mjs
CHANGED
|
@@ -5,96 +5,96 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { validatePackage as
|
|
8
|
+
import { useWebMcpRegister as Ot, validatePackage as Pt, getLicenseMessage as Ut, Keys as F, classNames as He, WatermarkOverlay as jt } from "@progress/kendo-react-common";
|
|
9
9
|
import o from "prop-types";
|
|
10
10
|
import * as t from "react";
|
|
11
|
-
import { FloatingActionButton as
|
|
12
|
-
import { arrowDownIcon as
|
|
13
|
-
import { convertMsgsToViewItems as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import { ChatMessage as
|
|
24
|
-
import { packageMetadata as
|
|
25
|
-
import { ariaLabelMessageList as
|
|
26
|
-
import { useLocalization as
|
|
27
|
-
import { isStandardMessageFormat as
|
|
28
|
-
import { useMessageAutoScroll as
|
|
29
|
-
import { resolveMessageSettings as
|
|
30
|
-
import { useEndlessScroll as
|
|
31
|
-
const
|
|
11
|
+
import { FloatingActionButton as Vt } from "@progress/kendo-react-buttons";
|
|
12
|
+
import { arrowDownIcon as qt } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { convertMsgsToViewItems as Wt } from "../ViewItem.mjs";
|
|
14
|
+
import zt from "./ActionGroup.mjs";
|
|
15
|
+
import Gt from "./AttachmentGroup.mjs";
|
|
16
|
+
import Ht from "./DateMarker.mjs";
|
|
17
|
+
import Kt from "./MessageGroup.mjs";
|
|
18
|
+
import $t from "./NewMessage.mjs";
|
|
19
|
+
import Jt from "./Header.mjs";
|
|
20
|
+
import Qt from "./elements/PinnedMessage.mjs";
|
|
21
|
+
import Xt from "./Notification.mjs";
|
|
22
|
+
import Yt from "./ChatContext.mjs";
|
|
23
|
+
import { ChatMessage as Zt } from "./ChatMessage.mjs";
|
|
24
|
+
import { packageMetadata as Ke } from "../../package-metadata.mjs";
|
|
25
|
+
import { ariaLabelMessageList as $e, messages as L, scrollToBottom as w, chatCopyNotification as Je } from "../../messages/index.mjs";
|
|
26
|
+
import { useLocalization as _t } from "@progress/kendo-react-intl";
|
|
27
|
+
import { isStandardMessageFormat as es, mapDataArrayToMessages as ts } from "../utils/fieldMapping.mjs";
|
|
28
|
+
import { useMessageAutoScroll as ss, useHasScrollbar as os } from "../utils/scroll.mjs";
|
|
29
|
+
import { resolveMessageSettings as ns } from "../utils/messageSettings.mjs";
|
|
30
|
+
import { useEndlessScroll as as } from "../hooks/useEndlessScroll.mjs";
|
|
31
|
+
const Qe = t.forwardRef((B, k) => {
|
|
32
32
|
const {
|
|
33
33
|
messages: f = [],
|
|
34
|
-
messageTemplate:
|
|
35
|
-
messageContentTemplate:
|
|
36
|
-
attachmentTemplate:
|
|
34
|
+
messageTemplate: G,
|
|
35
|
+
messageContentTemplate: H,
|
|
36
|
+
attachmentTemplate: I,
|
|
37
37
|
width: Xe,
|
|
38
38
|
height: Ye,
|
|
39
39
|
onSendMessage: C,
|
|
40
|
-
onSuggestionClick:
|
|
41
|
-
onInputValueChange:
|
|
42
|
-
onActionExecute:
|
|
40
|
+
onSuggestionClick: K,
|
|
41
|
+
onInputValueChange: $,
|
|
42
|
+
onActionExecute: N,
|
|
43
43
|
dir: p,
|
|
44
44
|
messageBox: Ze,
|
|
45
45
|
placeholder: _e,
|
|
46
|
-
className:
|
|
46
|
+
className: J,
|
|
47
47
|
style: et,
|
|
48
|
-
message:
|
|
48
|
+
message: Q = Zt,
|
|
49
49
|
authorId: a,
|
|
50
50
|
suggestions: tt,
|
|
51
51
|
suggestionTemplate: st,
|
|
52
52
|
suggestionsLayout: ot = "scroll",
|
|
53
|
-
quickActionsLayout:
|
|
53
|
+
quickActionsLayout: X = "scroll",
|
|
54
54
|
inputValue: nt,
|
|
55
55
|
headerTemplate: h,
|
|
56
56
|
noDataTemplate: M,
|
|
57
|
-
timestampTemplate:
|
|
58
|
-
statusTemplate:
|
|
59
|
-
userStatusTemplate:
|
|
60
|
-
allowMessageCollapse:
|
|
61
|
-
messageToolbarActions:
|
|
62
|
-
messageContextMenuActions:
|
|
57
|
+
timestampTemplate: Y,
|
|
58
|
+
statusTemplate: Z,
|
|
59
|
+
userStatusTemplate: _,
|
|
60
|
+
allowMessageCollapse: ee,
|
|
61
|
+
messageToolbarActions: te,
|
|
62
|
+
messageContextMenuActions: se,
|
|
63
63
|
fileActions: v,
|
|
64
64
|
onUnpin: at,
|
|
65
|
-
messageWidthMode:
|
|
66
|
-
showAvatar:
|
|
67
|
-
showUsername:
|
|
68
|
-
timestampVisibility:
|
|
69
|
-
authorMessageSettings:
|
|
70
|
-
receiverMessageSettings:
|
|
71
|
-
onToolbarAction:
|
|
72
|
-
onContextMenuAction:
|
|
73
|
-
onFileAction:
|
|
74
|
-
onDownload:
|
|
75
|
-
speechToTextConfig:
|
|
76
|
-
uploadConfig:
|
|
65
|
+
messageWidthMode: oe,
|
|
66
|
+
showAvatar: ne,
|
|
67
|
+
showUsername: ae,
|
|
68
|
+
timestampVisibility: re,
|
|
69
|
+
authorMessageSettings: le,
|
|
70
|
+
receiverMessageSettings: ie,
|
|
71
|
+
onToolbarAction: ce,
|
|
72
|
+
onContextMenuAction: ue,
|
|
73
|
+
onFileAction: me,
|
|
74
|
+
onDownload: de,
|
|
75
|
+
speechToTextConfig: ge,
|
|
76
|
+
uploadConfig: fe,
|
|
77
77
|
sendButtonConfig: rt,
|
|
78
|
-
messageFilesLayout:
|
|
79
|
-
scrollToBottomButton:
|
|
78
|
+
messageFilesLayout: pe,
|
|
79
|
+
scrollToBottomButton: D = !0,
|
|
80
80
|
autoScrollThreshold: lt,
|
|
81
|
-
textField:
|
|
82
|
-
statusField:
|
|
83
|
-
authorIdField:
|
|
84
|
-
authorNameField:
|
|
85
|
-
authorImageUrlField:
|
|
86
|
-
authorImageAltTextField:
|
|
87
|
-
idField:
|
|
88
|
-
timestampField:
|
|
89
|
-
filesField:
|
|
90
|
-
attachmentsField:
|
|
91
|
-
replyToIdField:
|
|
81
|
+
textField: he,
|
|
82
|
+
statusField: Me,
|
|
83
|
+
authorIdField: ye,
|
|
84
|
+
authorNameField: Ce,
|
|
85
|
+
authorImageUrlField: Se,
|
|
86
|
+
authorImageAltTextField: Te,
|
|
87
|
+
idField: be,
|
|
88
|
+
timestampField: ke,
|
|
89
|
+
filesField: ve,
|
|
90
|
+
attachmentsField: Ee,
|
|
91
|
+
replyToIdField: Re,
|
|
92
92
|
isDeletedField: xe,
|
|
93
|
-
isPinnedField:
|
|
94
|
-
typingField:
|
|
95
|
-
suggestedActionsField:
|
|
96
|
-
isFailedField:
|
|
97
|
-
onResendMessage:
|
|
93
|
+
isPinnedField: Ae,
|
|
94
|
+
typingField: Fe,
|
|
95
|
+
suggestedActionsField: Le,
|
|
96
|
+
isFailedField: we,
|
|
97
|
+
onResendMessage: Be,
|
|
98
98
|
messageBoxSettings: it,
|
|
99
99
|
loading: ct,
|
|
100
100
|
scrollMode: ut,
|
|
@@ -103,38 +103,39 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
103
103
|
startIndex: gt,
|
|
104
104
|
endIndex: ft,
|
|
105
105
|
onLoadMoreMessages: pt,
|
|
106
|
-
pinnedMessages:
|
|
107
|
-
repliedToMessages:
|
|
106
|
+
pinnedMessages: O,
|
|
107
|
+
repliedToMessages: Ie,
|
|
108
108
|
onReferencedMessageClick: ht,
|
|
109
109
|
...Mt
|
|
110
|
-
} =
|
|
110
|
+
} = B, yt = t.useRef(null);
|
|
111
|
+
Ot("chat", yt, B, B.webMcp);
|
|
112
|
+
const [u, P] = t.useState(null), [U, Ct] = t.useState(!1), [St, Ne] = t.useState(!1), [De, Oe] = t.useState(null), [m, Pe] = t.useState(null), [Tt, Ue] = t.useState(!1), j = t.useRef(null), je = t.useRef(null), i = t.useRef(null), Ve = t.useRef(null), V = t.useRef(void 0), q = t.useRef(!1), W = t.useRef(null), qe = t.useRef(""), c = t.useMemo(() => {
|
|
111
113
|
if (!f || f.length === 0)
|
|
112
114
|
return [];
|
|
113
115
|
const s = {
|
|
114
|
-
textField:
|
|
115
|
-
statusField:
|
|
116
|
-
authorIdField:
|
|
117
|
-
authorNameField:
|
|
118
|
-
authorImageUrlField:
|
|
119
|
-
authorImageAltTextField:
|
|
120
|
-
idField:
|
|
121
|
-
timestampField:
|
|
122
|
-
filesField:
|
|
123
|
-
attachmentsField:
|
|
124
|
-
replyToIdField:
|
|
116
|
+
textField: he,
|
|
117
|
+
statusField: Me,
|
|
118
|
+
authorIdField: ye,
|
|
119
|
+
authorNameField: Ce,
|
|
120
|
+
authorImageUrlField: Se,
|
|
121
|
+
authorImageAltTextField: Te,
|
|
122
|
+
idField: be,
|
|
123
|
+
timestampField: ke,
|
|
124
|
+
filesField: ve,
|
|
125
|
+
attachmentsField: Ee,
|
|
126
|
+
replyToIdField: Re,
|
|
125
127
|
isDeletedField: xe,
|
|
126
|
-
isPinnedField:
|
|
127
|
-
typingField:
|
|
128
|
-
suggestedActionsField:
|
|
129
|
-
isFailedField:
|
|
128
|
+
isPinnedField: Ae,
|
|
129
|
+
typingField: Fe,
|
|
130
|
+
suggestedActionsField: Le,
|
|
131
|
+
isFailedField: we
|
|
130
132
|
};
|
|
131
|
-
return !Object.values(s).some((n) => n !== void 0) &&
|
|
133
|
+
return !Object.values(s).some((n) => n !== void 0) && es(f[0]) ? f.map((n) => ({
|
|
132
134
|
...n,
|
|
133
135
|
timestamp: n.timestamp ? new Date(n.timestamp) : n.timestamp
|
|
134
|
-
})) :
|
|
136
|
+
})) : ts(f, s);
|
|
135
137
|
}, [
|
|
136
138
|
f,
|
|
137
|
-
pe,
|
|
138
139
|
he,
|
|
139
140
|
Me,
|
|
140
141
|
ye,
|
|
@@ -145,32 +146,33 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
145
146
|
ke,
|
|
146
147
|
ve,
|
|
147
148
|
Ee,
|
|
148
|
-
xe,
|
|
149
149
|
Re,
|
|
150
|
+
xe,
|
|
150
151
|
Ae,
|
|
151
152
|
Fe,
|
|
152
|
-
Le
|
|
153
|
+
Le,
|
|
154
|
+
we
|
|
153
155
|
]);
|
|
154
156
|
t.useEffect(() => {
|
|
155
|
-
if (a ===
|
|
156
|
-
|
|
157
|
+
if (a === qe.current && W.current) {
|
|
158
|
+
Pe(W.current);
|
|
157
159
|
return;
|
|
158
160
|
}
|
|
159
161
|
if (a && c.length > 0) {
|
|
160
162
|
const s = c.find(
|
|
161
163
|
(n) => n.author && (n.author.id === a || n.author.id === String(a))
|
|
162
164
|
), e = (s == null ? void 0 : s.author) || { id: a };
|
|
163
|
-
|
|
165
|
+
W.current = e, qe.current = a, Pe(e);
|
|
164
166
|
}
|
|
165
167
|
}, [a, c]);
|
|
166
168
|
const {
|
|
167
169
|
renderedMessages: d,
|
|
168
|
-
handleScrollToBottom:
|
|
170
|
+
handleScrollToBottom: bt,
|
|
169
171
|
handleReferencedMessageClick: z,
|
|
170
|
-
isEndless:
|
|
171
|
-
isOnLastBatch:
|
|
172
|
-
skipAutoScrollRef:
|
|
173
|
-
} =
|
|
172
|
+
isEndless: kt,
|
|
173
|
+
isOnLastBatch: We,
|
|
174
|
+
skipAutoScrollRef: vt
|
|
175
|
+
} = as({
|
|
174
176
|
scrollMode: ut,
|
|
175
177
|
processedMessages: c,
|
|
176
178
|
total: mt,
|
|
@@ -181,42 +183,42 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
181
183
|
onReferencedMessageClick: ht,
|
|
182
184
|
viewItemsWrapperRef: i,
|
|
183
185
|
authorId: a
|
|
184
|
-
}), g = t.useMemo(() => d.length > 0 ?
|
|
185
|
-
if (
|
|
186
|
-
return
|
|
186
|
+
}), g = t.useMemo(() => d.length > 0 ? Wt(d) : [], [d]), Et = t.useMemo(() => !Pt(Ke, { component: "Chat" }), []), Rt = Ut(Ke), ze = t.useMemo(() => {
|
|
187
|
+
if (O)
|
|
188
|
+
return O.find((e) => e.isPinned);
|
|
187
189
|
const s = c.find((e) => e.isPinned);
|
|
188
190
|
if (s)
|
|
189
191
|
return s;
|
|
190
|
-
}, [c,
|
|
191
|
-
|
|
192
|
+
}, [c, O]), E = _t();
|
|
193
|
+
ss({
|
|
192
194
|
viewItemsWrapperRef: i,
|
|
193
|
-
isKeyboardNavigationActiveRef:
|
|
195
|
+
isKeyboardNavigationActiveRef: q,
|
|
194
196
|
processedMessages: d,
|
|
195
197
|
authorId: a,
|
|
196
198
|
autoScrollThreshold: lt,
|
|
197
|
-
isEndless:
|
|
198
|
-
isOnLastBatch:
|
|
199
|
-
skipAutoScrollRef:
|
|
199
|
+
isEndless: kt,
|
|
200
|
+
isOnLastBatch: We,
|
|
201
|
+
skipAutoScrollRef: vt
|
|
200
202
|
});
|
|
201
|
-
const xt =
|
|
202
|
-
clearTimeout(
|
|
203
|
-
}, []),
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
const xt = os({ elementRef: i }), At = t.useCallback(() => {
|
|
204
|
+
clearTimeout(V.current);
|
|
205
|
+
}, []), Ft = t.useCallback(() => {
|
|
206
|
+
V.current = window.setTimeout(() => {
|
|
207
|
+
P(null);
|
|
206
208
|
}, 0);
|
|
207
|
-
}, []),
|
|
208
|
-
|
|
209
|
-
}, []),
|
|
209
|
+
}, []), R = t.useCallback((s) => {
|
|
210
|
+
P(s);
|
|
211
|
+
}, []), Lt = t.useCallback(
|
|
210
212
|
(s) => {
|
|
211
213
|
let e = null;
|
|
212
214
|
const n = u !== null ? u : g.lastSelectionIndex;
|
|
213
|
-
s.keyCode === F.up ? n === null ? e = 0 : n > 0 && (e = n - 1) : s.keyCode === F.down ? n === null ? e = 0 : n < g.lastSelectionIndex && (e = n + 1) : s.keyCode === F.home ? e = 0 : s.keyCode === F.end && (e = g.lastSelectionIndex), e !== null && (
|
|
215
|
+
s.keyCode === F.up ? n === null ? e = 0 : n > 0 && (e = n - 1) : s.keyCode === F.down ? n === null ? e = 0 : n < g.lastSelectionIndex && (e = n + 1) : s.keyCode === F.home ? e = 0 : s.keyCode === F.end && (e = g.lastSelectionIndex), e !== null && (P(e), q.current = !0, s.preventDefault());
|
|
214
216
|
},
|
|
215
217
|
[u, g]
|
|
216
|
-
),
|
|
218
|
+
), Ge = t.useCallback(
|
|
217
219
|
(s, e, n) => {
|
|
218
220
|
var l;
|
|
219
|
-
if (
|
|
221
|
+
if (N && N({
|
|
220
222
|
action: { value: s.value, title: s.title, type: s.type },
|
|
221
223
|
syntheticEvent: e,
|
|
222
224
|
nativeEvent: e.nativeEvent,
|
|
@@ -243,47 +245,47 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
243
245
|
window.open(s.value);
|
|
244
246
|
break;
|
|
245
247
|
}
|
|
246
|
-
(l =
|
|
248
|
+
(l = Ve.current) == null || l.focusInput();
|
|
247
249
|
}
|
|
248
250
|
},
|
|
249
|
-
[
|
|
250
|
-
),
|
|
251
|
+
[N, C, m]
|
|
252
|
+
), wt = t.useCallback(() => He("k-chat", J, { "k-rtl": U }), [J, U]), Bt = t.useCallback(() => {
|
|
251
253
|
const s = g.length - 1;
|
|
252
254
|
return g.map((e, n) => {
|
|
253
|
-
var l, y, S, T, b,
|
|
255
|
+
var l, y, S, T, b, x;
|
|
254
256
|
if (e.type === "date-marker")
|
|
255
|
-
return /* @__PURE__ */ t.createElement(
|
|
257
|
+
return /* @__PURE__ */ t.createElement(Ht, { item: e, key: e.trackBy, timestampTemplate: Y });
|
|
256
258
|
if (e.type === "message-group") {
|
|
257
259
|
const A = {
|
|
258
|
-
allowMessageCollapse:
|
|
259
|
-
messageWidthMode:
|
|
260
|
-
showAvatar:
|
|
261
|
-
showUsername:
|
|
262
|
-
messageTemplate:
|
|
263
|
-
messageContentTemplate:
|
|
264
|
-
messageToolbarActions:
|
|
265
|
-
messageContextMenuActions:
|
|
260
|
+
allowMessageCollapse: ee,
|
|
261
|
+
messageWidthMode: oe,
|
|
262
|
+
showAvatar: ne,
|
|
263
|
+
showUsername: ae,
|
|
264
|
+
messageTemplate: G,
|
|
265
|
+
messageContentTemplate: H,
|
|
266
|
+
messageToolbarActions: te,
|
|
267
|
+
messageContextMenuActions: se,
|
|
266
268
|
fileActions: v
|
|
267
|
-
}, r =
|
|
269
|
+
}, r = ns(
|
|
268
270
|
(l = e == null ? void 0 : e.messages) == null ? void 0 : l[0],
|
|
269
271
|
a,
|
|
270
272
|
A,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
+
le,
|
|
274
|
+
ie
|
|
273
275
|
);
|
|
274
276
|
return /* @__PURE__ */ t.createElement(
|
|
275
|
-
|
|
277
|
+
Kt,
|
|
276
278
|
{
|
|
277
279
|
group: e,
|
|
278
280
|
itemTemplate: r.messageTemplate,
|
|
279
281
|
contentTemplate: r.messageContentTemplate,
|
|
280
|
-
attachmentTemplate:
|
|
282
|
+
attachmentTemplate: I,
|
|
281
283
|
user: m,
|
|
282
284
|
selectedItemIndex: u,
|
|
283
|
-
onRequestSelection:
|
|
285
|
+
onRequestSelection: R,
|
|
284
286
|
isLastGroup: n === s,
|
|
285
287
|
key: (y = e.messages[0].id) != null ? y : e.messages[0].selectionIndex,
|
|
286
|
-
message:
|
|
288
|
+
message: Q,
|
|
287
289
|
allowMessageCollapse: r.allowMessageCollapse,
|
|
288
290
|
messageToolbarActions: r.messageToolbarActions,
|
|
289
291
|
messageContextMenuActions: r.messageContextMenuActions,
|
|
@@ -296,11 +298,11 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
296
298
|
} else {
|
|
297
299
|
if (e.type === "attachment-group")
|
|
298
300
|
return /* @__PURE__ */ t.createElement(
|
|
299
|
-
|
|
301
|
+
Gt,
|
|
300
302
|
{
|
|
301
303
|
group: e,
|
|
302
|
-
itemTemplate:
|
|
303
|
-
onRequestSelection:
|
|
304
|
+
itemTemplate: I,
|
|
305
|
+
onRequestSelection: R,
|
|
304
306
|
selected: e.selectionIndex === u,
|
|
305
307
|
isLastGroup: n === s,
|
|
306
308
|
key: `att-${(T = (S = e.trackBy) == null ? void 0 : S.id) != null ? T : e.selectionIndex}`
|
|
@@ -308,14 +310,14 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
308
310
|
);
|
|
309
311
|
if (e.type === "action-group")
|
|
310
312
|
return /* @__PURE__ */ t.createElement(
|
|
311
|
-
|
|
313
|
+
zt,
|
|
312
314
|
{
|
|
313
315
|
group: e,
|
|
314
|
-
onActionExecute:
|
|
315
|
-
onRequestSelection:
|
|
316
|
+
onActionExecute: Ge,
|
|
317
|
+
onRequestSelection: R,
|
|
316
318
|
selected: e.selectionIndex === u,
|
|
317
|
-
key: `act-${(
|
|
318
|
-
quickActionsLayout:
|
|
319
|
+
key: `act-${(x = (b = e.trackBy) == null ? void 0 : b.id) != null ? x : e.selectionIndex}`,
|
|
320
|
+
quickActionsLayout: X,
|
|
319
321
|
dir: p
|
|
320
322
|
}
|
|
321
323
|
);
|
|
@@ -324,35 +326,35 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
324
326
|
});
|
|
325
327
|
}, [
|
|
326
328
|
g,
|
|
327
|
-
|
|
328
|
-
W,
|
|
329
|
+
Y,
|
|
329
330
|
G,
|
|
330
|
-
|
|
331
|
+
H,
|
|
332
|
+
I,
|
|
331
333
|
m,
|
|
332
334
|
u,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
_,
|
|
335
|
+
R,
|
|
336
|
+
Q,
|
|
336
337
|
ee,
|
|
337
338
|
te,
|
|
338
|
-
v,
|
|
339
339
|
se,
|
|
340
|
+
v,
|
|
340
341
|
oe,
|
|
341
342
|
ne,
|
|
343
|
+
ae,
|
|
342
344
|
a,
|
|
343
|
-
re,
|
|
344
345
|
le,
|
|
345
|
-
|
|
346
|
-
|
|
346
|
+
ie,
|
|
347
|
+
Ge,
|
|
348
|
+
X,
|
|
347
349
|
p
|
|
348
|
-
]),
|
|
350
|
+
]), It = t.useCallback(() => h ? typeof h == "function" ? h() : h : null, [h]), Nt = t.useCallback(() => M ? typeof M == "function" ? M() : M : null, [M]);
|
|
349
351
|
t.useEffect(() => {
|
|
350
|
-
const s = p !== void 0 ? p === "rtl" :
|
|
351
|
-
|
|
352
|
+
const s = p !== void 0 ? p === "rtl" : j.current && getComputedStyle(j.current).direction === "rtl";
|
|
353
|
+
Ct(!!s);
|
|
352
354
|
}, [p]), t.useEffect(() => () => {
|
|
353
|
-
clearTimeout(
|
|
355
|
+
clearTimeout(V.current);
|
|
354
356
|
}, []), t.useEffect(() => {
|
|
355
|
-
if (!
|
|
357
|
+
if (!D || !i.current)
|
|
356
358
|
return;
|
|
357
359
|
let s, e;
|
|
358
360
|
const n = () => {
|
|
@@ -360,9 +362,9 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
360
362
|
const T = i.current;
|
|
361
363
|
if (!T)
|
|
362
364
|
return;
|
|
363
|
-
const { scrollHeight: b, scrollTop:
|
|
364
|
-
!(b > A) || b -
|
|
365
|
-
e = void 0,
|
|
365
|
+
const { scrollHeight: b, scrollTop: x, clientHeight: A } = T;
|
|
366
|
+
!(b > A) || b - x - A <= 100 ? (e !== void 0 && (clearTimeout(e), e = void 0), Ue(!1)) : e != null || (e = setTimeout(() => {
|
|
367
|
+
e = void 0, Ue(!0);
|
|
366
368
|
}, 300));
|
|
367
369
|
}, l = () => {
|
|
368
370
|
s === void 0 && (s = requestAnimationFrame(n));
|
|
@@ -372,51 +374,51 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
372
374
|
return S.observe(y, { childList: !0, subtree: !0, characterData: !0 }), () => {
|
|
373
375
|
y.removeEventListener("scroll", l), S.disconnect(), s !== void 0 && cancelAnimationFrame(s), e !== void 0 && clearTimeout(e);
|
|
374
376
|
};
|
|
375
|
-
}, [
|
|
376
|
-
const
|
|
377
|
-
replyToMessage:
|
|
378
|
-
setReplyToMessage:
|
|
377
|
+
}, [D]);
|
|
378
|
+
const Dt = t.useMemo(() => ({
|
|
379
|
+
replyToMessage: De,
|
|
380
|
+
setReplyToMessage: Oe,
|
|
379
381
|
messages: c,
|
|
380
|
-
repliedToMessages:
|
|
382
|
+
repliedToMessages: Ie,
|
|
381
383
|
user: m,
|
|
382
|
-
internalScrollContainerRef:
|
|
384
|
+
internalScrollContainerRef: je,
|
|
383
385
|
messageListScrollContainerRef: i,
|
|
384
|
-
onToolbarAction:
|
|
385
|
-
onContextMenuAction:
|
|
386
|
-
onFileAction:
|
|
387
|
-
setShowCopyNotification:
|
|
388
|
-
onDownload:
|
|
389
|
-
onResendMessage:
|
|
386
|
+
onToolbarAction: ce,
|
|
387
|
+
onContextMenuAction: ue,
|
|
388
|
+
onFileAction: me,
|
|
389
|
+
setShowCopyNotification: Ne,
|
|
390
|
+
onDownload: de,
|
|
391
|
+
onResendMessage: Be,
|
|
390
392
|
fileActions: v,
|
|
391
|
-
speechToTextConfig:
|
|
392
|
-
uploadConfig:
|
|
393
|
-
statusTemplate:
|
|
394
|
-
userStatusTemplate:
|
|
395
|
-
messageFilesLayout:
|
|
396
|
-
timestampVisibility:
|
|
393
|
+
speechToTextConfig: ge,
|
|
394
|
+
uploadConfig: fe,
|
|
395
|
+
statusTemplate: Z,
|
|
396
|
+
userStatusTemplate: _,
|
|
397
|
+
messageFilesLayout: pe,
|
|
398
|
+
timestampVisibility: re,
|
|
397
399
|
onReferencedMessageClick: z
|
|
398
400
|
}), [
|
|
399
|
-
Ne,
|
|
400
401
|
De,
|
|
402
|
+
Oe,
|
|
401
403
|
c,
|
|
402
|
-
|
|
404
|
+
Ie,
|
|
403
405
|
m,
|
|
404
|
-
ie,
|
|
405
406
|
ce,
|
|
406
407
|
ue,
|
|
407
|
-
Ie,
|
|
408
408
|
me,
|
|
409
|
-
|
|
410
|
-
v,
|
|
409
|
+
Ne,
|
|
411
410
|
de,
|
|
411
|
+
Be,
|
|
412
|
+
v,
|
|
412
413
|
ge,
|
|
413
|
-
Y,
|
|
414
|
-
Z,
|
|
415
414
|
fe,
|
|
416
|
-
|
|
415
|
+
Z,
|
|
416
|
+
_,
|
|
417
|
+
pe,
|
|
418
|
+
re,
|
|
417
419
|
z
|
|
418
420
|
]);
|
|
419
|
-
return /* @__PURE__ */ t.createElement(
|
|
421
|
+
return /* @__PURE__ */ t.createElement(Yt.Provider, { value: Dt }, /* @__PURE__ */ t.createElement(
|
|
420
422
|
"div",
|
|
421
423
|
{
|
|
422
424
|
style: {
|
|
@@ -426,24 +428,24 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
426
428
|
overflow: "hidden",
|
|
427
429
|
...et
|
|
428
430
|
},
|
|
429
|
-
onKeyDown:
|
|
430
|
-
className:
|
|
431
|
+
onKeyDown: Lt,
|
|
432
|
+
className: wt(),
|
|
431
433
|
ref: (s) => {
|
|
432
|
-
|
|
434
|
+
j.current = s, je.current = s, typeof k == "function" ? k(s) : k && (k.current = s);
|
|
433
435
|
},
|
|
434
436
|
...Mt
|
|
435
437
|
},
|
|
436
|
-
h !== void 0 && /* @__PURE__ */ t.createElement(
|
|
438
|
+
h !== void 0 && /* @__PURE__ */ t.createElement(Jt, null, It()),
|
|
437
439
|
/* @__PURE__ */ t.createElement(
|
|
438
440
|
"div",
|
|
439
441
|
{
|
|
440
442
|
className: "k-message-list",
|
|
441
|
-
onBlur:
|
|
442
|
-
onFocus:
|
|
443
|
+
onBlur: Ft,
|
|
444
|
+
onFocus: At,
|
|
443
445
|
role: "log",
|
|
444
446
|
"aria-label": E.toLanguageString(
|
|
445
|
-
|
|
446
|
-
L[
|
|
447
|
+
$e,
|
|
448
|
+
L[$e]
|
|
447
449
|
),
|
|
448
450
|
"aria-live": "polite",
|
|
449
451
|
ref: i,
|
|
@@ -452,7 +454,7 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
452
454
|
}
|
|
453
455
|
},
|
|
454
456
|
ze && /* @__PURE__ */ t.createElement(
|
|
455
|
-
|
|
457
|
+
Qt,
|
|
456
458
|
{
|
|
457
459
|
message: ze,
|
|
458
460
|
onUnpin: at,
|
|
@@ -463,21 +465,21 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
463
465
|
/* @__PURE__ */ t.createElement(
|
|
464
466
|
"div",
|
|
465
467
|
{
|
|
466
|
-
className:
|
|
468
|
+
className: He("k-message-list-content", {
|
|
467
469
|
"k-message-list-content-empty": d.length === 0
|
|
468
470
|
})
|
|
469
471
|
},
|
|
470
|
-
d.length === 0 && M !== void 0 &&
|
|
471
|
-
d.length > 0 &&
|
|
472
|
+
d.length === 0 && M !== void 0 && Nt(),
|
|
473
|
+
d.length > 0 && Bt()
|
|
472
474
|
),
|
|
473
|
-
|
|
474
|
-
|
|
475
|
+
D && (Tt || !We) && /* @__PURE__ */ t.createElement("div", { className: "k-chat-scroll-to-bottom-container" }, /* @__PURE__ */ t.createElement(
|
|
476
|
+
Vt,
|
|
475
477
|
{
|
|
476
|
-
svgIcon:
|
|
478
|
+
svgIcon: qt,
|
|
477
479
|
size: "small",
|
|
478
480
|
themeColor: "base",
|
|
479
481
|
rounded: "full",
|
|
480
|
-
onClick:
|
|
482
|
+
onClick: bt,
|
|
481
483
|
"aria-label": E.toLanguageString(
|
|
482
484
|
w,
|
|
483
485
|
L[w]
|
|
@@ -491,7 +493,7 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
491
493
|
),
|
|
492
494
|
xt && /* @__PURE__ */ t.createElement("div", { className: "k-separator" }),
|
|
493
495
|
/* @__PURE__ */ t.createElement(
|
|
494
|
-
|
|
496
|
+
$t,
|
|
495
497
|
{
|
|
496
498
|
onSendMessage: (s, e) => {
|
|
497
499
|
C && C({
|
|
@@ -502,20 +504,20 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
502
504
|
});
|
|
503
505
|
},
|
|
504
506
|
onSuggestionClick: (s) => {
|
|
505
|
-
|
|
507
|
+
K && K(s);
|
|
506
508
|
},
|
|
507
|
-
isDirectionRightToLeft:
|
|
508
|
-
ref:
|
|
509
|
+
isDirectionRightToLeft: U,
|
|
510
|
+
ref: Ve,
|
|
509
511
|
placeholder: _e,
|
|
510
512
|
MessageBox: Ze,
|
|
511
513
|
suggestions: tt,
|
|
512
514
|
suggestionTemplate: st,
|
|
513
515
|
inputValue: nt,
|
|
514
516
|
onInputValueChange: (s) => {
|
|
515
|
-
|
|
517
|
+
$ && $(s);
|
|
516
518
|
},
|
|
517
519
|
onInputClick: () => {
|
|
518
|
-
|
|
520
|
+
q.current = !1;
|
|
519
521
|
},
|
|
520
522
|
sendButtonConfig: rt,
|
|
521
523
|
suggestionsLayout: ot,
|
|
@@ -525,20 +527,20 @@ const Je = t.forwardRef((Qe, k) => {
|
|
|
525
527
|
}
|
|
526
528
|
),
|
|
527
529
|
/* @__PURE__ */ t.createElement(
|
|
528
|
-
|
|
530
|
+
Xt,
|
|
529
531
|
{
|
|
530
|
-
show:
|
|
532
|
+
show: St,
|
|
531
533
|
text: E.toLanguageString(
|
|
532
|
-
|
|
533
|
-
L[
|
|
534
|
+
Je,
|
|
535
|
+
L[Je]
|
|
534
536
|
)
|
|
535
537
|
}
|
|
536
538
|
),
|
|
537
|
-
|
|
539
|
+
Et && /* @__PURE__ */ t.createElement(jt, { message: Rt })
|
|
538
540
|
));
|
|
539
541
|
});
|
|
540
|
-
|
|
541
|
-
|
|
542
|
+
Qe.displayName = "Chat";
|
|
543
|
+
Qe.propTypes = {
|
|
542
544
|
messages: o.arrayOf(o.object),
|
|
543
545
|
user: o.object,
|
|
544
546
|
messageTemplate: o.any,
|
|
@@ -570,5 +572,5 @@ Je.propTypes = {
|
|
|
570
572
|
onReferencedMessageClick: o.func
|
|
571
573
|
};
|
|
572
574
|
export {
|
|
573
|
-
|
|
575
|
+
Qe as Chat
|
|
574
576
|
};
|