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