@progress/kendo-react-conversational-ui 11.4.0 → 12.0.0-develop.1
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/views/AIPromptView.js +2 -2
- package/ai-prompt/views/AIPromptView.mjs +26 -26
- package/chat/components/Action.js +8 -0
- package/chat/components/Action.mjs +37 -0
- package/chat/components/ActionGroup.js +8 -0
- package/chat/components/ActionGroup.mjs +56 -0
- package/chat/components/Attachment.js +8 -0
- package/chat/components/Attachment.mjs +23 -0
- package/chat/components/AttachmentGroup.js +8 -0
- package/chat/components/AttachmentGroup.mjs +66 -0
- package/chat/components/Chat.js +8 -0
- package/chat/components/Chat.mjs +388 -0
- package/chat/components/ChatContext.js +8 -0
- package/{components/base/FocusableUponSelection.mjs → chat/components/ChatContext.mjs} +10 -10
- package/chat/components/ChatMessage.js +8 -0
- package/chat/components/ChatMessage.mjs +284 -0
- package/chat/components/DateMarker.js +8 -0
- package/chat/components/DateMarker.mjs +22 -0
- package/chat/components/Header.js +8 -0
- package/{utils.mjs → chat/components/Header.mjs} +4 -2
- package/chat/components/MessageGroup.js +8 -0
- package/chat/components/MessageGroup.mjs +88 -0
- package/chat/components/NewMessage.js +8 -0
- package/chat/components/NewMessage.mjs +264 -0
- package/chat/components/Notification.js +8 -0
- package/chat/components/Notification.mjs +24 -0
- package/chat/components/SuggestionsGroup.js +1 -1
- package/chat/components/SuggestionsGroup.mjs +40 -23
- package/chat/components/elements/FileBox.js +8 -0
- package/chat/components/elements/FileBox.mjs +69 -0
- package/chat/components/elements/PinnedMessage.js +8 -0
- package/chat/components/elements/PinnedMessage.mjs +46 -0
- package/chat/components/templates/HeroCard.js +8 -0
- package/chat/components/templates/HeroCard.mjs +26 -0
- package/chat/utils/fieldMapping.js +8 -0
- package/chat/utils/fieldMapping.mjs +79 -0
- package/chat/utils.js +8 -0
- package/chat/utils.mjs +65 -0
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/index.d.mts +423 -165
- package/index.d.ts +423 -165
- package/index.js +1 -1
- package/index.mjs +34 -27
- package/messages/index.js +1 -1
- package/messages/index.mjs +38 -16
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +7 -7
- package/components/Action.js +0 -8
- package/components/Action.mjs +0 -45
- package/components/ActionGroup.js +0 -8
- package/components/ActionGroup.mjs +0 -36
- package/components/Attachment.js +0 -8
- package/components/Attachment.mjs +0 -50
- package/components/AttachmentGroup.js +0 -8
- package/components/AttachmentGroup.mjs +0 -64
- package/components/Chat.js +0 -8
- package/components/Chat.mjs +0 -214
- package/components/ChatMessage.js +0 -8
- package/components/ChatMessage.mjs +0 -63
- package/components/ChatToolbar.js +0 -8
- package/components/ChatToolbar.mjs +0 -33
- package/components/DateMarker.js +0 -8
- package/components/DateMarker.mjs +0 -19
- package/components/MessageGroup.js +0 -8
- package/components/MessageGroup.mjs +0 -67
- package/components/NewMessage.js +0 -8
- package/components/NewMessage.mjs +0 -106
- package/components/base/FocusableUponSelection.js +0 -8
- package/components/base/SelectableItemsContainer.js +0 -8
- package/components/base/SelectableItemsContainer.mjs +0 -42
- package/components/templates/HeroCard.js +0 -8
- package/components/templates/HeroCard.mjs +0 -44
- package/utils.js +0 -8
- /package/{ViewItem.js → chat/ViewItem.js} +0 -0
- /package/{ViewItem.mjs → chat/ViewItem.mjs} +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { classNames as v } from "@progress/kendo-react-common";
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
import { Button as N, SpeechToTextButton as le } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { Upload as re } from "@progress/kendo-react-upload";
|
|
12
|
+
import { SuggestionGroup as ce } from "./SuggestionsGroup.mjs";
|
|
13
|
+
import { InputSuffix as ue, TextArea as ie } from "@progress/kendo-react-inputs";
|
|
14
|
+
import { xIcon as me, paperPlaneIcon as fe, paperclipIcon as pe } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { useChatContext as ge } from "./ChatContext.mjs";
|
|
16
|
+
import { useLocalization as de } from "@progress/kendo-react-intl";
|
|
17
|
+
import { getDeletedMessageText as ke, isAuthor as he } from "../utils.mjs";
|
|
18
|
+
import { closeReply as Z, messages as E, newMessageSendButton as _, attachFile as ee, newMessageMessageInput as te } from "../../messages/index.mjs";
|
|
19
|
+
import be from "./elements/FileBox.mjs";
|
|
20
|
+
const Ce = e.forwardRef((se, ae) => {
|
|
21
|
+
const {
|
|
22
|
+
onSendMessage: S,
|
|
23
|
+
isDirectionRightToLeft: B,
|
|
24
|
+
placeholder: R,
|
|
25
|
+
MessageBox: D,
|
|
26
|
+
suggestions: y,
|
|
27
|
+
onSuggestionClick: ne,
|
|
28
|
+
inputValue: g,
|
|
29
|
+
onInputValueChange: m,
|
|
30
|
+
suggestionTemplate: oe,
|
|
31
|
+
sendButtonConfig: F
|
|
32
|
+
} = se, { replyToMessage: a, setReplyToMessage: d, user: k, messageListScrollContainerRef: i, speechToTextConfig: h, uploadConfig: M } = ge(), [z] = e.useState(!1), [n, b] = e.useState(void 0), [o, w] = e.useState([]), [L, K] = e.useState(!1), f = e.useRef(null), T = e.useRef(null), l = de(), u = e.useCallback(() => {
|
|
33
|
+
f.current !== null && f.current.focus();
|
|
34
|
+
}, []);
|
|
35
|
+
e.useEffect(() => {
|
|
36
|
+
g !== void 0 && g !== n && (b(g), u());
|
|
37
|
+
}, [g, n, u]), e.useEffect(() => {
|
|
38
|
+
a && u();
|
|
39
|
+
}, [a, u]), e.useLayoutEffect(() => {
|
|
40
|
+
L && (i != null && i.current) && (i.current.scrollTop = i.current.scrollHeight - i.current.clientHeight, K(!1));
|
|
41
|
+
}, [L, i]);
|
|
42
|
+
const A = e.useCallback(
|
|
43
|
+
(t) => {
|
|
44
|
+
const s = t.value;
|
|
45
|
+
b(s), m && m(s);
|
|
46
|
+
},
|
|
47
|
+
[m]
|
|
48
|
+
), p = e.useMemo(
|
|
49
|
+
() => !!(n != null && n.trim() || o.length > 0),
|
|
50
|
+
[n, o.length]
|
|
51
|
+
), C = e.useCallback(
|
|
52
|
+
(t) => {
|
|
53
|
+
if (t.preventDefault(), S) {
|
|
54
|
+
const s = n;
|
|
55
|
+
if (p) {
|
|
56
|
+
const r = {
|
|
57
|
+
id: "",
|
|
58
|
+
author: k,
|
|
59
|
+
text: s || "",
|
|
60
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
61
|
+
replyToId: a ? a.id : void 0,
|
|
62
|
+
files: o.map((c) => ({
|
|
63
|
+
name: c.name,
|
|
64
|
+
size: c.size,
|
|
65
|
+
type: c.extension,
|
|
66
|
+
rawFile: c.getRawFile ? c.getRawFile() : c
|
|
67
|
+
}))
|
|
68
|
+
};
|
|
69
|
+
d(null), S(r, t), w([]), b(""), m && m(""), K(!0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[
|
|
74
|
+
S,
|
|
75
|
+
n,
|
|
76
|
+
k,
|
|
77
|
+
a,
|
|
78
|
+
o,
|
|
79
|
+
d,
|
|
80
|
+
m,
|
|
81
|
+
p
|
|
82
|
+
]
|
|
83
|
+
), P = e.useCallback(
|
|
84
|
+
(t) => {
|
|
85
|
+
if (!(t.key === "Enter" && t.shiftKey))
|
|
86
|
+
switch (t.key) {
|
|
87
|
+
case "Enter":
|
|
88
|
+
return t.preventDefault(), C(t);
|
|
89
|
+
case "Escape":
|
|
90
|
+
f.current && f.current.blur();
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
[C]
|
|
97
|
+
);
|
|
98
|
+
e.useImperativeHandle(
|
|
99
|
+
ae,
|
|
100
|
+
() => ({
|
|
101
|
+
focusInput: u
|
|
102
|
+
}),
|
|
103
|
+
[u]
|
|
104
|
+
);
|
|
105
|
+
const H = e.useCallback((t) => {
|
|
106
|
+
w((s) => s.filter((r) => r.name !== t));
|
|
107
|
+
}, []), U = e.useCallback(() => /* @__PURE__ */ e.createElement(be, { files: o, onFileRemove: H, renderInTextarea: !0 }), [o, H]), V = e.useCallback(
|
|
108
|
+
(t, s) => t.isDeleted ? ke(s, l) : t.text,
|
|
109
|
+
[l]
|
|
110
|
+
), j = e.useCallback(() => {
|
|
111
|
+
if (a) {
|
|
112
|
+
const t = he(k, a);
|
|
113
|
+
return /* @__PURE__ */ e.createElement(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: v(
|
|
117
|
+
"k-message-reference",
|
|
118
|
+
t ? "k-message-reference-sender" : "k-message-reference-receiver"
|
|
119
|
+
)
|
|
120
|
+
},
|
|
121
|
+
/* @__PURE__ */ e.createElement("div", { className: "k-message-reference-content" }, V(a, t)),
|
|
122
|
+
/* @__PURE__ */ e.createElement("span", { className: "k-spacer" }),
|
|
123
|
+
/* @__PURE__ */ e.createElement(
|
|
124
|
+
N,
|
|
125
|
+
{
|
|
126
|
+
fillMode: "flat",
|
|
127
|
+
themeColor: "base",
|
|
128
|
+
svgIcon: me,
|
|
129
|
+
onClick: () => d(null),
|
|
130
|
+
"aria-label": l.toLanguageString(Z, E[Z])
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}, [a, k, V, d, l]), G = e.useCallback(
|
|
137
|
+
(t) => {
|
|
138
|
+
try {
|
|
139
|
+
const s = Array.from(t.newState);
|
|
140
|
+
w((r) => [...r, ...s]), u();
|
|
141
|
+
} catch {
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
[u]
|
|
145
|
+
), $ = e.useCallback(() => {
|
|
146
|
+
T.current && T.current.actionElement.click();
|
|
147
|
+
}, []), q = e.useCallback((t) => {
|
|
148
|
+
}, []), J = e.useCallback((t) => {
|
|
149
|
+
const { isFinal: s, alternatives: r } = t;
|
|
150
|
+
if (r.length > 0) {
|
|
151
|
+
const c = r[0];
|
|
152
|
+
s && b((x) => (x ? `${x} ` : "") + c.transcript);
|
|
153
|
+
}
|
|
154
|
+
}, []), O = e.useCallback(() => /* @__PURE__ */ e.createElement(e.Fragment, null, o.length > 0 && U(), a && /* @__PURE__ */ e.createElement("span", { className: "k-input-prefix k-input-prefix-horizontal" }, j())), [o.length, a, U, j]), Q = e.useCallback((t) => {
|
|
155
|
+
t.preventDefault();
|
|
156
|
+
}, []), W = e.useCallback((t) => {
|
|
157
|
+
t.key === "Escape" && t.currentTarget.blur();
|
|
158
|
+
}, []), I = e.useMemo(
|
|
159
|
+
() => /* @__PURE__ */ e.createElement(
|
|
160
|
+
N,
|
|
161
|
+
{
|
|
162
|
+
rounded: "full",
|
|
163
|
+
fillMode: "solid",
|
|
164
|
+
themeColor: "primary",
|
|
165
|
+
className: "k-chat-send",
|
|
166
|
+
icon: "paper-plane",
|
|
167
|
+
svgIcon: fe,
|
|
168
|
+
onClick: C,
|
|
169
|
+
onMouseDown: Q,
|
|
170
|
+
onKeyDown: W,
|
|
171
|
+
"aria-label": l.toLanguageString(_, E[_]),
|
|
172
|
+
dir: B ? "rtl" : void 0,
|
|
173
|
+
disabled: !p,
|
|
174
|
+
"aria-disabled": !p,
|
|
175
|
+
...F
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
[
|
|
179
|
+
C,
|
|
180
|
+
Q,
|
|
181
|
+
W,
|
|
182
|
+
l,
|
|
183
|
+
B,
|
|
184
|
+
p,
|
|
185
|
+
F
|
|
186
|
+
]
|
|
187
|
+
), X = e.useCallback(() => {
|
|
188
|
+
const t = typeof h == "object" ? h : void 0, s = typeof M == "object" ? M : {}, { className: r, ...c } = s, x = v("k-hidden", r);
|
|
189
|
+
return /* @__PURE__ */ e.createElement(ue, null, h !== !1 && /* @__PURE__ */ e.createElement(
|
|
190
|
+
le,
|
|
191
|
+
{
|
|
192
|
+
fillMode: "clear",
|
|
193
|
+
themeColor: "base",
|
|
194
|
+
onError: q,
|
|
195
|
+
onResult: J,
|
|
196
|
+
...t
|
|
197
|
+
}
|
|
198
|
+
), /* @__PURE__ */ e.createElement(
|
|
199
|
+
N,
|
|
200
|
+
{
|
|
201
|
+
key: "attach-file",
|
|
202
|
+
fillMode: "clear",
|
|
203
|
+
themeColor: "base",
|
|
204
|
+
svgIcon: pe,
|
|
205
|
+
onClick: $,
|
|
206
|
+
"aria-label": l.toLanguageString(ee, E[ee])
|
|
207
|
+
}
|
|
208
|
+
), /* @__PURE__ */ e.createElement(
|
|
209
|
+
re,
|
|
210
|
+
{
|
|
211
|
+
ref: T,
|
|
212
|
+
files: o,
|
|
213
|
+
onAdd: G,
|
|
214
|
+
multiple: !0,
|
|
215
|
+
autoUpload: !1,
|
|
216
|
+
...c,
|
|
217
|
+
className: x
|
|
218
|
+
}
|
|
219
|
+
), /* @__PURE__ */ e.createElement("span", { className: "k-spacer" }), I);
|
|
220
|
+
}, [
|
|
221
|
+
h,
|
|
222
|
+
M,
|
|
223
|
+
o,
|
|
224
|
+
q,
|
|
225
|
+
J,
|
|
226
|
+
$,
|
|
227
|
+
G,
|
|
228
|
+
l,
|
|
229
|
+
I
|
|
230
|
+
]), Y = e.useMemo(
|
|
231
|
+
() => /* @__PURE__ */ e.createElement(
|
|
232
|
+
ie,
|
|
233
|
+
{
|
|
234
|
+
className: v("k-message-box", "!k-flex-col", { "k-focus": z }),
|
|
235
|
+
resizable: "none",
|
|
236
|
+
rows: 1,
|
|
237
|
+
placeholder: R,
|
|
238
|
+
value: n,
|
|
239
|
+
onChange: A,
|
|
240
|
+
onKeyDown: P,
|
|
241
|
+
prefix: O,
|
|
242
|
+
suffix: X,
|
|
243
|
+
ref: f,
|
|
244
|
+
"aria-label": l.toLanguageString(
|
|
245
|
+
te,
|
|
246
|
+
E[te]
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
[z, R, n, A, P, O, X, l]
|
|
251
|
+
);
|
|
252
|
+
return /* @__PURE__ */ e.createElement("div", { className: "k-message-box-wrapper" }, y && y.length > 0 && /* @__PURE__ */ e.createElement(
|
|
253
|
+
ce,
|
|
254
|
+
{
|
|
255
|
+
onSuggestionClick: ne,
|
|
256
|
+
suggestions: y,
|
|
257
|
+
suggestionTemplate: oe
|
|
258
|
+
}
|
|
259
|
+
), D ? /* @__PURE__ */ e.createElement(D, { messageInput: Y, sendButton: I }) : Y);
|
|
260
|
+
});
|
|
261
|
+
Ce.displayName = "NewMessage";
|
|
262
|
+
export {
|
|
263
|
+
Ce as default
|
|
264
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";const a=require("react"),c=require("@progress/kendo-react-animation"),i=require("@progress/kendo-react-notification");function s(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const r=s(a),l=e=>{const{show:t,text:n}=e,o=()=>({position:"absolute",top:"90%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,pointerEvents:t?"auto":"none"});return r.createElement("div",{style:o()},r.createElement(c.Fade,null,t&&r.createElement(i.Notification,{type:{style:"dark"},closable:!1},r.createElement("span",null,n))))};module.exports=l;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import { Fade as r } from "@progress/kendo-react-animation";
|
|
10
|
+
import { Notification as l } from "@progress/kendo-react-notification";
|
|
11
|
+
const c = (o) => {
|
|
12
|
+
const { show: e, text: n } = o, a = () => ({
|
|
13
|
+
position: "absolute",
|
|
14
|
+
top: "90%",
|
|
15
|
+
left: "50%",
|
|
16
|
+
transform: "translate(-50%, -50%)",
|
|
17
|
+
zIndex: 1e3,
|
|
18
|
+
pointerEvents: e ? "auto" : "none"
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ t.createElement("div", { style: a() }, /* @__PURE__ */ t.createElement(r, null, e && /* @__PURE__ */ t.createElement(l, { type: { style: "dark" }, closable: !1 }, /* @__PURE__ */ t.createElement("span", null, n))));
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
c as default
|
|
24
|
+
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),b=require("@progress/kendo-react-common");function p(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(a,t,l.get?l:{enumerable:!0,get:()=>r[t]})}}return a.default=r,Object.freeze(a)}const c=p(i),u=r=>{const{suggestions:a,onSuggestionClick:t,suggestionsView:l,suggestionTemplate:n}=r,o=c.useCallback((e,d)=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),t==null||t(d))},[t]),s=c.useCallback(()=>a.map(e=>n?c.createElement(n,{key:e.id,suggestion:e,onClick:()=>{t==null||t(e)}}):c.createElement("span",{role:"button",tabIndex:e.disabled?-1:0,"aria-label":e.description,"aria-disabled":e.disabled,onClick:()=>!e.disabled&&(t==null?void 0:t(e)),onKeyDown:d=>!e.disabled&&o(d,e),key:e.id,title:e.description,className:b.classNames(l==="classic"?"k-prompt-suggestion":"k-suggestion",{"k-disabled":e.disabled})},e.text)),[a,n,t,l,o]);return!a||a.length===0?null:l==="classic"?s():c.createElement("div",{role:"group",className:"k-suggestion-group"},s())};exports.SuggestionGroup=u;
|
|
@@ -5,30 +5,47 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { classNames as
|
|
10
|
-
const
|
|
11
|
-
const { suggestions:
|
|
12
|
-
(e
|
|
13
|
-
|
|
14
|
-
"span",
|
|
15
|
-
{
|
|
16
|
-
role: "button",
|
|
17
|
-
tabIndex: e.disabled ? -1 : 0,
|
|
18
|
-
"aria-label": e.description,
|
|
19
|
-
"aria-disabled": e.disabled,
|
|
20
|
-
onClick: (a) => !e.disabled && l(a, e),
|
|
21
|
-
onKeyDown: (a) => !e.disabled && t(a, e),
|
|
22
|
-
key: e.id,
|
|
23
|
-
title: e.description,
|
|
24
|
-
className: c(r === "classic" ? "k-prompt-suggestion" : "k-suggestion", {
|
|
25
|
-
"k-disabled": e.disabled
|
|
26
|
-
})
|
|
8
|
+
import * as l from "react";
|
|
9
|
+
import { classNames as b } from "@progress/kendo-react-common";
|
|
10
|
+
const n = (m) => {
|
|
11
|
+
const { suggestions: r, onSuggestionClick: a, suggestionsView: d, suggestionTemplate: t } = m, c = l.useCallback(
|
|
12
|
+
(e, s) => {
|
|
13
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a == null || a(s));
|
|
27
14
|
},
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
|
|
15
|
+
[a]
|
|
16
|
+
), p = l.useCallback(
|
|
17
|
+
() => r.map(
|
|
18
|
+
(e) => t ? /* @__PURE__ */ l.createElement(
|
|
19
|
+
t,
|
|
20
|
+
{
|
|
21
|
+
key: e.id,
|
|
22
|
+
suggestion: e,
|
|
23
|
+
onClick: () => {
|
|
24
|
+
a == null || a(e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
) : /* @__PURE__ */ l.createElement(
|
|
28
|
+
"span",
|
|
29
|
+
{
|
|
30
|
+
role: "button",
|
|
31
|
+
tabIndex: e.disabled ? -1 : 0,
|
|
32
|
+
"aria-label": e.description,
|
|
33
|
+
"aria-disabled": e.disabled,
|
|
34
|
+
onClick: () => !e.disabled && (a == null ? void 0 : a(e)),
|
|
35
|
+
onKeyDown: (s) => !e.disabled && c(s, e),
|
|
36
|
+
key: e.id,
|
|
37
|
+
title: e.description,
|
|
38
|
+
className: b(d === "classic" ? "k-prompt-suggestion" : "k-suggestion", {
|
|
39
|
+
"k-disabled": e.disabled
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
e.text
|
|
43
|
+
)
|
|
44
|
+
),
|
|
45
|
+
[r, t, a, d, c]
|
|
46
|
+
);
|
|
47
|
+
return !r || r.length === 0 ? null : d === "classic" ? p() : /* @__PURE__ */ l.createElement("div", { role: "group", className: "k-suggestion-group" }, p());
|
|
31
48
|
};
|
|
32
49
|
export {
|
|
33
|
-
|
|
50
|
+
n as SuggestionGroup
|
|
34
51
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";const v=require("react"),f=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-svg-icons"),C=require("@progress/kendo-react-intl"),a=require("../../../messages/index.js");function F(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(i,n,c.get?c:{enumerable:!0,get:()=>r[n]})}}return i.default=r,Object.freeze(i)}const o=F(v),M=r=>{const{files:i,onFileRemove:n,onFileAction:c,onDownload:m,fileActions:I,renderInTextarea:k=!1}=r,u=C.useLocalization(),h=[{id:"download",label:"Download",svgIcon:l.downloadIcon}],d=I||h,x=e=>{if(e==null)return"";if(e===0)return"0 B";const s=1024,t=["B","KB","MB","GB","TB"],p=Math.floor(Math.log(e)/Math.log(s));return`${parseFloat((e/Math.pow(s,p)).toFixed(2))} ${t[p]}`},B=e=>"."+e.split(".").pop()||"",E=(e,s)=>{e.item.id==="download"&&(m==null||m([s])),c==null||c(e.item,e,s)},b=e=>k?o.createElement(g.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:t=>{t.stopPropagation(),n==null||n(e.name)},"aria-label":`${u.toLanguageString(a.removeFile,a.messages[a.removeFile])} ${e.name}`}):"uid"in e||!("rawFile"in e)?d.length>0&&o.createElement(g.DropDownButton,{fillMode:"flat",themeColor:"base",svgIcon:l.moreVerticalIcon,onItemClick:t=>E(t,e),items:d.map(t=>({id:t.id,icon:t.icon,text:t.label,svgIcon:t.svgIcon})),"aria-label":`${u.toLanguageString(a.fileActions,a.messages[a.fileActions])} ${e.name}`}):o.createElement(g.Button,{fillMode:"flat",themeColor:"base",svgIcon:l.xIcon,onClick:t=>{t.stopPropagation(),n==null||n(e.name)},"aria-label":`${u.toLanguageString(a.removeFile,a.messages[a.removeFile])} ${e.name}`});return o.createElement("ul",{className:"k-chat-file-wrapper"},i.map(e=>o.createElement("li",{key:e.name,className:"k-chat-file"},o.createElement(f.IconWrap,{size:"xxlarge",...f.getFileExtensionIcon(B(e.name))}),o.createElement("div",{className:"k-chat-file-info"},o.createElement("span",{className:"k-chat-file-name"},e.name),o.createElement("span",{className:"k-chat-file-size"},x(e.size))),b(e))))};module.exports=M;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as a from "react";
|
|
9
|
+
import { IconWrap as $, getFileExtensionIcon as F } from "@progress/kendo-react-common";
|
|
10
|
+
import { Button as p, DropDownButton as M } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { xIcon as d, moreVerticalIcon as w, downloadIcon as z } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { useLocalization as v } from "@progress/kendo-react-intl";
|
|
13
|
+
import { removeFile as r, messages as c, fileActions as f } from "../../../messages/index.mjs";
|
|
14
|
+
const D = (u) => {
|
|
15
|
+
const { files: h, onFileRemove: o, onFileAction: i, onDownload: l, fileActions: I, renderInTextarea: k = !1 } = u, s = v(), m = I || [{ id: "download", label: "Download", svgIcon: z }], E = (e) => {
|
|
16
|
+
if (e == null)
|
|
17
|
+
return "";
|
|
18
|
+
if (e === 0)
|
|
19
|
+
return "0 B";
|
|
20
|
+
const n = 1024, t = ["B", "KB", "MB", "GB", "TB"], g = Math.floor(Math.log(e) / Math.log(n));
|
|
21
|
+
return `${parseFloat((e / Math.pow(n, g)).toFixed(2))} ${t[g]}`;
|
|
22
|
+
}, x = (e) => "." + e.split(".").pop() || "", B = (e, n) => {
|
|
23
|
+
e.item.id === "download" && (l == null || l([n])), i == null || i(e.item, e, n);
|
|
24
|
+
}, C = (e) => k ? /* @__PURE__ */ a.createElement(
|
|
25
|
+
p,
|
|
26
|
+
{
|
|
27
|
+
fillMode: "flat",
|
|
28
|
+
themeColor: "base",
|
|
29
|
+
svgIcon: d,
|
|
30
|
+
onClick: (t) => {
|
|
31
|
+
t.stopPropagation(), o == null || o(e.name);
|
|
32
|
+
},
|
|
33
|
+
"aria-label": `${s.toLanguageString(r, c[r])} ${e.name}`
|
|
34
|
+
}
|
|
35
|
+
) : "uid" in e || !("rawFile" in e) ? m.length > 0 && /* @__PURE__ */ a.createElement(
|
|
36
|
+
M,
|
|
37
|
+
{
|
|
38
|
+
fillMode: "flat",
|
|
39
|
+
themeColor: "base",
|
|
40
|
+
svgIcon: w,
|
|
41
|
+
onItemClick: (t) => B(t, e),
|
|
42
|
+
items: m.map((t) => ({
|
|
43
|
+
id: t.id,
|
|
44
|
+
icon: t.icon,
|
|
45
|
+
text: t.label,
|
|
46
|
+
svgIcon: t.svgIcon
|
|
47
|
+
})),
|
|
48
|
+
"aria-label": `${s.toLanguageString(
|
|
49
|
+
f,
|
|
50
|
+
c[f]
|
|
51
|
+
)} ${e.name}`
|
|
52
|
+
}
|
|
53
|
+
) : /* @__PURE__ */ a.createElement(
|
|
54
|
+
p,
|
|
55
|
+
{
|
|
56
|
+
fillMode: "flat",
|
|
57
|
+
themeColor: "base",
|
|
58
|
+
svgIcon: d,
|
|
59
|
+
onClick: (t) => {
|
|
60
|
+
t.stopPropagation(), o == null || o(e.name);
|
|
61
|
+
},
|
|
62
|
+
"aria-label": `${s.toLanguageString(r, c[r])} ${e.name}`
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
return /* @__PURE__ */ a.createElement("ul", { className: "k-chat-file-wrapper" }, h.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-chat-file" }, /* @__PURE__ */ a.createElement($, { size: "xxlarge", ...F(x(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-chat-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-chat-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-chat-file-size" }, E(e.size))), C(e))));
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
D as default
|
|
69
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";const g=require("react"),p=require("@progress/kendo-react-common"),m=require("@progress/kendo-react-buttons"),i=require("@progress/kendo-svg-icons"),k=require("@progress/kendo-react-intl"),a=require("../../utils.js"),f=require("../ChatContext.js");function C(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const c=C(g),v=n=>{const{message:e,onUnpin:t,user:o}=n,l=k.useLocalization(),{internalScrollContainerRef:r}=f.useChatContext(),u=c.useCallback(s=>{s.preventDefault(),s.stopPropagation();const d=r==null?void 0:r.current;a.scrollToMessageById(e.id,d)},[e.id,r]);return c.createElement("div",{className:"k-message-reference k-message-reference-receiver k-message-pinned",onClick:u},c.createElement(p.IconWrap,{size:"xlarge",icon:i.pinIcon}),c.createElement("div",{className:"k-message-reference-content"},e!=null&&e.isDeleted?o&&a.getDeletedMessageText(a.isAuthor(o,e),l):e==null?void 0:e.text),c.createElement("span",{className:"k-spacer"}),c.createElement(m.Button,{svgIcon:i.xIcon,onClick:s=>{s.stopPropagation(),t==null||t(e)}}))};module.exports=v;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import { IconWrap as l } from "@progress/kendo-react-common";
|
|
10
|
+
import { Button as p } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { pinIcon as d, xIcon as f } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { useLocalization as g } from "@progress/kendo-react-intl";
|
|
13
|
+
import { scrollToMessageById as u, getDeletedMessageText as k, isAuthor as v } from "../../utils.mjs";
|
|
14
|
+
import { useChatContext as x } from "../ChatContext.mjs";
|
|
15
|
+
const z = (n) => {
|
|
16
|
+
const { message: e, onUnpin: a, user: s } = n, c = g(), { internalScrollContainerRef: o } = x(), i = t.useCallback(
|
|
17
|
+
(r) => {
|
|
18
|
+
r.preventDefault(), r.stopPropagation();
|
|
19
|
+
const m = o == null ? void 0 : o.current;
|
|
20
|
+
u(e.id, m);
|
|
21
|
+
},
|
|
22
|
+
[e.id, o]
|
|
23
|
+
);
|
|
24
|
+
return /* @__PURE__ */ t.createElement(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: "k-message-reference k-message-reference-receiver k-message-pinned",
|
|
28
|
+
onClick: i
|
|
29
|
+
},
|
|
30
|
+
/* @__PURE__ */ t.createElement(l, { size: "xlarge", icon: d }),
|
|
31
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, e != null && e.isDeleted ? s && k(v(s, e), c) : e == null ? void 0 : e.text),
|
|
32
|
+
/* @__PURE__ */ t.createElement("span", { className: "k-spacer" }),
|
|
33
|
+
/* @__PURE__ */ t.createElement(
|
|
34
|
+
p,
|
|
35
|
+
{
|
|
36
|
+
svgIcon: f,
|
|
37
|
+
onClick: (r) => {
|
|
38
|
+
r.stopPropagation(), a == null || a(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
z as default
|
|
46
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),b=require("@progress/kendo-react-buttons");function f(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const c=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,c.get?c:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const e=f(k),v=t=>{const{imageUrl:n,imageMaxWidth:a,title:c,subtitle:i,actions:o,onActionExecute:s,altText:m}=t,d=e.useCallback((r,l)=>{s==null||s({action:r,syntheticEvent:l,nativeEvent:l.nativeEvent,target:l.currentTarget})},[s]),u=m||c||"";return e.createElement("div",{className:"k-card"},e.createElement("img",{className:"k-card-image",src:n,style:{maxWidth:a},alt:u}),e.createElement("div",{className:"k-card-body"},c&&e.createElement("h5",{className:"k-card-title"},c),i&&e.createElement("h6",{className:"k-card-subtitle"},i)),e.createElement("div",{className:"k-card-actions k-card-actions-vertical"},o.map((r,l)=>e.createElement("span",{className:"k-card-action",key:`action-${l}-${r.title||r.value||l}`},e.createElement(b.Button,{fillMode:"flat",onClick:g=>d(r,g)},r.title)))))};exports.HeroCard=v;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as e from "react";
|
|
9
|
+
import { Button as v } from "@progress/kendo-react-buttons";
|
|
10
|
+
const N = (s) => {
|
|
11
|
+
const { imageUrl: m, imageMaxWidth: i, title: l, subtitle: r, actions: n, onActionExecute: c, altText: d } = s, o = e.useCallback(
|
|
12
|
+
(t, a) => {
|
|
13
|
+
c == null || c({
|
|
14
|
+
action: t,
|
|
15
|
+
syntheticEvent: a,
|
|
16
|
+
nativeEvent: a.nativeEvent,
|
|
17
|
+
target: a.currentTarget
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
[c]
|
|
21
|
+
), k = d || l || "";
|
|
22
|
+
return /* @__PURE__ */ e.createElement("div", { className: "k-card" }, /* @__PURE__ */ e.createElement("img", { className: "k-card-image", src: m, style: { maxWidth: i }, alt: k }), /* @__PURE__ */ e.createElement("div", { className: "k-card-body" }, l && /* @__PURE__ */ e.createElement("h5", { className: "k-card-title" }, l), r && /* @__PURE__ */ e.createElement("h6", { className: "k-card-subtitle" }, r)), /* @__PURE__ */ e.createElement("div", { className: "k-card-actions k-card-actions-vertical" }, n.map((t, a) => /* @__PURE__ */ e.createElement("span", { className: "k-card-action", key: `action-${a}-${t.title || t.value || a}` }, /* @__PURE__ */ e.createElement(v, { fillMode: "flat", onClick: (E) => o(t, E) }, t.title)))));
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
N as HeroCard
|
|
26
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o={textField:"text",statusField:"status",authorIdField:"authorId",authorNameField:"authorName",authorImageUrlField:"authorImageUrl",authorImageAltTextField:"authorImageAltText",idField:"id",timestampField:"timestamp",filesField:"files",attachmentsField:"attachments",replyToIdField:"replyToId",isDeletedField:"isDeleted",isPinnedField:"isPinned",typingField:"typing",suggestedActionsField:"suggestedActions"},n=(t,d={})=>{const i={...o,...d};let e;t.author&&typeof t.author=="object"?e={id:t.author.id||t.author[i.authorIdField]||"",name:t.author.name||t.author[i.authorNameField],avatarUrl:t.author.avatarUrl||t.author[i.authorImageUrlField],avatarAltText:t.author.avatarAltText||t.author[i.authorImageAltTextField]}:e={id:t[i.authorIdField]||"",name:t[i.authorNameField],avatarUrl:t[i.authorImageUrlField],avatarAltText:t[i.authorImageAltTextField]};const l={id:t[i.idField],text:t[i.textField]||"",author:e,timestamp:t[i.timestampField]?new Date(t[i.timestampField]):new Date,status:t[i.statusField],attachments:t[i.attachmentsField],attachmentLayout:t.attachmentLayout||"list",suggestedActions:t[i.suggestedActionsField],isPinned:t[i.isPinnedField]||!1,typing:t[i.typingField],files:t[i.filesField]||[]};return t.pinnedAt&&(l.pinnedAt=new Date(t.pinnedAt)),t.pinnedBy&&(l.pinnedBy=t.pinnedBy),t[i.replyToIdField]&&(l.replyToId=t[i.replyToIdField]),t[i.isDeletedField]&&(l.isDeleted=t[i.isDeletedField]),l},r=(t,d={})=>Array.isArray(t)?t.map(i=>n(i,d)):[],a=t=>t&&typeof t.id!="undefined"&&typeof t.text=="string"&&t.author&&typeof t.author=="object"&&typeof t.author.id!="undefined"&&(t.timestamp instanceof Date||typeof t.timestamp=="string"||typeof t.timestamp=="number"),F=t=>({textField:t.textField,statusField:t.statusField,authorIdField:t.authorIdField,authorNameField:t.authorNameField,authorImageUrlField:t.authorImageUrlField,authorImageAltTextField:t.authorImageAltTextField,idField:t.idField,timestampField:t.timestampField,filesField:t.filesField,attachmentsField:t.attachmentsField,replyToIdField:t.replyToIdField,isDeletedField:t.isDeletedField,isPinnedField:t.isPinnedField,typingField:t.typingField,suggestedActionsField:t.suggestedActionsField}),u=(t,d={})=>{const i={...o,...d},e={};return t.id!==void 0&&(e[i.idField]=t.id),t.text!==void 0&&(e[i.textField]=t.text),t.status!==void 0&&(e[i.statusField]=t.status),t.timestamp!==void 0&&(e[i.timestampField]=t.timestamp),t.attachments!==void 0&&(e[i.attachmentsField]=t.attachments),t.files!==void 0&&(e[i.filesField]=t.files),t.suggestedActions!==void 0&&(e[i.suggestedActionsField]=t.suggestedActions),t.replyToId!==void 0&&(e[i.replyToIdField]=t.replyToId),t.isDeleted!==void 0&&(e[i.isDeletedField]=t.isDeleted),t.isPinned!==void 0&&(e[i.isPinnedField]=t.isPinned),t.typing!==void 0&&(e[i.typingField]=t.typing),t.author&&(t.author.id!==void 0&&(e[i.authorIdField]=t.author.id),t.author.name!==void 0&&(e[i.authorNameField]=t.author.name),t.author.avatarUrl!==void 0&&(e[i.authorImageUrlField]=t.author.avatarUrl),t.author.avatarAltText!==void 0&&(e[i.authorImageAltTextField]=t.author.avatarAltText)),t.pinnedAt!==void 0&&(e.pinnedAt=t.pinnedAt),t.pinnedBy!==void 0&&(e.pinnedBy=t.pinnedBy),t.attachmentLayout!==void 0&&(e.attachmentLayout=t.attachmentLayout),e};exports.DEFAULT_FIELD_MAPPING=o;exports.extractFieldMappingFromProps=F;exports.isStandardMessageFormat=a;exports.mapDataArrayToMessages=r;exports.mapDataToMessage=n;exports.mapMessageToCustomFormat=u;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
const n = {
|
|
9
|
+
textField: "text",
|
|
10
|
+
statusField: "status",
|
|
11
|
+
authorIdField: "authorId",
|
|
12
|
+
authorNameField: "authorName",
|
|
13
|
+
authorImageUrlField: "authorImageUrl",
|
|
14
|
+
authorImageAltTextField: "authorImageAltText",
|
|
15
|
+
idField: "id",
|
|
16
|
+
timestampField: "timestamp",
|
|
17
|
+
filesField: "files",
|
|
18
|
+
attachmentsField: "attachments",
|
|
19
|
+
replyToIdField: "replyToId",
|
|
20
|
+
isDeletedField: "isDeleted",
|
|
21
|
+
isPinnedField: "isPinned",
|
|
22
|
+
typingField: "typing",
|
|
23
|
+
suggestedActionsField: "suggestedActions"
|
|
24
|
+
}, o = (t, d = {}) => {
|
|
25
|
+
const i = { ...n, ...d };
|
|
26
|
+
let e;
|
|
27
|
+
t.author && typeof t.author == "object" ? e = {
|
|
28
|
+
id: t.author.id || t.author[i.authorIdField] || "",
|
|
29
|
+
name: t.author.name || t.author[i.authorNameField],
|
|
30
|
+
avatarUrl: t.author.avatarUrl || t.author[i.authorImageUrlField],
|
|
31
|
+
avatarAltText: t.author.avatarAltText || t.author[i.authorImageAltTextField]
|
|
32
|
+
} : e = {
|
|
33
|
+
id: t[i.authorIdField] || "",
|
|
34
|
+
name: t[i.authorNameField],
|
|
35
|
+
avatarUrl: t[i.authorImageUrlField],
|
|
36
|
+
avatarAltText: t[i.authorImageAltTextField]
|
|
37
|
+
};
|
|
38
|
+
const l = {
|
|
39
|
+
id: t[i.idField],
|
|
40
|
+
text: t[i.textField] || "",
|
|
41
|
+
author: e,
|
|
42
|
+
timestamp: t[i.timestampField] ? new Date(t[i.timestampField]) : /* @__PURE__ */ new Date(),
|
|
43
|
+
status: t[i.statusField],
|
|
44
|
+
attachments: t[i.attachmentsField],
|
|
45
|
+
attachmentLayout: t.attachmentLayout || "list",
|
|
46
|
+
suggestedActions: t[i.suggestedActionsField],
|
|
47
|
+
isPinned: t[i.isPinnedField] || !1,
|
|
48
|
+
typing: t[i.typingField],
|
|
49
|
+
files: t[i.filesField] || []
|
|
50
|
+
};
|
|
51
|
+
return t.pinnedAt && (l.pinnedAt = new Date(t.pinnedAt)), t.pinnedBy && (l.pinnedBy = t.pinnedBy), t[i.replyToIdField] && (l.replyToId = t[i.replyToIdField]), t[i.isDeletedField] && (l.isDeleted = t[i.isDeletedField]), l;
|
|
52
|
+
}, r = (t, d = {}) => Array.isArray(t) ? t.map((i) => o(i, d)) : [], F = (t) => t && typeof t.id != "undefined" && typeof t.text == "string" && t.author && typeof t.author == "object" && typeof t.author.id != "undefined" && (t.timestamp instanceof Date || typeof t.timestamp == "string" || typeof t.timestamp == "number"), a = (t) => ({
|
|
53
|
+
textField: t.textField,
|
|
54
|
+
statusField: t.statusField,
|
|
55
|
+
authorIdField: t.authorIdField,
|
|
56
|
+
authorNameField: t.authorNameField,
|
|
57
|
+
authorImageUrlField: t.authorImageUrlField,
|
|
58
|
+
authorImageAltTextField: t.authorImageAltTextField,
|
|
59
|
+
idField: t.idField,
|
|
60
|
+
timestampField: t.timestampField,
|
|
61
|
+
filesField: t.filesField,
|
|
62
|
+
attachmentsField: t.attachmentsField,
|
|
63
|
+
replyToIdField: t.replyToIdField,
|
|
64
|
+
isDeletedField: t.isDeletedField,
|
|
65
|
+
isPinnedField: t.isPinnedField,
|
|
66
|
+
typingField: t.typingField,
|
|
67
|
+
suggestedActionsField: t.suggestedActionsField
|
|
68
|
+
}), u = (t, d = {}) => {
|
|
69
|
+
const i = { ...n, ...d }, e = {};
|
|
70
|
+
return t.id !== void 0 && (e[i.idField] = t.id), t.text !== void 0 && (e[i.textField] = t.text), t.status !== void 0 && (e[i.statusField] = t.status), t.timestamp !== void 0 && (e[i.timestampField] = t.timestamp), t.attachments !== void 0 && (e[i.attachmentsField] = t.attachments), t.files !== void 0 && (e[i.filesField] = t.files), t.suggestedActions !== void 0 && (e[i.suggestedActionsField] = t.suggestedActions), t.replyToId !== void 0 && (e[i.replyToIdField] = t.replyToId), t.isDeleted !== void 0 && (e[i.isDeletedField] = t.isDeleted), t.isPinned !== void 0 && (e[i.isPinnedField] = t.isPinned), t.typing !== void 0 && (e[i.typingField] = t.typing), t.author && (t.author.id !== void 0 && (e[i.authorIdField] = t.author.id), t.author.name !== void 0 && (e[i.authorNameField] = t.author.name), t.author.avatarUrl !== void 0 && (e[i.authorImageUrlField] = t.author.avatarUrl), t.author.avatarAltText !== void 0 && (e[i.authorImageAltTextField] = t.author.avatarAltText)), t.pinnedAt !== void 0 && (e.pinnedAt = t.pinnedAt), t.pinnedBy !== void 0 && (e.pinnedBy = t.pinnedBy), t.attachmentLayout !== void 0 && (e.attachmentLayout = t.attachmentLayout), e;
|
|
71
|
+
};
|
|
72
|
+
export {
|
|
73
|
+
n as DEFAULT_FIELD_MAPPING,
|
|
74
|
+
a as extractFieldMappingFromProps,
|
|
75
|
+
F as isStandardMessageFormat,
|
|
76
|
+
r as mapDataArrayToMessages,
|
|
77
|
+
o as mapDataToMessage,
|
|
78
|
+
u as mapMessageToCustomFormat
|
|
79
|
+
};
|