@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.
Files changed (64) hide show
  1. package/api/message.interface.d.ts +87 -9
  2. package/chat/ChatPropsAndState.d.ts +108 -9
  3. package/chat/Events.d.ts +9 -0
  4. package/chat/components/ActionGroup.js +1 -1
  5. package/chat/components/ActionGroup.mjs +58 -48
  6. package/chat/components/Chat.d.ts +1 -1
  7. package/chat/components/Chat.js +1 -1
  8. package/chat/components/Chat.mjs +318 -269
  9. package/chat/components/ChatContext.d.ts +6 -3
  10. package/chat/components/ChatMessage.js +1 -1
  11. package/chat/components/ChatMessage.mjs +237 -177
  12. package/chat/components/Header.js +1 -1
  13. package/chat/components/Header.mjs +3 -3
  14. package/chat/components/NewMessage.d.ts +5 -3
  15. package/chat/components/NewMessage.js +1 -1
  16. package/chat/components/NewMessage.mjs +174 -226
  17. package/chat/components/ScrollButtonsWrapper.js +1 -1
  18. package/chat/components/ScrollButtonsWrapper.mjs +34 -40
  19. package/chat/components/SuggestionsGroup.js +1 -1
  20. package/chat/components/SuggestionsGroup.mjs +40 -39
  21. package/chat/components/elements/FileBox.js +1 -1
  22. package/chat/components/elements/FileBox.mjs +33 -41
  23. package/chat/components/elements/PinnedMessage.js +1 -1
  24. package/chat/components/elements/PinnedMessage.mjs +24 -22
  25. package/chat/hooks/useScrollWithButtons.d.ts +4 -0
  26. package/chat/hooks/useScrollWithButtons.js +1 -1
  27. package/chat/hooks/useScrollWithButtons.mjs +25 -23
  28. package/chat/utils/fieldMapping.d.ts +1 -1
  29. package/chat/utils/fieldMapping.js +1 -1
  30. package/chat/utils/fieldMapping.mjs +37 -34
  31. package/chat/utils/scroll.d.ts +15 -1
  32. package/chat/utils/scroll.js +3 -3
  33. package/chat/utils/scroll.mjs +92 -65
  34. package/chat/utils.d.ts +4 -1
  35. package/chat/utils.js +1 -1
  36. package/chat/utils.mjs +37 -37
  37. package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
  38. package/index.d.mts +6 -0
  39. package/index.d.ts +6 -0
  40. package/index.js +1 -1
  41. package/index.mjs +39 -31
  42. package/messages/index.d.ts +50 -0
  43. package/messages/index.js +1 -1
  44. package/messages/index.mjs +60 -40
  45. package/package-metadata.js +1 -1
  46. package/package-metadata.mjs +1 -1
  47. package/package.json +11 -11
  48. package/prompt-box/Events.d.ts +66 -0
  49. package/prompt-box/FileBox.d.ts +22 -0
  50. package/prompt-box/FileBox.js +8 -0
  51. package/prompt-box/FileBox.mjs +72 -0
  52. package/prompt-box/PromptBox.d.ts +35 -0
  53. package/prompt-box/PromptBox.js +8 -0
  54. package/prompt-box/PromptBox.mjs +424 -0
  55. package/prompt-box/PromptBoxActionButton.d.ts +32 -0
  56. package/prompt-box/PromptBoxActionButton.js +8 -0
  57. package/prompt-box/PromptBoxActionButton.mjs +14 -0
  58. package/prompt-box/PromptBoxSpeechToTextButton.d.ts +32 -0
  59. package/prompt-box/PromptBoxSpeechToTextButton.js +8 -0
  60. package/prompt-box/PromptBoxSpeechToTextButton.mjs +14 -0
  61. package/prompt-box/PromptBoxUploadButton.d.ts +108 -0
  62. package/prompt-box/PromptBoxUploadButton.js +8 -0
  63. package/prompt-box/PromptBoxUploadButton.mjs +54 -0
  64. package/prompt-box/interfaces/PromptBoxProps.d.ts +390 -0
@@ -5,31 +5,32 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as t from "react";
9
- import { classNames as m } from "@progress/kendo-react-common";
8
+ import * as s from "react";
9
+ import { classNames as u } from "@progress/kendo-react-common";
10
10
  import { ScrollButtonsWrapper as R } from "./ScrollButtonsWrapper.mjs";
