@progress/kendo-react-conversational-ui 7.0.3-develop.1 → 7.0.3-develop.10
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/ChatPropsAndState.d.ts +1 -1
- package/Events.d.ts +1 -1
- package/LICENSE.md +1 -1
- package/NOTICE.txt +1 -1
- package/README.md +1 -1
- package/ViewItem.d.ts +1 -1
- package/api/action.interface.d.ts +1 -1
- package/api/attachment.interface.d.ts +1 -1
- package/api/message.interface.d.ts +1 -1
- package/api/user.interface.d.ts +1 -1
- package/components/Action.d.ts +1 -1
- package/components/ActionGroup.d.ts +1 -1
- package/components/Attachment.d.ts +1 -1
- package/components/AttachmentGroup.d.ts +1 -1
- package/components/Chat.d.ts +1 -1
- package/components/ChatMessage.d.ts +1 -1
- package/components/DateMarker.d.ts +1 -1
- package/components/MessageGroup.d.ts +1 -1
- package/components/NewMessage.d.ts +1 -1
- package/components/Toolbar.d.ts +1 -1
- package/components/base/FocusableUponSelection.d.ts +1 -1
- package/components/base/SelectableItemsContainer.d.ts +1 -1
- package/components/templates/HeroCard.d.ts +1 -1
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +2 -2
- package/messages/index.d.ts +1 -1
- package/package-metadata.d.ts +1 -1
- package/package.json +5 -5
- package/utils.d.ts +1 -1
package/ChatPropsAndState.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Message, User, ChatActionExecuteEvent, ChatMessageSendEvent, ChatToolbarActionExecuteEvent } from '.';
|
package/Events.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Chat, Action, Message, HeroCard } from '.';
|
package/LICENSE.md
CHANGED
|
@@ -8,4 +8,4 @@ This is commercial software. To use it, you need to agree to the [**End User Lic
|
|
|
8
8
|
|
|
9
9
|
All available KendoReact commercial licenses may be obtained at the [KendoReact website](https://www.telerik.com/kendo-react-ui/pricing).
|
|
10
10
|
|
|
11
|
-
*Copyright ©
|
|
11
|
+
*Copyright © 2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.*
|
package/NOTICE.txt
CHANGED
package/README.md
CHANGED
|
@@ -48,6 +48,6 @@ High-level component overview pages
|
|
|
48
48
|
|
|
49
49
|
* [React Conversational UI](https://www.telerik.com/kendo-react-ui/conversationalui)
|
|
50
50
|
|
|
51
|
-
*Copyright ©
|
|
51
|
+
*Copyright © 2024 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.*
|
|
52
52
|
|
|
53
53
|
*Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries.*
|
package/ViewItem.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Message, User, Action, Attachment, AttachmentLayout } from '.';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Action } from './action.interface';
|
package/api/user.interface.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
/**
|
package/components/Action.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Action as ActionModel } from './..';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { ActionGroup as ActionGroupModel } from './../ViewItem';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Attachment as AttachmentModel } from './..';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { AttachmentGroup as AttachmentGroupModel } from './../ViewItem';
|
package/components/Chat.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
package/components/Toolbar.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
(function(o,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("react"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl"),require("prop-types"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-layout")):typeof define=="function"&&define.amd?define(["exports","react","@progress/kendo-react-common","@progress/kendo-react-intl","prop-types","@progress/kendo-svg-icons","@progress/kendo-react-buttons","@progress/kendo-react-layout"],p):(o=typeof globalThis<"u"?globalThis:o||self,p(o.KendoReactConversationalUi={},o.React,o.KendoReactCommon,o.KendoReactIntl,o.PropTypes,o.KendoSvgIcons,o.KendoReactButtons,o.KendoReactLayout))})(this,function(o,p,a,c,l,m,u,T){"use strict";"use client";function D(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const s=D(p);class g extends s.Component{componentDidUpdate(e){!e.selected&&this.props.selected&&this.elementToFocus.focus()}}class d extends g{render(){return s.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>this.elementToFocus=e},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?s.createElement("div",{className:"k-chat-bubble"},s.createElement("div",{className:"k-typing-indicator"},s.createElement("span",null),s.createElement("span",null),s.createElement("span",null))):this.props.template?s.createElement(this.props.template,{item:this.props.item}):this.props.item.text?s.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=s.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},c.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=s.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return a.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}}d.defaultProps={dateFormat:"g",tabIndex:-1},c.registerForIntl(d);const v=(i,e)=>i&&e.author&&i.id===e.author.id,I=i=>i[i.length-1],M=(i,e)=>i&&e&&(e.getDate()!==i.getDate()||e.getMonth()!==i.getMonth()||e.getFullYear()!==i.getFullYear()),B=(i,e)=>{const t=e.timestamp,r=I(i);if(t&&(!r||M(t,r.timestamp))){const n={type:"date-marker",timestamp:t,trackBy:t.getTime()};i.push(n)}},K=(i,e,t)=>{const r=I(i);let n;e.typing&&!t||(r&&r.type==="message-group"&&(n=r.messages),n&&v(e.author,I(n))?n.push(e):i.push({type:"message-group",messages:[e],author:e.author,timestamp:e.timestamp,trackBy:e}))},F=i=>(e,t,r)=>{const n=r===i-1;return B(e,t),K(e,t,n),t.attachments&&t.attachments.length>1&&e.push({type:"attachment-group",attachments:t.attachments,attachmentLayout:t.attachmentLayout,timestamp:t.timestamp,trackBy:t}),t.suggestedActions&&n&&e.push({type:"action-group",actions:t.suggestedActions,timestamp:t.timestamp,trackBy:t}),e};function V(i){let e=0;i.forEach(t=>{t.type==="message-group"?t.messages.forEach(r=>{r.selectionIndex=e++}):(t.type==="attachment-group"||t.type==="action-group")&&(t.selectionIndex=e++)}),i.lastSelectionIndex=e-1}const G=i=>{const t=i.slice().reduce(F(i.length),[]);return V(t),t};class A extends g{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===a.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return s.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>this.elementToFocus=e,onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return a.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}}class S extends s.Component{constructor(){super(...arguments),this.state={selectedItemIndex:null},this.onRequestContainerSelection=()=>this.props.onRequestSelection(this.props.group.selectionIndex),this.onKeyDown=e=>{let t=null,r,n;this.isKeyboardNavigationLeftRight?(r=a.Keys.left,n=a.Keys.right):(r=a.Keys.up,n=a.Keys.down),e.keyCode===r?t=this.navigate(!1):e.keyCode===n&&(t=this.navigate(!0)),t!==null&&(e.preventDefault(),e.stopPropagation())}}static getDerivedStateFromProps(e,t){return!e.selected&&t.selectedItemIndex!==null?{selectedItemIndex:null}:e.selected&&t.selectedItemIndex===null?{selectedItemIndex:0}:null}navigate(e,t=0){let r=null,n=this.state.selectedItemIndex;return e?n===null?r=t:n<this.getLastSelectionIndex()&&(r=n+1):n===null?r=0:n>0&&(r=n-1),r!==null&&this.setState({selectedItemIndex:r}),r}get isKeyboardNavigationLeftRight(){return!0}getLastSelectionIndex(){let e=-1;if(this.props.group.type==="action-group"){const t=this.props.group;e=t.actions?t.actions.length-1:-1}else if(this.props.group.type==="attachment-group"){const t=this.props.group;e=t.attachments?t.attachments.length-1:-1}return e}}class q extends S{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return s.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map((t,r)=>s.createElement(A,{item:t,onActionExecute:this.props.onActionExecute,selected:r===this.state.selectedItemIndex,isFirstItemInGroup:r===0,isLastItemInGroup:r===e,key:r})))}getClassNames(){return a.classNames("k-quick-replies")}}class N extends g{render(){return s.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:e=>this.elementToFocus=e},this.props.template?s.createElement(this.props.template,{item:this.props.item}):s.createElement("div",{className:"k-card"},s.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(this.props.tabbable!==void 0)return this.props.tabbable?0:-1}getClassNames(){return a.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?s.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?s.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return this.props.item.contentType.indexOf("image/")===0?s.createElement("img",{src:this.props.item.content}):this.props.item.content}}class O extends S{render(){const e=this.isCardDeckLayout(this.props),t=s.createElement("div",{className:this.getClassNames(),onKeyDown:e?void 0:this.onKeyDown},this.props.group.attachments.map((r,n)=>s.createElement(N,{item:r,template:this.props.itemTemplate,selected:n===this.state.selectedItemIndex,tabbable:this.props.isLastGroup&&n===this.state.selectedItemIndex,isFirstItemInGroup:n===0,isLastItemInGroup:n===this.getLastItemIndex(),onClick:()=>this.onAttachmentClick(n),key:n})));return e?s.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:this.onKeyDown},this.getLeftScrollBtn(),t,this.getRightScrollBtn()):t}get isKeyboardNavigationLeftRight(){return this.isCardDeckLayout(this.props)}getLastItemIndex(){return this.props.group.attachments.length-1}getLeftScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex&&(e=s.createElement(u.Button,{icon:"chevron-left",onClick:()=>this.onNavigateBtnClick(!1),svgIcon:m.chevronLeftIcon})),e}getRightScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex!==this.getLastItemIndex()&&(e=s.createElement(u.Button,{icon:"chevron-right",onClick:()=>this.onNavigateBtnClick(!0),svgIcon:m.chevronRightIcon})),e}onAttachmentClick(e){this.onRequestContainerSelection(),this.setState({selectedItemIndex:e})}onNavigateBtnClick(e){this.onRequestContainerSelection(),this.navigate(e,1)}isCardDeckLayout(e){return e.group.attachmentLayout!=="list"}getClassNames(){return a.classNames({"k-card-list":this.props.group.attachmentLayout,"k-card-deck":this.isCardDeckLayout(this.props)})}}class C extends s.Component{render(){const e=this.props.item;return s.createElement("div",{className:"k-timestamp"},c.provideIntlService(this).formatDate(e.timestamp,"D"))}}c.registerForIntl(C);const f="newMessage.sendButton",k="newMessage.optionsButton",y="newMessage.messageInput",E="avatar.alt",x="messageList.ariaLabel",h={[f]:"Send",[k]:"Options",[y]:"Message",[E]:"Avatar",[x]:"Message list"};class R extends s.Component{render(){const{avatarUrl:e,avatarAltText:t,name:r}=this.props.group.author,n=c.provideLocalizationService(this);return s.createElement("div",{className:this.getMsgGroupClassNames()},r&&s.createElement("p",{className:"k-author"},r),e&&s.createElement(T.Avatar,{type:"image"},s.createElement("img",{src:e,alt:t!==void 0?t:n.toLanguageString(E,h[E])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return a.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":v(this.props.user,this.props.group.messages[0])})}getGroupMessagesView(){const e=this.props.group.messages.length-1;return this.props.group.messages.map((t,r)=>{const n=[s.createElement(this.props.message,{item:t,template:this.props.itemTemplate,selected:t.selectionIndex===this.props.selectedItemIndex,onRequestSelection:this.props.onRequestSelection,tabIndex:r===e&&this.props.isLastGroup?0:-1,isFirstItemInGroup:r===0,isLastItemInGroup:r===e,isOnlyItemInGroup:e===0,key:r})];return t.attachments&&t.attachments.length===1&&n.push(s.createElement(N,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${r}`})),n})}}class U extends s.Component{render(){return s.createElement("div",{className:"k-toolbar-box"},s.createElement("div",{className:"k-button-list"},this.props.children))}}class W extends s.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.onInputKeyDown=e=>{e.keyCode===a.Keys.enter&&this.sendMessage(e)},this.sendMessage=e=>{if(this.props.onMessageSend&&this.inputEl!==null){const t=this.inputEl.value;if(t){const r={author:this.props.user,text:t,timestamp:new Date};this.props.onMessageSend(r,e)}}this.inputEl!==null&&(this.inputEl.value=null)}}render(){const e=c.provideLocalizationService(this),t=s.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:w=>this.inputEl=w,"aria-label":e.toLanguageString(y,h[y])}),r=s.createElement(u.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:m.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(f,h[f]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),n=s.createElement(u.Button,{fillMode:"flat",themeColor:"base",rounded:null,className:"k-button-toggle",icon:"more-horizontal",svgIcon:m.moreHorizontalIcon,onClick:w=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,w),"aria-label":e.toLanguageString(k,h[k])});return s.createElement(s.Fragment,null,s.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?s.createElement(this.props.MessageBox,{messageInput:t,sendButton:r,toolbarButton:n}):s.createElement(s.Fragment,null,t,s.createElement("span",{className:"k-input-suffix"},this.props.toolbar&&n,r))),this.props.showToolbar&&s.createElement(U,null,this.props.toolbar))}focusInput(){this.inputEl!==null&&this.inputEl.focus()}getClassNames(){return a.classNames("k-input-inner",{"k-focus":this.state.focused})}}const z={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},L=class extends s.Component{constructor(i){super(i),this.viewItems=[],this.isDirectionRightToLeft=!1,this.scrollToBottomOnLoadingData=!0,this.onFocus=()=>{clearTimeout(this.timeoutIdForChatLosingFocus)},this.onBlur=()=>{this.timeoutIdForChatLosingFocus=window.setTimeout(()=>{this.setState({selectedItemIndex:null})},0)},this.onSelectionRequested=e=>{this.setState({selectedItemIndex:e})},this.onKeyDown=e=>{let t=null,r=this.state.selectedItemIndex!==null?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===a.Keys.up?r===null?t=0:r>0&&(t=r-1):e.keyCode===a.Keys.down&&(r===null?t=0:r<this.viewItems.lastSelectionIndex&&(t=r+1)),t!==null&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{a.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(a.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value);break}this.newMsgComp.focusInput()}},a.validatePackage(z),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const i=c.provideLocalizationService(this);return s.createElement("div",{style:{width:this.props.width},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>this.chatWrapperEl=e},s.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":i.toLanguageString(x,h[x]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>this.viewItemsWrapperEl=e},s.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),s.createElement(W,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>this.newMsgComp=e,placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}))}componentDidMount(){this.setState({isFirstRender:!1},()=>{this.nextTickId=window.setTimeout(()=>this.scrollViewItemsToBottom(),250)})}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(i){i.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return a.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(i){return!!(i.dir!==void 0?i.dir==="rtl":this.chatWrapperEl&&getComputedStyle(this.chatWrapperEl).direction==="rtl")}renderViewItems(){const i=this.viewItems.length-1;return this.viewItems.map((e,t)=>{if(e.type==="date-marker")return s.createElement(C,{item:e,key:t});if(e.type==="message-group")return s.createElement(R,{group:e,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:t===i,key:t,message:this.props.message||L.defaultProps.message});if(e.type==="attachment-group")return s.createElement(O,{group:e,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===i,key:t});if(e.type==="action-group")return s.createElement(q,{group:e,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===i,key:t})})}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(i){return i.length>0?G(i):[]}};let b=L;b.propTypes={messages:l.arrayOf(l.object),user:l.object,messageTemplate:l.any,attachmentTemplate:l.any,width:l.oneOfType([l.string,l.number]),onMessageSend:l.func,onActionExecute:l.func,dir:l.string,messageBox:l.any},b.defaultProps={messages:[],dateFormat:"g",message:d};class j extends s.Component{constructor(){super(...arguments),this.onBtnClick=(e,t)=>{a.dispatchEvent(this.props.onActionExecute,t,this,{action:e})}}render(){return s.createElement("div",{className:"k-card"},s.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),s.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),s.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map((e,t)=>s.createElement("span",{className:"k-card-action",key:t},s.createElement(u.Button,{fillMode:"flat",onClick:r=>this.onBtnClick(e,r)},e.title)))}getTitleView(){let e=null;return this.props.title&&(e=s.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=s.createElement("h6",{className:"k-card-subtitle"},this.props.subtitle)),e}}o.Chat=b,o.ChatMessage=d,o.HeroCard=j,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
export * from './index';
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import type { MessageModel } from './ViewItem';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),a=require("@progress/kendo-react-common"),l=require("@progress/kendo-react-intl"),r=require("prop-types"),u=require("@progress/kendo-svg-icons"),p=require("@progress/kendo-react-buttons"),T=require("@progress/kendo-react-layout");function L(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const s=L(N);class E extends s.Component{componentDidUpdate(e){!e.selected&&this.props.selected&&this.elementToFocus.focus()}}class h extends E{render(){return s.createElement("div",{className:this.getClassNames(),tabIndex:this.props.tabIndex,onClick:()=>this.props.onRequestSelection(this.props.item.selectionIndex),onFocus:()=>this.props.onRequestSelection(this.props.item.selectionIndex),ref:e=>this.elementToFocus=e},this.getTimestampView(),this.getMainView(),this.getStatusView())}getMainView(){return this.props.item.typing?s.createElement("div",{className:"k-chat-bubble"},s.createElement("div",{className:"k-typing-indicator"},s.createElement("span",null),s.createElement("span",null),s.createElement("span",null))):this.props.template?s.createElement(this.props.template,{item:this.props.item}):this.props.item.text?s.createElement("div",{className:"k-chat-bubble"},this.props.item.text):null}getTimestampView(){let e=null;return this.props.item.timestamp&&(e=s.createElement("time",{className:"k-message-time","aria-hidden":!this.props.selected},l.provideIntlService(this).formatDate(this.props.item.timestamp,this.props.dateFormat))),e}getStatusView(){let e=null;return this.props.item.status&&(e=s.createElement("span",{className:"k-message-status"},this.props.item.status)),e}getClassNames(){return a.classNames({"k-only":this.props.isOnlyItemInGroup},{"k-first":this.props.isFirstItemInGroup&&!this.props.isOnlyItemInGroup},{"k-last":this.props.isLastItemInGroup&&!this.props.isOnlyItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected},"k-message")}}h.defaultProps={dateFormat:"g",tabIndex:-1};l.registerForIntl(h);const b=(i,e)=>i&&e.author&&i.id===e.author.id,d=i=>i[i.length-1],D=(i,e)=>i&&e&&(e.getDate()!==i.getDate()||e.getMonth()!==i.getMonth()||e.getFullYear()!==i.getFullYear()),M=(i,e)=>{const t=e.timestamp,n=d(i);if(t&&(!n||D(t,n.timestamp))){const o={type:"date-marker",timestamp:t,trackBy:t.getTime()};i.push(o)}},B=(i,e,t)=>{const n=d(i);let o;e.typing&&!t||(n&&n.type==="message-group"&&(o=n.messages),o&&b(e.author,d(o))?o.push(e):i.push({type:"message-group",messages:[e],author:e.author,timestamp:e.timestamp,trackBy:e}))},R=i=>(e,t,n)=>{const o=n===i-1;return M(e,t),B(e,t,o),t.attachments&&t.attachments.length>1&&e.push({type:"attachment-group",attachments:t.attachments,attachmentLayout:t.attachmentLayout,timestamp:t.timestamp,trackBy:t}),t.suggestedActions&&o&&e.push({type:"action-group",actions:t.suggestedActions,timestamp:t.timestamp,trackBy:t}),e};function F(i){let e=0;i.forEach(t=>{t.type==="message-group"?t.messages.forEach(n=>{n.selectionIndex=e++}):(t.type==="attachment-group"||t.type==="action-group")&&(t.selectionIndex=e++)}),i.lastSelectionIndex=e-1}const K=i=>{const t=i.slice().reduce(R(i.length),[]);return F(t),t};class V extends E{constructor(){super(...arguments),this.onKeyDown=e=>{e.keyCode===a.Keys.enter&&this.props.onActionExecute(this.props.item,e)}}render(){return s.createElement("span",{role:"button",className:this.getClassNames(),onClick:e=>this.props.onActionExecute(this.props.item,e),ref:e=>this.elementToFocus=e,onKeyDown:this.onKeyDown,tabIndex:0},this.props.item.title||this.props.item.value)}getClassNames(){return a.classNames("k-quick-reply",{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup},{"k-selected":this.props.selected},{"k-focus":this.props.selected})}}class x extends s.Component{constructor(){super(...arguments),this.state={selectedItemIndex:null},this.onRequestContainerSelection=()=>this.props.onRequestSelection(this.props.group.selectionIndex),this.onKeyDown=e=>{let t=null,n,o;this.isKeyboardNavigationLeftRight?(n=a.Keys.left,o=a.Keys.right):(n=a.Keys.up,o=a.Keys.down),e.keyCode===n?t=this.navigate(!1):e.keyCode===o&&(t=this.navigate(!0)),t!==null&&(e.preventDefault(),e.stopPropagation())}}static getDerivedStateFromProps(e,t){return!e.selected&&t.selectedItemIndex!==null?{selectedItemIndex:null}:e.selected&&t.selectedItemIndex===null?{selectedItemIndex:0}:null}navigate(e,t=0){let n=null,o=this.state.selectedItemIndex;return e?o===null?n=t:o<this.getLastSelectionIndex()&&(n=o+1):o===null?n=0:o>0&&(n=o-1),n!==null&&this.setState({selectedItemIndex:n}),n}get isKeyboardNavigationLeftRight(){return!0}getLastSelectionIndex(){let e=-1;if(this.props.group.type==="action-group"){const t=this.props.group;e=t.actions?t.actions.length-1:-1}else if(this.props.group.type==="attachment-group"){const t=this.props.group;e=t.attachments?t.attachments.length-1:-1}return e}}class G extends x{constructor(e){super(e)}render(){const e=this.props.group.actions?this.props.group.actions.length-1:0;return s.createElement("div",{className:this.getClassNames(),onClick:this.onRequestContainerSelection,onKeyDown:this.onKeyDown},this.props.group.actions&&this.props.group.actions.map((t,n)=>s.createElement(V,{item:t,onActionExecute:this.props.onActionExecute,selected:n===this.state.selectedItemIndex,isFirstItemInGroup:n===0,isLastItemInGroup:n===e,key:n})))}getClassNames(){return a.classNames("k-quick-replies")}}class w extends E{render(){return s.createElement("div",{className:this.getClassNames(),tabIndex:this.getTabIndexValue(),onClick:this.props.onClick,ref:e=>this.elementToFocus=e},this.props.template?s.createElement(this.props.template,{item:this.props.item}):s.createElement("div",{className:"k-card"},s.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView(),this.getContentView())))}getTabIndexValue(){if(this.props.tabbable!==void 0)return this.props.tabbable?0:-1}getClassNames(){return a.classNames({"k-selected":this.props.selected},{"k-focus":this.props.selected},{"k-first":this.props.isFirstItemInGroup},{"k-last":this.props.isLastItemInGroup})}getTitleView(){return this.props.item.title?s.createElement("h5",{className:"k-card-title"},this.props.item.title):null}getSubtitleView(){return this.props.item.subtitle?s.createElement("h6",{className:"k-card-subtitle"},this.props.item.subtitle):null}getContentView(){return this.props.item.contentType.indexOf("image/")===0?s.createElement("img",{src:this.props.item.content}):this.props.item.content}}class A extends x{render(){const e=this.isCardDeckLayout(this.props),t=s.createElement("div",{className:this.getClassNames(),onKeyDown:e?void 0:this.onKeyDown},this.props.group.attachments.map((n,o)=>s.createElement(w,{item:n,template:this.props.itemTemplate,selected:o===this.state.selectedItemIndex,tabbable:this.props.isLastGroup&&o===this.state.selectedItemIndex,isFirstItemInGroup:o===0,isLastItemInGroup:o===this.getLastItemIndex(),onClick:()=>this.onAttachmentClick(o),key:o})));return e?s.createElement("div",{className:"k-card-deck-scrollwrap",onKeyDown:this.onKeyDown},this.getLeftScrollBtn(),t,this.getRightScrollBtn()):t}get isKeyboardNavigationLeftRight(){return this.isCardDeckLayout(this.props)}getLastItemIndex(){return this.props.group.attachments.length-1}getLeftScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex&&(e=s.createElement(p.Button,{icon:"chevron-left",onClick:()=>this.onNavigateBtnClick(!1),svgIcon:u.chevronLeftIcon})),e}getRightScrollBtn(){let e=null;return this.isCardDeckLayout(this.props)&&this.state.selectedItemIndex!==this.getLastItemIndex()&&(e=s.createElement(p.Button,{icon:"chevron-right",onClick:()=>this.onNavigateBtnClick(!0),svgIcon:u.chevronRightIcon})),e}onAttachmentClick(e){this.onRequestContainerSelection(),this.setState({selectedItemIndex:e})}onNavigateBtnClick(e){this.onRequestContainerSelection(),this.navigate(e,1)}isCardDeckLayout(e){return e.group.attachmentLayout!=="list"}getClassNames(){return a.classNames({"k-card-list":this.props.group.attachmentLayout,"k-card-deck":this.isCardDeckLayout(this.props)})}}class S extends s.Component{render(){const e=this.props.item;return s.createElement("div",{className:"k-timestamp"},l.provideIntlService(this).formatDate(e.timestamp,"D"))}}l.registerForIntl(S);const g="newMessage.sendButton",I="newMessage.optionsButton",f="newMessage.messageInput",k="avatar.alt",y="messageList.ariaLabel",c={[g]:"Send",[I]:"Options",[f]:"Message",[k]:"Avatar",[y]:"Message list"};class q extends s.Component{render(){const{avatarUrl:e,avatarAltText:t,name:n}=this.props.group.author,o=l.provideLocalizationService(this);return s.createElement("div",{className:this.getMsgGroupClassNames()},n&&s.createElement("p",{className:"k-author"},n),e&&s.createElement(T.Avatar,{type:"image"},s.createElement("img",{src:e,alt:t!==void 0?t:o.toLanguageString(k,c[k])})),this.getGroupMessagesView())}getMsgGroupClassNames(){return a.classNames("k-message-group",{"k-no-avatar":!this.props.group.author.avatarUrl,"k-alt":b(this.props.user,this.props.group.messages[0])})}getGroupMessagesView(){const e=this.props.group.messages.length-1;return this.props.group.messages.map((t,n)=>{const o=[s.createElement(this.props.message,{item:t,template:this.props.itemTemplate,selected:t.selectionIndex===this.props.selectedItemIndex,onRequestSelection:this.props.onRequestSelection,tabIndex:n===e&&this.props.isLastGroup?0:-1,isFirstItemInGroup:n===0,isLastItemInGroup:n===e,isOnlyItemInGroup:e===0,key:n})];return t.attachments&&t.attachments.length===1&&o.push(s.createElement(w,{item:t.attachments[0],template:this.props.attachmentTemplate,selected:!1,key:`att-${n}`})),o})}}class O extends s.Component{render(){return s.createElement("div",{className:"k-toolbar-box"},s.createElement("div",{className:"k-button-list"},this.props.children))}}class P extends s.Component{constructor(){super(...arguments),this.state={focused:!1},this.inputEl=null,this.onInputKeyDown=e=>{e.keyCode===a.Keys.enter&&this.sendMessage(e)},this.sendMessage=e=>{if(this.props.onMessageSend&&this.inputEl!==null){const t=this.inputEl.value;if(t){const n={author:this.props.user,text:t,timestamp:new Date};this.props.onMessageSend(n,e)}}this.inputEl!==null&&(this.inputEl.value=null)}}render(){const e=l.provideLocalizationService(this),t=s.createElement("input",{type:"text",className:this.getClassNames(),placeholder:this.props.placeholder,onKeyDown:this.onInputKeyDown,onFocus:()=>this.setState({focused:!0}),onBlur:()=>this.setState({focused:!1}),ref:m=>this.inputEl=m,"aria-label":e.toLanguageString(f,c[f])}),n=s.createElement(p.Button,{fillMode:"flat",themeColor:"base",className:"k-chat-send",icon:"paper-plane",svgIcon:u.paperPlaneIcon,onClick:this.sendMessage,"aria-label":e.toLanguageString(g,c[g]),dir:this.props.isDirectionRightToLeft?"rtl":void 0}),o=s.createElement(p.Button,{fillMode:"flat",themeColor:"base",rounded:null,className:"k-button-toggle",icon:"more-horizontal",svgIcon:u.moreHorizontalIcon,onClick:m=>this.props.onToolbarActionButtonClick(!this.props.showToolbar,m),"aria-label":e.toLanguageString(I,c[I])});return s.createElement(s.Fragment,null,s.createElement("span",{className:"k-message-box k-textbox k-input k-input-md k-rounded-md k-input-solid"},this.props.MessageBox?s.createElement(this.props.MessageBox,{messageInput:t,sendButton:n,toolbarButton:o}):s.createElement(s.Fragment,null,t,s.createElement("span",{className:"k-input-suffix"},this.props.toolbar&&o,n))),this.props.showToolbar&&s.createElement(O,null,this.props.toolbar))}focusInput(){this.inputEl!==null&&this.inputEl.focus()}getClassNames(){return a.classNames("k-input-inner",{"k-focus":this.state.focused})}}const W={name:"@progress/kendo-react-conversational-ui",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},v=class extends s.Component{constructor(i){super(i),this.viewItems=[],this.isDirectionRightToLeft=!1,this.scrollToBottomOnLoadingData=!0,this.onFocus=()=>{clearTimeout(this.timeoutIdForChatLosingFocus)},this.onBlur=()=>{this.timeoutIdForChatLosingFocus=window.setTimeout(()=>{this.setState({selectedItemIndex:null})},0)},this.onSelectionRequested=e=>{this.setState({selectedItemIndex:e})},this.onKeyDown=e=>{let t=null,n=this.state.selectedItemIndex!==null?this.state.selectedItemIndex:this.viewItems.lastSelectionIndex;e.keyCode===a.Keys.up?n===null?t=0:n>0&&(t=n-1):e.keyCode===a.Keys.down&&(n===null?t=0:n<this.viewItems.lastSelectionIndex&&(t=n+1)),t!==null&&(this.setState({selectedItemIndex:t}),e.preventDefault())},this.onMessageSend=(e,t)=>{a.dispatchEvent(this.props.onMessageSend,t,this,{message:e})},this.onActionExecute=(e,t)=>{if(a.dispatchEvent(this.props.onActionExecute,t,this,{action:e}),!t.isDefaultPrevented()){switch(e.type){case"reply":this.onMessageSend({author:this.props.user,text:e.value,timestamp:new Date},t);break;case"call":window.open("tel:"+e.value);break;case"openUrl":window.open(e.value);break}this.newMsgComp.focusInput()}},a.validatePackage(W),this.state={selectedItemIndex:null,isFirstRender:!0}}render(){this.viewItems=this.getViewItemsFromMsgs(this.props.messages),this.isDirectionRightToLeft=this.checkIsDirectionRightToLeft(this.props);const i=l.provideLocalizationService(this);return s.createElement("div",{style:{width:this.props.width},onKeyDown:this.onKeyDown,className:this.getClassNames(),ref:e=>this.chatWrapperEl=e},s.createElement("div",{className:"k-message-list k-avatars",onBlur:this.onBlur,onFocus:this.onFocus,role:"log","aria-label":i.toLanguageString(y,c[y]),"aria-live":"polite",onScroll:e=>{this.scrollToBottomOnLoadingData=e.currentTarget.scrollTop===e.currentTarget.scrollHeight-e.currentTarget.clientHeight},ref:e=>this.viewItemsWrapperEl=e},s.createElement("div",{className:"k-message-list-content"},this.renderViewItems())),s.createElement(P,{user:this.props.user,onMessageSend:this.onMessageSend,isDirectionRightToLeft:this.isDirectionRightToLeft,ref:e=>this.newMsgComp=e,placeholder:this.props.placeholder,MessageBox:this.props.messageBox,toolbar:this.props.toolbar,onToolbarActionButtonClick:this.props.onToolbarActionExecute,showToolbar:this.props.showToolbar}))}componentDidMount(){this.setState({isFirstRender:!1},()=>{this.nextTickId=window.setTimeout(()=>this.scrollViewItemsToBottom(),250)})}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidUpdate(i){i.messages.length!==this.props.messages.length&&this.scrollToBottomOnLoadingData&&this.scrollViewItemsToBottom()}getClassNames(){return a.classNames("k-chat",this.props.className,{"k-rtl":this.isDirectionRightToLeft})}checkIsDirectionRightToLeft(i){return!!(i.dir!==void 0?i.dir==="rtl":this.chatWrapperEl&&getComputedStyle(this.chatWrapperEl).direction==="rtl")}renderViewItems(){const i=this.viewItems.length-1;return this.viewItems.map((e,t)=>{if(e.type==="date-marker")return s.createElement(S,{item:e,key:t});if(e.type==="message-group")return s.createElement(q,{group:e,itemTemplate:this.props.messageTemplate,attachmentTemplate:this.props.attachmentTemplate,user:this.props.user,selectedItemIndex:this.state.selectedItemIndex,onRequestSelection:this.onSelectionRequested,isLastGroup:t===i,key:t,message:this.props.message||v.defaultProps.message});if(e.type==="attachment-group")return s.createElement(A,{group:e,itemTemplate:this.props.attachmentTemplate,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===i,key:t});if(e.type==="action-group")return s.createElement(G,{group:e,onActionExecute:this.onActionExecute,onRequestSelection:this.onSelectionRequested,selected:e.selectionIndex===this.state.selectedItemIndex,isLastGroup:t===i,key:t})})}scrollViewItemsToBottom(){this.viewItemsWrapperEl&&(this.viewItemsWrapperEl.scrollTop=this.viewItemsWrapperEl.scrollHeight-this.viewItemsWrapperEl.clientHeight)}getViewItemsFromMsgs(i){return i.length>0?K(i):[]}};let C=v;C.propTypes={messages:r.arrayOf(r.object),user:r.object,messageTemplate:r.any,attachmentTemplate:r.any,width:r.oneOfType([r.string,r.number]),onMessageSend:r.func,onActionExecute:r.func,dir:r.string,messageBox:r.any};C.defaultProps={messages:[],dateFormat:"g",message:h};class U extends s.Component{constructor(){super(...arguments),this.onBtnClick=(e,t)=>{a.dispatchEvent(this.props.onActionExecute,t,this,{action:e})}}render(){return s.createElement("div",{className:"k-card"},s.createElement("img",{className:"k-card-image",src:this.props.imageUrl,style:{maxWidth:this.props.imageMaxWidth}}),s.createElement("div",{className:"k-card-body"},this.getTitleView(),this.getSubtitleView()),s.createElement("div",{className:"k-card-actions k-card-actions-vertical"},this.getActionsView()))}getActionsView(){return this.props.actions.map((e,t)=>s.createElement("span",{className:"k-card-action",key:t},s.createElement(p.Button,{fillMode:"flat",onClick:n=>this.onBtnClick(e,n)},e.title)))}getTitleView(){let e=null;return this.props.title&&(e=s.createElement("h5",{className:"k-card-title"},this.props.title)),e}getSubtitleView(){let e=null;return this.props.subtitle&&(e=s.createElement("h6",{className:"k-card-subtitle"},this.props.subtitle)),e}}exports.Chat=C;exports.ChatMessage=h;exports.HeroCard=U;
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
"use client";
|
|
@@ -446,7 +446,7 @@ const _ = {
|
|
|
446
446
|
name: "@progress/kendo-react-conversational-ui",
|
|
447
447
|
productName: "KendoReact",
|
|
448
448
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
449
|
-
publishDate:
|
|
449
|
+
publishDate: 1704459443,
|
|
450
450
|
version: "",
|
|
451
451
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
452
452
|
}, N = class extends s.Component {
|
package/messages/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
/**
|
package/package-metadata.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { PackageMetadata } from '@progress/kendo-licensing';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-conversational-ui",
|
|
3
|
-
"version": "7.0.3-develop.
|
|
3
|
+
"version": "7.0.3-develop.10",
|
|
4
4
|
"description": "React Chat component allows the user to participate in chat sessions with users or chat bots. KendoReact Conversational UI components",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-licensing": "^1.3.4",
|
|
26
|
-
"@progress/kendo-react-buttons": "7.0.3-develop.
|
|
27
|
-
"@progress/kendo-react-common": "7.0.3-develop.
|
|
28
|
-
"@progress/kendo-react-intl": "7.0.3-develop.
|
|
29
|
-
"@progress/kendo-svg-icons": "^2.
|
|
26
|
+
"@progress/kendo-react-buttons": "7.0.3-develop.10",
|
|
27
|
+
"@progress/kendo-react-common": "7.0.3-develop.10",
|
|
28
|
+
"@progress/kendo-react-intl": "7.0.3-develop.10",
|
|
29
|
+
"@progress/kendo-svg-icons": "^2.1.0",
|
|
30
30
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
31
31
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
|
32
32
|
},
|
package/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Message, User } from '.';
|