11
- import { useScrollWithButtons as E } from "../hooks/useScrollWithButtons.mjs";
12
- const w = (b) => {
11
+ import { useScrollWithButtons as S } from "../hooks/useScrollWithButtons.mjs";
12
+ const N = (f) => {
13
13
  const {
14
- suggestions: r,
14
+ suggestions: t,
15
15
  onSuggestionClick: l,
16
16
  suggestionsView: o,
17
- suggestionTemplate: s,
18
- suggestionsLayout: a,
19
- dir: n
20
- } = b, i = t.useRef(null), { canScrollLeft: u, canScrollRight: f, scrollLeft: k, scrollRight: y } = E(i, {
21
- enabled: a === "scrollbuttons",
22
- dir: n,
23
- itemsDependency: r
24
- }), d = t.useCallback(
25
- (e, c) => {
26
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l == null || l(c));
17
+ suggestionTemplate: a,
18
+ suggestionsLayout: r,
19
+ dir: i
20
+ } = f, d = s.useRef(null), { canScrollLeft: p, canScrollRight: b, scrollLeft: k, scrollRight: y } = S(d, {
21
+ enabled: r === "scrollbuttons" || r === "scroll",
22
+ dir: i,
23
+ mode: r,
24
+ itemsDependency: t
25
+ }), m = s.useCallback(
26
+ (e, n) => {
27
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l == null || l(n));
27
28
  },
28
29
  [l]
29
- ), p = t.useCallback(
30
- () => r.map(
31
- (e) => s ? /* @__PURE__ */ t.createElement(
32
- s,
30
+ ), c = s.useCallback(
31
+ () => t.map(
32
+ (e) => a ? /* @__PURE__ */ s.createElement(
33
+ a,
33
34
  {
34
35
  key: e.id,
35
36
  suggestion: e,
@@ -37,7 +38,7 @@ const w = (b) => {
37
38
  l == null || l(e);
38
39
  }
39
40
  }
40
- ) : /* @__PURE__ */ t.createElement(
41
+ ) : /* @__PURE__ */ s.createElement(
41
42
  "span",
42
43
  {
43
44
  role: "button",
@@ -45,47 +46,47 @@ const w = (b) => {
45
46
  "aria-label": e.description,
46
47
  "aria-disabled": e.disabled,
47
48
  onClick: () => !e.disabled && (l == null ? void 0 : l(e)),
48
- onKeyDown: (c) => !e.disabled && d(c, e),
49
+ onKeyDown: (n) => !e.disabled && m(n, e),
49
50
  key: e.id,
50
51
  title: e.description,
51
- className: m(o === "classic" ? "k-prompt-suggestion" : "k-suggestion", {
52
+ className: u(o === "classic" ? "k-prompt-suggestion" : "k-suggestion", {
52
53
  "k-disabled": e.disabled
53
54
  })
54
55
  },
55
56
  e.text
56
57
  )
57
58
  ),
58
- [r, s, l, o, d]
59
+ [t, a, l, o, m]
59
60
  );
60
- if (!r || r.length === 0)
61
+ if (!t || t.length === 0)
61
62
  return null;
62
63
  if (o === "classic")
63
- return p();
64
- const h = /* @__PURE__ */ t.createElement(
64
+ return c();
65
+ const h = r === "scroll" || r === "scrollbuttons", E = /* @__PURE__ */ s.createElement(
65
66
  "div",
66
67
  {
67
68
  role: "group",
68
- className: m("k-suggestion-group", {
69
- // Apply scrollable class when layout is 'scroll' (default for Chat component)
70
- "k-suggestion-group-scrollable": a === "scroll"
71
- }),
72
- ref: a === "scrollbuttons" ? i : void 0
69
+ className: u("k-suggestion-group", {
70
+ "k-suggestion-group-scrollable": r === "scroll",
71
+ "k-suggestion-group-scrollable-start": b && (r === "scroll" || r === "scrollbuttons"),
72
+ "k-suggestion-group-scrollable-end": p && (r === "scroll" || r === "scrollbuttons")
73
+ })
73
74
  },
74
- p()
75
+ h ? /* @__PURE__ */ s.createElement("div", { className: "k-suggestions-scroll", ref: d }, c()) : c()
75
76
  );
76
- return /* @__PURE__ */ t.createElement(
77
+ return /* @__PURE__ */ s.createElement(
77
78
  R,
78
79
  {
79
- visible: a === "scrollbuttons",
80
- dir: n,
81
- canScrollLeft: u,
82
- canScrollRight: f,
80
+ visible: r === "scrollbuttons",
81
+ dir: i,
82
+ canScrollLeft: p,
83
+ canScrollRight: b,
83
84
  onScrollLeft: k,
84
85
  onScrollRight: y
85
86
  },
86
- h
87
+ E
87
88
  );
88
89
  };
89
90
  export {
90
- w as SuggestionGroup
91
+ N as SuggestionGroup
91
92
  };
@@ -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";const b=require("react"),g=require("@progress/kendo-react-common"),h=require("@progress/kendo-react-buttons"),d=require("@progress/kendo-svg-icons"),w=require("@progress/kendo-react-intl"),r=require("../../../messages/index.js"),F=require("../ChatContext.js");function M(a){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(i,o,s.get?s:{enumerable:!0,get:()=>a[o]})}}return i.default=a,Object.freeze(i)}const n=M(b),N=a=>{const{files:i,onFileRemove:o,onFileAction:s,onDownload:m,fileActions:k,renderInTextarea:I=!1}=a,{messageFilesLayout:u="vertical"}=F.useChatContext(),p=w.useLocalization(),C=[{id:"download",label:"Download",svgIcon:d.downloadIcon}],f=k||C,x=e=>{if(e==null)return"";if(e===0)return"0 B";const t=1024,c=["B","KB","MB","GB","TB"],l=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,l)).toFixed(2))} ${c[l]}`},E=e=>"."+e.split(".").pop()||"",v=(e,t)=>{var c,l;(l=(c=e.syntheticEvent)==null?void 0:c.stopPropagation)==null||l.call(c),e.item.id==="download"&&(m==null||m([t])),s==null||s(e.item,e,t)},B=e=>I?n.createElement(h.Button,{fillMode:"flat",themeColor:"base",svgIcon:d.xIcon,onClick:t=>{t.stopPropagation(),o==null||o(e.name)},"aria-label":`${p.toLanguageString(r.removeFile,r.messages[r.removeFile])} ${e.name}`}):f.length>0&&n.createElement(h.DropDownButton,{fillMode:"flat",themeColor:"base",svgIcon:d.moreVerticalIcon,onClick:t=>{t.syntheticEvent.stopPropagation()},onItemClick:t=>v(t,e),items:f.map(t=>({id:t.id,icon:t.icon,text:t.label,svgIcon:t.svgIcon})),"aria-label":`${p.toLanguageString(r.fileActions,r.messages[r.fileActions])} ${e.name}`}),z=n.useCallback(()=>g.classNames("k-chat-file-wrapper",{"k-chat-files-wrap":u==="wrap","k-chat-files-horizontal":u==="horizontal"}),[u]);return n.createElement("ul",{className:z()},i.map(e=>n.createElement("li",{key:e.name,className:"k-chat-file"},n.createElement(g.IconWrap,{size:"xlarge",...g.getFileExtensionIcon(E(e.name))}),n.createElement("div",{className:"k-chat-file-info"},n.createElement("span",{className:"k-chat-file-name"},e.name),n.createElement("span",{className:"k-chat-file-size"},x(e.size))),B(e))))};module.exports=N;
8
+ "use strict";const z=require("react"),m=require("@progress/kendo-react-common"),h=require("@progress/kendo-react-buttons"),E=require("@progress/kendo-svg-icons"),B=require("@progress/kendo-react-intl"),l=require("../../../messages/index.js"),C=require("../ChatContext.js");function b(o){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const c=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(s,a,c.get?c:{enumerable:!0,get:()=>o[a]})}}return s.default=o,Object.freeze(s)}const n=b(z),w=o=>{const{files:s,onFileAction:a,onDownload:c,fileActions:x}=o,{messageFilesLayout:u="vertical"}=C.useChatContext(),g=B.useLocalization(),I=[{id:"download",label:"Download",svgIcon:E.downloadLightIcon}],p=x||I,d=e=>{if(e==null)return"";if(e===0)return"0 B";const t=1024,i=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(2))} ${i[r]}`},f=e=>"."+e.split(".").pop()||"",v=(e,t)=>{var i,r;(r=(i=e.syntheticEvent)==null?void 0:i.stopPropagation)==null||r.call(i),e.item.id==="download"&&(c==null||c([t])),a==null||a(e.item,e,t)},k=e=>p.length>0&&n.createElement(h.DropDownButton,{fillMode:"flat",svgIcon:E.moreVerticalIcon,onClick:t=>{t.syntheticEvent.stopPropagation()},onItemClick:t=>v(t,e),items:p.map(t=>({id:t.id,icon:t.icon,text:t.label,svgIcon:t.svgIcon})),"aria-label":`${g.toLanguageString(l.fileActions,l.messages[l.fileActions])} ${e.name}`,title:`${g.toLanguageString(l.fileActions,l.messages[l.fileActions])} ${e.name}`}),N=n.useCallback(()=>m.classNames({"k-files-wrap":u==="wrap","k-files-vertical":u==="vertical"},"k-file-box-wrapper"),[u]);return n.createElement("ul",{className:N()},u==="horizontal"?n.createElement("div",{className:"k-files-scroll"},s.map(e=>n.createElement("li",{key:e.name,className:"k-file-box"},n.createElement(m.IconWrap,{size:"xlarge",...m.getFileExtensionIcon(f(e.name))}),n.createElement("div",{className:"k-file-info"},n.createElement("span",{className:"k-file-name"},e.name),n.createElement("span",{className:"k-file-size"},d(e.size))),k(e)))):s.map(e=>n.createElement("li",{key:e.name,className:"k-file-box"},n.createElement(m.IconWrap,{size:"xlarge",...m.getFileExtensionIcon(f(e.name))}),n.createElement("div",{className:"k-file-info"},n.createElement("span",{className:"k-file-name"},e.name),n.createElement("span",{className:"k-file-size"},d(e.size))),k(e))))};module.exports=w;
@@ -5,62 +5,54 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as o from "react";
9
- import { classNames as z, IconWrap as v, getFileExtensionIcon as w } from "@progress/kendo-react-common";
10
- import { Button as F, DropDownButton as M } from "@progress/kendo-react-buttons";
11
- import { xIcon as N, downloadIcon as $, moreVerticalIcon as A } from "@progress/kendo-svg-icons";
12
- import { useLocalization as L } from "@progress/kendo-react-intl";
13
- import { removeFile as p, messages as f, fileActions as g } from "../../../messages/index.mjs";
14
- import { useChatContext as S } from "../ChatContext.mjs";
15
- const V = (u) => {
16
- const { files: d, onFileRemove: s, onFileAction: l, onDownload: i, fileActions: h, renderInTextarea: k = !1 } = u, { messageFilesLayout: r = "vertical" } = S(), c = L(), m = h || [{ id: "download", label: "Download", svgIcon: $ }], I = (e) => {
8
+ import * as a from "react";
9
+ import { classNames as h, IconWrap as u, getFileExtensionIcon as k } from "@progress/kendo-react-common";
10
+ import { DropDownButton as I } from "@progress/kendo-react-buttons";
11
+ import { downloadLightIcon as B, moreVerticalIcon as w } from "@progress/kendo-svg-icons";
12
+ import { useLocalization as F } from "@progress/kendo-react-intl";
13
+ import { fileActions as l, messages as E } from "../../../messages/index.mjs";
14
+ import { useChatContext as C } from "../ChatContext.mjs";
15
+ const P = (x) => {
16
+ const { files: c, onFileAction: i, onDownload: r, fileActions: N } = x, { messageFilesLayout: s = "vertical" } = C(), m = F(), p = N || [{ id: "download", label: "Download", svgIcon: B }], f = (e) => {
17
17
  if (e == null)
18
18
  return "";
19
19
  if (e === 0)
20
20
  return "0 B";
21
- const t = 1024, a = ["B", "KB", "MB", "GB", "TB"], n = Math.floor(Math.log(e) / Math.log(t));
22
- return `${parseFloat((e / Math.pow(t, n)).toFixed(2))} ${a[n]}`;
23
- }, E = (e) => "." + e.split(".").pop() || "", x = (e, t) => {
24
- var a, n;
25
- (n = (a = e.syntheticEvent) == null ? void 0 : a.stopPropagation) == null || n.call(a), e.item.id === "download" && (i == null || i([t])), l == null || l(e.item, e, t);
26
- }, B = (e) => k ? /* @__PURE__ */ o.createElement(
27
- F,
21
+ const t = 1024, o = ["B", "KB", "MB", "GB", "TB"], n = Math.floor(Math.log(e) / Math.log(t));
22
+ return `${parseFloat((e / Math.pow(t, n)).toFixed(2))} ${o[n]}`;
23
+ }, g = (e) => "." + e.split(".").pop() || "", v = (e, t) => {
24
+ var o, n;
25
+ (n = (o = e.syntheticEvent) == null ? void 0 : o.stopPropagation) == null || n.call(o), e.item.id === "download" && (r == null || r([t])), i == null || i(e.item, e, t);
26
+ }, d = (e) => p.length > 0 && /* @__PURE__ */ a.createElement(
27
+ I,
28
28
  {
29
29
  fillMode: "flat",
30
- themeColor: "base",
31
- svgIcon: N,
32
- onClick: (t) => {
33
- t.stopPropagation(), s == null || s(e.name);
34
- },
35
- "aria-label": `${c.toLanguageString(p, f[p])} ${e.name}`
36
- }
37
- ) : m.length > 0 && /* @__PURE__ */ o.createElement(
38
- M,
39
- {
40
- fillMode: "flat",
41
- themeColor: "base",
42
- svgIcon: A,
30
+ svgIcon: w,
43
31
  onClick: (t) => {
44
32
  t.syntheticEvent.stopPropagation();
45
33
  },
46
- onItemClick: (t) => x(t, e),
47
- items: m.map((t) => ({
34
+ onItemClick: (t) => v(t, e),
35
+ items: p.map((t) => ({
48
36
  id: t.id,
49
37
  icon: t.icon,
50
38
  text: t.label,
51
39
  svgIcon: t.svgIcon
52
40
  })),
53
- "aria-label": `${c.toLanguageString(
54
- g,
55
- f[g]
56
- )} ${e.name}`
41
+ "aria-label": `${m.toLanguageString(
42
+ l,
43
+ E[l]
44
+ )} ${e.name}`,
45
+ title: `${m.toLanguageString(l, E[l])} ${e.name}`
57
46
  }
58
- ), C = o.useCallback(() => z("k-chat-file-wrapper", {
59
- "k-chat-files-wrap": r === "wrap",
60
- "k-chat-files-horizontal": r === "horizontal"
61
- }), [r]);
62
- return /* @__PURE__ */ o.createElement("ul", { className: C() }, d.map((e) => /* @__PURE__ */ o.createElement("li", { key: e.name, className: "k-chat-file" }, /* @__PURE__ */ o.createElement(v, { size: "xlarge", ...w(E(e.name)) }), /* @__PURE__ */ o.createElement("div", { className: "k-chat-file-info" }, /* @__PURE__ */ o.createElement("span", { className: "k-chat-file-name" }, e.name), /* @__PURE__ */ o.createElement("span", { className: "k-chat-file-size" }, I(e.size))), B(e))));
47
+ ), z = a.useCallback(() => h(
48
+ {
49
+ "k-files-wrap": s === "wrap",
50
+ "k-files-vertical": s === "vertical"
51
+ },
52
+ "k-file-box-wrapper"
53
+ ), [s]);
54
+ return /* @__PURE__ */ a.createElement("ul", { className: z() }, s === "horizontal" ? /* @__PURE__ */ a.createElement("div", { className: "k-files-scroll" }, c.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-file-box" }, /* @__PURE__ */ a.createElement(u, { size: "xlarge", ...k(g(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-file-size" }, f(e.size))), d(e)))) : c.map((e) => /* @__PURE__ */ a.createElement("li", { key: e.name, className: "k-file-box" }, /* @__PURE__ */ a.createElement(u, { size: "xlarge", ...k(g(e.name)) }), /* @__PURE__ */ a.createElement("div", { className: "k-file-info" }, /* @__PURE__ */ a.createElement("span", { className: "k-file-name" }, e.name), /* @__PURE__ */ a.createElement("span", { className: "k-file-size" }, f(e.size))), d(e))));
63
55
  };
64
56
  export {
65
- V as default
57
+ P as default
66
58
  };
@@ -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";const g=require("react"),p=require("@progress/kendo-react-common"),m=require("@progress/kendo-react-buttons"),i=require("@progress/kendo-svg-icons"),f=require("@progress/kendo-react-intl"),a=require("../../utils.js"),k=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=f.useLocalization(),{internalScrollContainerRef:r}=k.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,{fillMode:"flat",svgIcon:i.xIcon,onClick:s=>{s.stopPropagation(),t==null||t(e)}}))};module.exports=v;
8
+ "use strict";const k=require("react"),C=require("@progress/kendo-react-common"),M=require("@progress/kendo-react-buttons"),u=require("@progress/kendo-svg-icons"),h=require("@progress/kendo-react-intl"),a=require("../../utils.js"),v=require("../ChatContext.js");function b(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const c=b(k),q=n=>{const{message:e,onUnpin:t,user:s}=n,d=h.useLocalization(),{internalScrollContainerRef:r}=v.useChatContext(),i=c.useRef(null),f=s&&a.isAuthor(s,e),g=c.useCallback(o=>{var l;o.preventDefault(),o.stopPropagation();const p=r==null?void 0:r.current,m=((l=i.current)==null?void 0:l.offsetHeight)||0;a.scrollToMessageById(e.id,p,m)},[e.id,r]);return c.createElement("div",{ref:i,className:`k-message-reference ${f?"k-message-reference-sender":"k-message-reference-receiver"} k-message-pinned`,onClick:g},c.createElement(C.IconWrap,{icon:u.pinOutlineIcon}),c.createElement("div",{className:"k-message-reference-content"},e!=null&&e.isDeleted?s&&a.getDeletedMessageText(a.isAuthor(s,e),d):e==null?void 0:e.text),c.createElement("span",{className:"k-spacer"}),c.createElement(M.Button,{fillMode:"flat",svgIcon:u.xMarkSmOutlineIcon,onClick:o=>{o.stopPropagation(),t==null||t(e)}}))};module.exports=q;
@@ -6,42 +6,44 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as t from "react";
9
- import { IconWrap as m } 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 l = o == null ? void 0 : o.current;
20
- u(e.id, l);
9
+ import { IconWrap as g } from "@progress/kendo-react-common";
10
+ import { Button as k } from "@progress/kendo-react-buttons";
11
+ import { pinOutlineIcon as M, xMarkSmOutlineIcon as h } from "@progress/kendo-svg-icons";
12
+ import { useLocalization as v } from "@progress/kendo-react-intl";
13
+ import { isAuthor as i, scrollToMessageById as C, getDeletedMessageText as x } from "../../utils.mjs";
14
+ import { useChatContext as E } from "../ChatContext.mjs";
15
+ const H = (l) => {
16
+ const { message: e, onUnpin: r, user: n } = l, m = v(), { internalScrollContainerRef: s } = E(), a = t.useRef(null), f = n && i(n, e), p = t.useCallback(
17
+ (o) => {
18
+ var c;
19
+ o.preventDefault(), o.stopPropagation();
20
+ const d = s == null ? void 0 : s.current, u = ((c = a.current) == null ? void 0 : c.offsetHeight) || 0;
21
+ C(e.id, d, u);
21
22
  },
22
- [e.id, o]
23
+ [e.id, s]
23
24
  );
24
25
  return /* @__PURE__ */ t.createElement(
25
26
  "div",
26
27
  {
27
- className: "k-message-reference k-message-reference-receiver k-message-pinned",
28
- onClick: i
28
+ ref: a,
29
+ className: `k-message-reference ${f ? "k-message-reference-sender" : "k-message-reference-receiver"} k-message-pinned`,
30
+ onClick: p
29
31
  },
30
- /* @__PURE__ */ t.createElement(m, { 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(g, { icon: M }),
33
+ /* @__PURE__ */ t.createElement("div", { className: "k-message-reference-content" }, e != null && e.isDeleted ? n && x(i(n, e), m) : e == null ? void 0 : e.text),
32
34
  /* @__PURE__ */ t.createElement("span", { className: "k-spacer" }),
33
35
  /* @__PURE__ */ t.createElement(
34
- p,
36
+ k,
35
37
  {
36
38
  fillMode: "flat",
37
- svgIcon: f,
38
- onClick: (r) => {
39
- r.stopPropagation(), a == null || a(e);
39
+ svgIcon: h,
40
+ onClick: (o) => {
41
+ o.stopPropagation(), r == null || r(e);
40
42
  }
41
43
  }
42
44
  )
43
45
  );
44
46
  };
45
47
  export {
46
- z as default
48
+ H as default
47
49
  };
@@ -18,6 +18,10 @@ export interface UseScrollWithButtonsOptions {
18
18
  * Direction for RTL support
19
19
  */
20
20
  dir?: string;
21
+ /**
22
+ * The scroll mode (used to detect mode changes)
23
+ */
24
+ mode?: string;
21
25
  /**
22
26
  * Dependencies array that triggers scroll button updates when items change
23
27
  */
@@ -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 m=require("react");function p(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const c=p(m),y=100,a=1,E=(e,o)=>{const{enabled:t,dir:r,itemsDependency:f=[],scrollSpeed:s=y}=o,[S,b]=c.useState(!1),[d,L]=c.useState(!1),n=c.useCallback(()=>{if(e.current&&t){const{scrollLeft:l,scrollWidth:u,clientWidth:i}=e.current,O=l===0,g=r!=="rtl"?l+i>=u-a:i-l>=u-a;b(!O),L(!g)}},[t,r]),h=c.useCallback(()=>{e.current&&t&&e.current.scrollBy({left:r!=="rtl"?-s:s,behavior:"smooth"})},[t,r,s]),v=c.useCallback(()=>{e.current&&t&&e.current.scrollBy({left:r!=="rtl"?s:-s,behavior:"smooth"})},[t,r,s]);return c.useEffect(()=>{const l=e.current;if(l&&t){n(),l.addEventListener("scroll",n);const u=new ResizeObserver(n);return u.observe(l),()=>{l.removeEventListener("scroll",n),u.disconnect()}}},[t,r]),c.useLayoutEffect(()=>{t&&n()},[t,r,f]),{canScrollLeft:S,canScrollRight:d,scrollLeft:h,scrollRight:v}};exports.useScrollWithButtons=E;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react");function y(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const s=y(O),E=100,f=1,C=(e,o)=>{const{enabled:t,dir:r,mode:d,itemsDependency:i=[],scrollSpeed:c=E}=o,[S,b]=s.useState(!1),[h,L]=s.useState(!1),n=s.useCallback(()=>{if(e.current&&t){const{scrollLeft:l,scrollWidth:u,clientWidth:a}=e.current,m=l===0,p=r!=="rtl"?l+a>=u-f:a-l>=u-f;b(!m),L(!p)}},[t,r]),v=s.useCallback(()=>{e.current&&t&&e.current.scrollBy({left:r!=="rtl"?-c:c,behavior:"smooth"})},[t,r,c]),g=s.useCallback(()=>{e.current&&t&&e.current.scrollBy({left:r!=="rtl"?c:-c,behavior:"smooth"})},[t,r,c]);return s.useEffect(()=>{const l=e.current;if(!l||!t)return;n();const u=()=>n();l.addEventListener("scroll",u,{passive:!0});const a=new ResizeObserver(n);return a.observe(l),()=>{l.removeEventListener("scroll",u),a.disconnect()}},[t,n,i.length,d]),s.useLayoutEffect(()=>{t&&n()},[t,r,i]),{canScrollLeft:S,canScrollRight:h,scrollLeft:v,scrollRight:g}};exports.useScrollWithButtons=C;
@@ -6,41 +6,43 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as r from "react";
9
- const m = 100, i = 1, p = (l, a) => {
10
- const { enabled: t, dir: e, itemsDependency: S = [], scrollSpeed: c = m } = a, [f, L] = r.useState(!1), [d, b] = r.useState(!1), o = r.useCallback(() => {
9
+ const p = 100, a = 1, y = (l, S) => {
10
+ const { enabled: t, dir: s, mode: d, itemsDependency: i = [], scrollSpeed: c = p } = S, [f, L] = r.useState(!1), [h, b] = r.useState(!1), o = r.useCallback(() => {
11
11
  if (l.current && t) {
12
- const { scrollLeft: s, scrollWidth: n, clientWidth: u } = l.current, E = s === 0, C = e !== "rtl" ? s + u >= n - i : u - s >= n - i;
13
- L(!E), b(!C);
12
+ const { scrollLeft: e, scrollWidth: n, clientWidth: u } = l.current, m = e === 0, C = s !== "rtl" ? e + u >= n - a : u - e >= n - a;
13
+ L(!m), b(!C);
14
14
  }
15
- }, [t, e]), h = r.useCallback(() => {
15
+ }, [t, s]), v = r.useCallback(() => {
16
16
  l.current && t && l.current.scrollBy({
17
- left: e !== "rtl" ? -c : c,
17
+ left: s !== "rtl" ? -c : c,
18
18
  behavior: "smooth"
19
19
  });
20
- }, [t, e, c]), v = r.useCallback(() => {
20
+ }, [t, s, c]), E = r.useCallback(() => {
21
21
  l.current && t && l.current.scrollBy({
22
- left: e !== "rtl" ? c : -c,
22
+ left: s !== "rtl" ? c : -c,
23
23
  behavior: "smooth"
24
24
  });
25
- }, [t, e, c]);
25
+ }, [t, s, c]);
26
26
  return r.useEffect(() => {
27
- const s = l.current;
28
- if (s && t) {
29
- o(), s.addEventListener("scroll", o);
30
- const n = new ResizeObserver(o);
31
- return n.observe(s), () => {
32
- s.removeEventListener("scroll", o), n.disconnect();
33
- };
34
- }
35
- }, [t, e]), r.useLayoutEffect(() => {
27
+ const e = l.current;
28
+ if (!e || !t)
29
+ return;
30
+ o();
31
+ const n = () => o();
32
+ e.addEventListener("scroll", n, { passive: !0 });
33
+ const u = new ResizeObserver(o);
34
+ return u.observe(e), () => {
35
+ e.removeEventListener("scroll", n), u.disconnect();
36
+ };
37
+ }, [t, o, i.length, d]), r.useLayoutEffect(() => {
36
38
  t && o();
37
- }, [t, e, S]), {
39
+ }, [t, s, i]), {
38
40
  canScrollLeft: f,
39
- canScrollRight: d,
40
- scrollLeft: h,
41
- scrollRight: v
41
+ canScrollRight: h,
42
+ scrollLeft: v,
43
+ scrollRight: E
42
44
  };
43
45
  };
44
46
  export {
45
- p as useScrollWithButtons
47
+ y as useScrollWithButtons
46
48
  };
@@ -5,7 +5,7 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { Message } from '../../index.js';
8
+ import { Message } from '../../api/message.interface.js';
9
9
  import { FieldMappingConfig } from '../ChatPropsAndState.js';
10
10
  /**
11
11
  * Default field mapping configuration.
@@ -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 n={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"},r=(i,d={})=>{const t={...n,...d};let e;i.author&&typeof i.author=="object"?e={id:i.author.id||i.author[t.authorIdField]||i[t.authorIdField]||"",name:i.author.name||i.author[t.authorNameField]||i[t.authorNameField],avatarUrl:i.author.avatarUrl||i.author[t.authorImageUrlField]||i[t.authorImageUrlField],avatarAltText:i.author.avatarAltText||i.author[t.authorImageAltTextField]||i[t.authorImageAltTextField]}:e={id:i[t.authorIdField]||i.authorId||"",name:i[t.authorNameField]||i.authorName,avatarUrl:i[t.authorImageUrlField]||i.authorImageUrl,avatarAltText:i[t.authorImageAltTextField]||i.authorImageAltText};let o;i.timestamp?o=new Date(i.timestamp):i[t.timestampField]?o=new Date(i[t.timestampField]):o=new Date;const l={id:i.id!==void 0?i.id:i[t.idField],text:i.text!==void 0?i.text:i[t.textField]||"",author:e,timestamp:o,status:i.status!==void 0?i.status:i[t.statusField],attachments:i.attachments!==void 0?i.attachments:i[t.attachmentsField],attachmentLayout:i.attachmentLayout||"list",suggestedActions:i.suggestedActions!==void 0?i.suggestedActions:i[t.suggestedActionsField],isPinned:i.isPinned!==void 0?i.isPinned:i[t.isPinnedField]||!1,typing:i.typing!==void 0?i.typing:i[t.typingField],files:i.files!==void 0?i.files:i[t.filesField]||[]};return i.pinnedAt&&(l.pinnedAt=new Date(i.pinnedAt)),i.pinnedBy&&(l.pinnedBy=i.pinnedBy),i.replyToId!==void 0?l.replyToId=i.replyToId:i[t.replyToIdField]!==void 0&&(l.replyToId=i[t.replyToIdField]),i.isDeleted!==void 0?l.isDeleted=i.isDeleted:i[t.isDeletedField]!==void 0&&(l.isDeleted=i[t.isDeletedField]),{...l,dataItem:i}},u=(i,d={})=>Array.isArray(i)?i.map(t=>r(t,d)):[],F=i=>i&&typeof i.id!="undefined"&&typeof i.text=="string"&&i.author&&typeof i.author=="object"&&typeof i.author.id!="undefined"&&(i.timestamp instanceof Date||typeof i.timestamp=="string"||typeof i.timestamp=="number"),h=i=>({textField:i.textField,statusField:i.statusField,authorIdField:i.authorIdField,authorNameField:i.authorNameField,authorImageUrlField:i.authorImageUrlField,authorImageAltTextField:i.authorImageAltTextField,idField:i.idField,timestampField:i.timestampField,filesField:i.filesField,attachmentsField:i.attachmentsField,replyToIdField:i.replyToIdField,isDeletedField:i.isDeletedField,isPinnedField:i.isPinnedField,typingField:i.typingField,suggestedActionsField:i.suggestedActionsField}),a=(i,d={})=>{const t={...n,...d},e={};return i.id!==void 0&&(e[t.idField]=i.id),i.text!==void 0&&(e[t.textField]=i.text),i.status!==void 0&&(e[t.statusField]=i.status),i.timestamp!==void 0&&(e[t.timestampField]=i.timestamp),i.attachments!==void 0&&(e[t.attachmentsField]=i.attachments),i.files!==void 0&&(e[t.filesField]=i.files),i.suggestedActions!==void 0&&(e[t.suggestedActionsField]=i.suggestedActions),i.replyToId!==void 0&&(e[t.replyToIdField]=i.replyToId),i.isDeleted!==void 0&&(e[t.isDeletedField]=i.isDeleted),i.isPinned!==void 0&&(e[t.isPinnedField]=i.isPinned),i.typing!==void 0&&(e[t.typingField]=i.typing),i.author&&(i.author.id!==void 0&&(e[t.authorIdField]=i.author.id),i.author.name!==void 0&&(e[t.authorNameField]=i.author.name),i.author.avatarUrl!==void 0&&(e[t.authorImageUrlField]=i.author.avatarUrl),i.author.avatarAltText!==void 0&&(e[t.authorImageAltTextField]=i.author.avatarAltText)),i.pinnedAt!==void 0&&(e.pinnedAt=i.pinnedAt),i.pinnedBy!==void 0&&(e.pinnedBy=i.pinnedBy),i.attachmentLayout!==void 0&&(e.attachmentLayout=i.attachmentLayout),e};exports.DEFAULT_FIELD_MAPPING=n;exports.extractFieldMappingFromProps=h;exports.isStandardMessageFormat=F;exports.mapDataArrayToMessages=u;exports.mapDataToMessage=r;exports.mapMessageToCustomFormat=a;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={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",isFailedField:"isFailed"},r=(i,d={})=>{const e={...n,...d};let t;i.author&&typeof i.author=="object"?t={id:i.author.id||i.author[e.authorIdField]||i[e.authorIdField]||"",name:i.author.name||i.author[e.authorNameField]||i[e.authorNameField],avatarUrl:i.author.avatarUrl||i.author[e.authorImageUrlField]||i[e.authorImageUrlField],avatarAltText:i.author.avatarAltText||i.author[e.authorImageAltTextField]||i[e.authorImageAltTextField]}:t={id:i[e.authorIdField]||i.authorId||"",name:i[e.authorNameField]||i.authorName,avatarUrl:i[e.authorImageUrlField]||i.authorImageUrl,avatarAltText:i[e.authorImageAltTextField]||i.authorImageAltText};let o;i.timestamp?o=new Date(i.timestamp):i[e.timestampField]?o=new Date(i[e.timestampField]):o=new Date;const l={id:i.id!==void 0?i.id:i[e.idField],text:i.text!==void 0?i.text:i[e.textField]||"",author:t,timestamp:o,status:i.status!==void 0?i.status:i[e.statusField],attachments:i.attachments!==void 0?i.attachments:i[e.attachmentsField],attachmentLayout:i.attachmentLayout||"list",suggestedActions:i.suggestedActions!==void 0?i.suggestedActions:i[e.suggestedActionsField],isPinned:i.isPinned!==void 0?i.isPinned:i[e.isPinnedField]||!1,typing:i.typing!==void 0?i.typing:i[e.typingField],files:i.files!==void 0?i.files:i[e.filesField]||[],isFailed:i.isFailed!==void 0?i.isFailed:i[e.isFailedField]||!1};return i.pinnedAt&&(l.pinnedAt=new Date(i.pinnedAt)),i.pinnedBy&&(l.pinnedBy=i.pinnedBy),i.replyToId!==void 0?l.replyToId=i.replyToId:i[e.replyToIdField]!==void 0&&(l.replyToId=i[e.replyToIdField]),i.isDeleted!==void 0?l.isDeleted=i.isDeleted:i[e.isDeletedField]!==void 0&&(l.isDeleted=i[e.isDeletedField]),{...l,dataItem:i}},F=(i,d={})=>Array.isArray(i)?i.map(e=>r(e,d)):[],u=i=>i&&typeof i.id!="undefined"&&typeof i.text=="string"&&i.author&&typeof i.author=="object"&&typeof i.author.id!="undefined"&&(i.timestamp instanceof Date||typeof i.timestamp=="string"||typeof i.timestamp=="number"),h=i=>({textField:i.textField,statusField:i.statusField,authorIdField:i.authorIdField,authorNameField:i.authorNameField,authorImageUrlField:i.authorImageUrlField,authorImageAltTextField:i.authorImageAltTextField,idField:i.idField,timestampField:i.timestampField,filesField:i.filesField,attachmentsField:i.attachmentsField,replyToIdField:i.replyToIdField,isDeletedField:i.isDeletedField,isPinnedField:i.isPinnedField,typingField:i.typingField,suggestedActionsField:i.suggestedActionsField,isFailedField:i.isFailedField}),a=(i,d={})=>{const e={...n,...d},t={};return i.id!==void 0&&(t[e.idField]=i.id),i.text!==void 0&&(t[e.textField]=i.text),i.status!==void 0&&(t[e.statusField]=i.status),i.isFailed!==void 0&&(t[e.isFailedField]=i.isFailed),i.timestamp!==void 0&&(t[e.timestampField]=i.timestamp),i.attachments!==void 0&&(t[e.attachmentsField]=i.attachments),i.files!==void 0&&(t[e.filesField]=i.files),i.suggestedActions!==void 0&&(t[e.suggestedActionsField]=i.suggestedActions),i.replyToId!==void 0&&(t[e.replyToIdField]=i.replyToId),i.isDeleted!==void 0&&(t[e.isDeletedField]=i.isDeleted),i.isPinned!==void 0&&(t[e.isPinnedField]=i.isPinned),i.typing!==void 0&&(t[e.typingField]=i.typing),i.author&&(i.author.id!==void 0&&(t[e.authorIdField]=i.author.id),i.author.name!==void 0&&(t[e.authorNameField]=i.author.name),i.author.avatarUrl!==void 0&&(t[e.authorImageUrlField]=i.author.avatarUrl),i.author.avatarAltText!==void 0&&(t[e.authorImageAltTextField]=i.author.avatarAltText)),i.pinnedAt!==void 0&&(t.pinnedAt=i.pinnedAt),i.pinnedBy!==void 0&&(t.pinnedBy=i.pinnedBy),i.attachmentLayout!==void 0&&(t.attachmentLayout=i.attachmentLayout),t};exports.DEFAULT_FIELD_MAPPING=n;exports.extractFieldMappingFromProps=h;exports.isStandardMessageFormat=u;exports.mapDataArrayToMessages=F;exports.mapDataToMessage=r;exports.mapMessageToCustomFormat=a;
@@ -20,38 +20,40 @@ const n = {
20
20
  isDeletedField: "isDeleted",
21
21
  isPinnedField: "isPinned",
22
22
  typingField: "typing",
23
- suggestedActionsField: "suggestedActions"
24
- }, r = (i, d = {}) => {
25
- const t = { ...n, ...d };
26
- let e;
27
- i.author && typeof i.author == "object" ? e = {
28
- id: i.author.id || i.author[t.authorIdField] || i[t.authorIdField] || "",
29
- name: i.author.name || i.author[t.authorNameField] || i[t.authorNameField],
30
- avatarUrl: i.author.avatarUrl || i.author[t.authorImageUrlField] || i[t.authorImageUrlField],
31
- avatarAltText: i.author.avatarAltText || i.author[t.authorImageAltTextField] || i[t.authorImageAltTextField]
32
- } : e = {
33
- id: i[t.authorIdField] || i.authorId || "",
34
- name: i[t.authorNameField] || i.authorName,
35
- avatarUrl: i[t.authorImageUrlField] || i.authorImageUrl,
36
- avatarAltText: i[t.authorImageAltTextField] || i.authorImageAltText
23
+ suggestedActionsField: "suggestedActions",
24
+ isFailedField: "isFailed"
25
+ }, F = (i, d = {}) => {
26
+ const e = { ...n, ...d };
27
+ let t;
28
+ i.author && typeof i.author == "object" ? t = {
29
+ id: i.author.id || i.author[e.authorIdField] || i[e.authorIdField] || "",
30
+ name: i.author.name || i.author[e.authorNameField] || i[e.authorNameField],
31
+ avatarUrl: i.author.avatarUrl || i.author[e.authorImageUrlField] || i[e.authorImageUrlField],
32
+ avatarAltText: i.author.avatarAltText || i.author[e.authorImageAltTextField] || i[e.authorImageAltTextField]
33
+ } : t = {
34
+ id: i[e.authorIdField] || i.authorId || "",
35
+ name: i[e.authorNameField] || i.authorName,
36
+ avatarUrl: i[e.authorImageUrlField] || i.authorImageUrl,
37
+ avatarAltText: i[e.authorImageAltTextField] || i.authorImageAltText
37
38
  };
38
39
  let o;
39
- i.timestamp ? o = new Date(i.timestamp) : i[t.timestampField] ? o = new Date(i[t.timestampField]) : o = /* @__PURE__ */ new Date();
40
+ i.timestamp ? o = new Date(i.timestamp) : i[e.timestampField] ? o = new Date(i[e.timestampField]) : o = /* @__PURE__ */ new Date();
40
41
  const l = {
41
- id: i.id !== void 0 ? i.id : i[t.idField],
42
- text: i.text !== void 0 ? i.text : i[t.textField] || "",
43
- author: e,
42
+ id: i.id !== void 0 ? i.id : i[e.idField],
43
+ text: i.text !== void 0 ? i.text : i[e.textField] || "",
44
+ author: t,
44
45
  timestamp: o,
45
- status: i.status !== void 0 ? i.status : i[t.statusField],
46
- attachments: i.attachments !== void 0 ? i.attachments : i[t.attachmentsField],
46
+ status: i.status !== void 0 ? i.status : i[e.statusField],
47
+ attachments: i.attachments !== void 0 ? i.attachments : i[e.attachmentsField],
47
48
  attachmentLayout: i.attachmentLayout || "list",
48
- suggestedActions: i.suggestedActions !== void 0 ? i.suggestedActions : i[t.suggestedActionsField],
49
- isPinned: i.isPinned !== void 0 ? i.isPinned : i[t.isPinnedField] || !1,
50
- typing: i.typing !== void 0 ? i.typing : i[t.typingField],
51
- files: i.files !== void 0 ? i.files : i[t.filesField] || []
49
+ suggestedActions: i.suggestedActions !== void 0 ? i.suggestedActions : i[e.suggestedActionsField],
50
+ isPinned: i.isPinned !== void 0 ? i.isPinned : i[e.isPinnedField] || !1,
51
+ typing: i.typing !== void 0 ? i.typing : i[e.typingField],
52
+ files: i.files !== void 0 ? i.files : i[e.filesField] || [],
53
+ isFailed: i.isFailed !== void 0 ? i.isFailed : i[e.isFailedField] || !1
52
54
  };
53
- return i.pinnedAt && (l.pinnedAt = new Date(i.pinnedAt)), i.pinnedBy && (l.pinnedBy = i.pinnedBy), i.replyToId !== void 0 ? l.replyToId = i.replyToId : i[t.replyToIdField] !== void 0 && (l.replyToId = i[t.replyToIdField]), i.isDeleted !== void 0 ? l.isDeleted = i.isDeleted : i[t.isDeletedField] !== void 0 && (l.isDeleted = i[t.isDeletedField]), { ...l, dataItem: i };
54
- }, u = (i, d = {}) => Array.isArray(i) ? i.map((t) => r(t, d)) : [], F = (i) => i && typeof i.id != "undefined" && typeof i.text == "string" && i.author && typeof i.author == "object" && typeof i.author.id != "undefined" && (i.timestamp instanceof Date || typeof i.timestamp == "string" || typeof i.timestamp == "number"), h = (i) => ({
55
+ return i.pinnedAt && (l.pinnedAt = new Date(i.pinnedAt)), i.pinnedBy && (l.pinnedBy = i.pinnedBy), i.replyToId !== void 0 ? l.replyToId = i.replyToId : i[e.replyToIdField] !== void 0 && (l.replyToId = i[e.replyToIdField]), i.isDeleted !== void 0 ? l.isDeleted = i.isDeleted : i[e.isDeletedField] !== void 0 && (l.isDeleted = i[e.isDeletedField]), { ...l, dataItem: i };
56
+ }, r = (i, d = {}) => Array.isArray(i) ? i.map((e) => F(e, d)) : [], u = (i) => i && typeof i.id != "undefined" && typeof i.text == "string" && i.author && typeof i.author == "object" && typeof i.author.id != "undefined" && (i.timestamp instanceof Date || typeof i.timestamp == "string" || typeof i.timestamp == "number"), h = (i) => ({
55
57
  textField: i.textField,
56
58
  statusField: i.statusField,
57
59
  authorIdField: i.authorIdField,
@@ -66,16 +68,17 @@ const n = {
66
68
  isDeletedField: i.isDeletedField,
67
69
  isPinnedField: i.isPinnedField,
68
70
  typingField: i.typingField,
69
- suggestedActionsField: i.suggestedActionsField
70
- }), f = (i, d = {}) => {
71
- const t = { ...n, ...d }, e = {};
72
- return i.id !== void 0 && (e[t.idField] = i.id), i.text !== void 0 && (e[t.textField] = i.text), i.status !== void 0 && (e[t.statusField] = i.status), i.timestamp !== void 0 && (e[t.timestampField] = i.timestamp), i.attachments !== void 0 && (e[t.attachmentsField] = i.attachments), i.files !== void 0 && (e[t.filesField] = i.files), i.suggestedActions !== void 0 && (e[t.suggestedActionsField] = i.suggestedActions), i.replyToId !== void 0 && (e[t.replyToIdField] = i.replyToId), i.isDeleted !== void 0 && (e[t.isDeletedField] = i.isDeleted), i.isPinned !== void 0 && (e[t.isPinnedField] = i.isPinned), i.typing !== void 0 && (e[t.typingField] = i.typing), i.author && (i.author.id !== void 0 && (e[t.authorIdField] = i.author.id), i.author.name !== void 0 && (e[t.authorNameField] = i.author.name), i.author.avatarUrl !== void 0 && (e[t.authorImageUrlField] = i.author.avatarUrl), i.author.avatarAltText !== void 0 && (e[t.authorImageAltTextField] = i.author.avatarAltText)), i.pinnedAt !== void 0 && (e.pinnedAt = i.pinnedAt), i.pinnedBy !== void 0 && (e.pinnedBy = i.pinnedBy), i.attachmentLayout !== void 0 && (e.attachmentLayout = i.attachmentLayout), e;
71
+ suggestedActionsField: i.suggestedActionsField,
72
+ isFailedField: i.isFailedField
73
+ }), s = (i, d = {}) => {
74
+ const e = { ...n, ...d }, t = {};
75
+ return i.id !== void 0 && (t[e.idField] = i.id), i.text !== void 0 && (t[e.textField] = i.text), i.status !== void 0 && (t[e.statusField] = i.status), i.isFailed !== void 0 && (t[e.isFailedField] = i.isFailed), i.timestamp !== void 0 && (t[e.timestampField] = i.timestamp), i.attachments !== void 0 && (t[e.attachmentsField] = i.attachments), i.files !== void 0 && (t[e.filesField] = i.files), i.suggestedActions !== void 0 && (t[e.suggestedActionsField] = i.suggestedActions), i.replyToId !== void 0 && (t[e.replyToIdField] = i.replyToId), i.isDeleted !== void 0 && (t[e.isDeletedField] = i.isDeleted), i.isPinned !== void 0 && (t[e.isPinnedField] = i.isPinned), i.typing !== void 0 && (t[e.typingField] = i.typing), i.author && (i.author.id !== void 0 && (t[e.authorIdField] = i.author.id), i.author.name !== void 0 && (t[e.authorNameField] = i.author.name), i.author.avatarUrl !== void 0 && (t[e.authorImageUrlField] = i.author.avatarUrl), i.author.avatarAltText !== void 0 && (t[e.authorImageAltTextField] = i.author.avatarAltText)), i.pinnedAt !== void 0 && (t.pinnedAt = i.pinnedAt), i.pinnedBy !== void 0 && (t.pinnedBy = i.pinnedBy), i.attachmentLayout !== void 0 && (t.attachmentLayout = i.attachmentLayout), t;
73
76
  };
74
77
  export {
75
78
  n as DEFAULT_FIELD_MAPPING,
76
79
  h as extractFieldMappingFromProps,
77
- F as isStandardMessageFormat,
78
- u as mapDataArrayToMessages,
79
- r as mapDataToMessage,
80
- f as mapMessageToCustomFormat
80
+ u as isStandardMessageFormat,
81
+ r as mapDataArrayToMessages,
82
+ F as mapDataToMessage,
83
+ s as mapMessageToCustomFormat
81
84
  };
@@ -5,7 +5,8 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { Message, ChatSuggestion } from '../../index.js';
8
+ import { Message } from '../../api/message.interface.js';
9
+ import { ChatSuggestion } from '../components/SuggestionsGroup.js';
9
10
  import * as React from 'react';
10
11
  interface UseChatScrollProps {
11
12
  viewItemsWrapperRef: React.RefObject<HTMLDivElement | null>;
@@ -29,4 +30,17 @@ interface UseChatScrollProps {
29
30
  * @hidden
30
31
  */
31
32
  export declare const useChatScroll: ({ viewItemsWrapperRef, isKeyboardNavigationActiveRef, processedMessages, suggestions }: UseChatScrollProps) => void;
33
+ interface UseHasScrollbarProps {
34
+ elementRef: React.RefObject<HTMLElement | null>;
35
+ }
36
+ /**
37
+ * A custom hook that detects whether a scrollbar is present on an element.
38
+ * Uses ResizeObserver to monitor changes in element dimensions.
39
+ *
40
+ * @param elementRef - Reference to the DOM element to monitor for scrollbar presence
41
+ * @returns boolean indicating whether a vertical scrollbar is visible
42
+ *
43
+ * @hidden
44
+ */
45
+ export declare const useHasScrollbar: ({ elementRef }: UseHasScrollbarProps) => boolean;
32
46
  export {};