impact-ui 5.0.4-chatbot.1 → 5.0.4-chatbot.2

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 (147) hide show
  1. package/dist/_virtual/index2.js +2 -2
  2. package/dist/_virtual/index3.js +2 -2
  3. package/dist/_virtual/index4.js +4 -2
  4. package/dist/_virtual/index5.js +3 -3
  5. package/dist/_virtual/index6.js +2 -4
  6. package/dist/components/AccordionModern/index.js +1 -1
  7. package/dist/components/Badge/index.js +1 -1
  8. package/dist/components/Breadcrumbs/index.js +1 -1
  9. package/dist/components/Button/index.js +1 -1
  10. package/dist/components/ButtonGroup/index.js +1 -1
  11. package/dist/components/Chatbot/Chatbot.types.d.ts +79 -185
  12. package/dist/components/Chatbot/Chatbot.types.d.ts.map +1 -1
  13. package/dist/components/Chatbot/chatbotComposer.d.ts +1 -1
  14. package/dist/components/Chatbot/chatbotComposer.d.ts.map +1 -1
  15. package/dist/components/Chatbot/chatbotComposer.js +107 -5
  16. package/dist/components/Chatbot/chatbotGreetingHeader.d.ts +1 -1
  17. package/dist/components/Chatbot/chatbotGreetingHeader.d.ts.map +1 -1
  18. package/dist/components/Chatbot/chatbotGreetingHeader.js +21 -8
  19. package/dist/components/Chatbot/greetingWeather.d.ts +23 -0
  20. package/dist/components/Chatbot/greetingWeather.d.ts.map +1 -0
  21. package/dist/components/Chatbot/greetingWeather.js +81 -0
  22. package/dist/components/Chatbot/greetingWeather.test.d.ts +2 -0
  23. package/dist/components/Chatbot/greetingWeather.test.d.ts.map +1 -0
  24. package/dist/components/Chatbot/index.d.ts +5 -2
  25. package/dist/components/Chatbot/index.d.ts.map +1 -1
  26. package/dist/components/Chatbot/index.js +355 -436
  27. package/dist/components/Chatbot/irisConversationThread.d.ts.map +1 -1
  28. package/dist/components/Chatbot/irisConversationThread.js +56 -15
  29. package/dist/components/Chatbot/irisMenuScreen.d.ts +1 -1
  30. package/dist/components/Chatbot/irisMenuScreen.d.ts.map +1 -1
  31. package/dist/components/Chatbot/irisMenuScreen.js +157 -111
  32. package/dist/components/Chatbot/newChatComponent.d.ts +1 -1
  33. package/dist/components/Chatbot/newChatComponent.d.ts.map +1 -1
  34. package/dist/components/Chatbot/newChatComponent.js +137 -29
  35. package/dist/components/Chips/index.js +1 -1
  36. package/dist/components/CommentsPanel/CommentsPanel.impl.js +1 -1
  37. package/dist/components/DatePicker/index.js +1 -1
  38. package/dist/components/DateRangePicker/index.js +1 -1
  39. package/dist/components/FileUpload/index.js +1 -1
  40. package/dist/components/FilterPanel/index.js +1 -1
  41. package/dist/components/FiltersStrip/FilterSlider.js +1 -1
  42. package/dist/components/FiltersStrip/index.js +1 -1
  43. package/dist/components/Input/index.js +1 -1
  44. package/dist/components/KeyboardShortCuts/ShortcutLandingPage.js +1 -1
  45. package/dist/components/KeyboardShortCuts/ShortcutModal.js +1 -1
  46. package/dist/components/KeyboardShortCuts/allSetBox.js +1 -1
  47. package/dist/components/KeyboardShortCuts/index.js +1 -1
  48. package/dist/components/KeyboardShortCuts/tutorial.js +1 -1
  49. package/dist/components/Menu/IconMenuItem.js +1 -1
  50. package/dist/components/Menu/NestedMenuItem.js +1 -1
  51. package/dist/components/Menu/index.js +1 -1
  52. package/dist/components/Menu/nestedMenuItemsFromObject.js +1 -1
  53. package/dist/components/Modal/index.js +1 -1
  54. package/dist/components/MonthPicker/index.js +1 -1
  55. package/dist/components/MonthRangePicker/index.js +1 -1
  56. package/dist/components/NewCreateItemFlow/index.js +1 -1
  57. package/dist/components/NewDynamicLayout/index.js +1 -1
  58. package/dist/components/OnboardingTour/index.js +1 -1
  59. package/dist/components/OnboardingTour/productTourList.js +1 -1
  60. package/dist/components/OnboardingTour/tooltipCard.js +1 -1
  61. package/dist/components/Panel/index.js +1 -1
  62. package/dist/components/Popover/index.js +1 -1
  63. package/dist/components/Prompt/index.js +1 -1
  64. package/dist/components/Select/index.js +1 -1
  65. package/dist/components/Stepper/index.js +1 -1
  66. package/dist/components/TableChat/EmptyContainer.js +1 -1
  67. package/dist/components/TableChat/TableChatSidePanel.js +1 -1
  68. package/dist/components/TableChat/components/TableChatLeftSection/AddChatContainer/AddChatContainer.js +1 -1
  69. package/dist/components/TableChat/components/TableChatLeftSection/ChatFilterChips/ChatFilterChips.js +1 -1
  70. package/dist/components/TableChat/components/TableChatLeftSection/TableChatChannelHeader.js +1 -1
  71. package/dist/components/TableChat/components/TableChatRightSection/AvatarGroup/AvatarGroup.js +1 -1
  72. package/dist/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.js +1 -1
  73. package/dist/components/TableChat/components/TableChatRightSection/ChatDeleteMessageType/ChatDeletedMessageType.js +1 -1
  74. package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.js +1 -1
  75. package/dist/components/TableChat/components/TableChatRightSection/ChatInlineEdit/ChatInlineEdit.js +1 -1
  76. package/dist/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.js +1 -1
  77. package/dist/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.js +1 -1
  78. package/dist/components/TableChat/components/TableChatRightSection/ChatNotificationSettings/ChatNotificationSettings.js +1 -1
  79. package/dist/components/TableChat/components/TableChatRightSection/TableChatRightSection.js +1 -1
  80. package/dist/components/TableChat/components/TextEditor/EditorToolbar.js +1 -1
  81. package/dist/components/TableChat/components/TextEditor/Mention.js +1 -1
  82. package/dist/components/TableChat/components/TextEditor/MentionList.js +1 -1
  83. package/dist/components/TableV36/index.js +1 -1
  84. package/dist/components/Tag/index.js +1 -1
  85. package/dist/components/TextArea/index.js +1 -1
  86. package/dist/components/common/MentionEditor/MentionList/index.js +1 -1
  87. package/dist/components/common/MentionEditor/index.js +1 -1
  88. package/dist/components/index.d.ts +3 -2
  89. package/dist/components/index.d.ts.map +1 -1
  90. package/dist/components/index.js +3 -0
  91. package/dist/hooks/useDraggableResizable.d.ts +11 -1
  92. package/dist/hooks/useDraggableResizable.d.ts.map +1 -1
  93. package/dist/hooks/useDraggableResizable.js +73 -59
  94. package/dist/locales/de-DE.json.d.ts +1 -32
  95. package/dist/locales/de-DE.json.js +1 -32
  96. package/dist/locales/en-US.json.d.ts +1 -32
  97. package/dist/locales/en-US.json.js +1 -32
  98. package/dist/locales/es-ES.json.d.ts +1 -32
  99. package/dist/locales/es-ES.json.js +1 -32
  100. package/dist/mcp-component-registry.json +49 -321
  101. package/dist/node_modules/@impactsmartsuite/impact-icons/dist/index.js +13 -5
  102. package/dist/node_modules/@mui/system/colorManipulator.js +2 -2
  103. package/dist/node_modules/prop-types/index.js +1 -1
  104. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  105. package/dist/node_modules/react-is/index.js +1 -1
  106. package/dist/stories/chatBotApiMock.d.ts +2 -387
  107. package/dist/stories/chatBotApiMock.d.ts.map +1 -1
  108. package/dist/styles/style.css +1 -1
  109. package/package.json +1 -1
  110. package/dist/_virtual/MoreVert.js +0 -4
  111. package/dist/_virtual/RemoveRounded.js +0 -4
  112. package/dist/_virtual/SaveOutlined.js +0 -4
  113. package/dist/_virtual/ThumbDownOutlined.js +0 -4
  114. package/dist/_virtual/ThumbUpOutlined.js +0 -4
  115. package/dist/components/Chatbot/bookMarkPanel.d.ts +0 -4
  116. package/dist/components/Chatbot/bookMarkPanel.d.ts.map +0 -1
  117. package/dist/components/Chatbot/bookMarkPanel.js +0 -64
  118. package/dist/components/Chatbot/chatBotLandingScreen.d.ts +0 -4
  119. package/dist/components/Chatbot/chatBotLandingScreen.d.ts.map +0 -1
  120. package/dist/components/Chatbot/chatBotLandingScreen.js +0 -24
  121. package/dist/components/Chatbot/chatInput.d.ts +0 -4
  122. package/dist/components/Chatbot/chatInput.d.ts.map +0 -1
  123. package/dist/components/Chatbot/chatInput.js +0 -198
  124. package/dist/components/Chatbot/chatbotModuleMenu.d.ts +0 -4
  125. package/dist/components/Chatbot/chatbotModuleMenu.d.ts.map +0 -1
  126. package/dist/components/Chatbot/chatbotModuleMenu.js +0 -248
  127. package/dist/components/Chatbot/constant.d.ts +0 -6
  128. package/dist/components/Chatbot/constant.d.ts.map +0 -1
  129. package/dist/components/Chatbot/constant.js +0 -27
  130. package/dist/components/Chatbot/conversationScreen.d.ts +0 -4
  131. package/dist/components/Chatbot/conversationScreen.d.ts.map +0 -1
  132. package/dist/components/Chatbot/conversationScreen.js +0 -209
  133. package/dist/components/Chatbot/customScreen.d.ts +0 -4
  134. package/dist/components/Chatbot/customScreen.d.ts.map +0 -1
  135. package/dist/components/Chatbot/customScreen.js +0 -66
  136. package/dist/components/Chatbot/historyPanel.d.ts +0 -4
  137. package/dist/components/Chatbot/historyPanel.d.ts.map +0 -1
  138. package/dist/components/Chatbot/historyPanel.js +0 -374
  139. package/dist/components/Chatbot/utils.d.ts +0 -5
  140. package/dist/components/Chatbot/utils.d.ts.map +0 -1
  141. package/dist/components/Chatbot/utils.js +0 -29
  142. package/dist/node_modules/@mui/icons-material/MoreVert.js +0 -17
  143. package/dist/node_modules/@mui/icons-material/RemoveRounded.js +0 -17
  144. package/dist/node_modules/@mui/icons-material/SaveOutlined.js +0 -17
  145. package/dist/node_modules/@mui/icons-material/ThumbDownOutlined.js +0 -17
  146. package/dist/node_modules/@mui/icons-material/ThumbUpOutlined.js +0 -17
  147. package/dist/utils/onResize.js +0 -28
@@ -1,209 +0,0 @@
1
- import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
2
- import { useState, useRef, useEffect, Fragment } from "react";
3
- import moment from "moment";
4
- import { ChatBotFooter } from "./chatBotFooter.js";
5
- import ChatInput from "./chatInput.js";
6
- import { getDateLabel, formatAMPM } from "./utils.js";
7
- import { IrisThinking } from "./irisThinking.js";
8
- import { useTranslation } from "../../i18n/useTranslation.js";
9
- function ConversationScreen({
10
- userChats,
11
- setUserChats,
12
- onSendIconClick,
13
- conversation,
14
- isAssistantThinking,
15
- thinking,
16
- activeList,
17
- onLikeClick,
18
- onDislikeClick,
19
- inputText,
20
- handleRefresh,
21
- handleSaveChat,
22
- handleMicClick,
23
- suggestionBanner,
24
- isStopIcon,
25
- onStopIconClick,
26
- onCloseSuggestionBanner,
27
- showSuggestionBanner,
28
- customInputComponent,
29
- footerText,
30
- isCollapsed
31
- }) {
32
- const { t, locale } = useTranslation();
33
- const [input, setInput] = useState(inputText ?? "");
34
- const [conversationMessages, setConversationMessages] = useState([]);
35
- const conversationBodyRef = useRef(null);
36
- useEffect(() => {
37
- setInput(inputText ?? "");
38
- }, [inputText]);
39
- useEffect(() => {
40
- const conversationsObj = conversation.conversations || {};
41
- const firstKey = Object.keys(conversationsObj)[0];
42
- const thread = firstKey ? conversationsObj[firstKey] : void 0;
43
- const messagesArr = (thread == null ? void 0 : thread.messages) || [];
44
- const mapped = messagesArr.map((msg) => ({
45
- ...msg,
46
- role: msg.userType === "bot" ? "assistant" : "user",
47
- text: msg.bodyText,
48
- type: msg.jsx ? "jsx" : msg.bodyType,
49
- formComponent: msg.bodyType === "form" ? msg.formComponent : void 0,
50
- tableComponent: msg.bodyType === "table" ? msg.tableComponent : void 0,
51
- timestamp: msg.timeStamp === "" ? "" : moment(msg.timeStamp, "DD-MM-YYYY HH:mm:ss").format("MM-DD-YYYY HH:mm:ss"),
52
- jsx: msg.jsx,
53
- thinkingResponse: msg.thinkingResponse
54
- }));
55
- setConversationMessages(mapped);
56
- }, [conversation]);
57
- useEffect(() => {
58
- const body = conversationBodyRef.current;
59
- if (!body) return;
60
- if (typeof body.scrollTo === "function") {
61
- body.scrollTo({
62
- top: body.scrollHeight,
63
- behavior: "smooth"
64
- });
65
- } else {
66
- body.scrollTop = body.scrollHeight;
67
- }
68
- }, [conversationMessages, isAssistantThinking, conversation]);
69
- const handleLikeClick = (chat, idx) => {
70
- chat.isAnimateLike = true;
71
- const timeout = setTimeout(() => {
72
- chat.isAnimateLike = false;
73
- }, 1e3);
74
- onLikeClick == null ? void 0 : onLikeClick(chat, idx);
75
- return () => {
76
- clearTimeout(timeout);
77
- };
78
- };
79
- const handleDislikeClick = (chat, idx) => {
80
- chat.isAnimateDislike = true;
81
- const timeout = setTimeout(() => {
82
- chat.isAnimateDislike = false;
83
- }, 1e3);
84
- onDislikeClick == null ? void 0 : onDislikeClick(chat, idx);
85
- return () => {
86
- clearTimeout(timeout);
87
- };
88
- };
89
- return /* @__PURE__ */ jsxs("div", { className: "conversation-screen-container", children: [
90
- /* @__PURE__ */ jsxs(
91
- "div",
92
- {
93
- ref: conversationBodyRef,
94
- className: `conversation-body-container ${showSuggestionBanner ? "show-suggestion-banner" : ""} ${isCollapsed ? "collapsed" : ""}`,
95
- children: [
96
- conversationMessages.map((chat, idx) => {
97
- var _a, _b, _c;
98
- const prevMsg = conversationMessages[idx - 1];
99
- const showDateLabel = idx === 0 || chat.timestamp && (prevMsg == null ? void 0 : prevMsg.timestamp) && new Date(chat.timestamp).toDateString() !== new Date(prevMsg.timestamp).toDateString();
100
- return /* @__PURE__ */ jsxs(Fragment, { children: [
101
- showDateLabel && /* @__PURE__ */ jsx("div", { className: "time_stamp_badge_chat_container", children: /* @__PURE__ */ jsx("div", { className: "time_stamp_badge_chat", children: getDateLabel(chat.timestamp, t, locale) }) }),
102
- chat.role === "user" ? /* @__PURE__ */ jsx("div", { className: "user_chat_messages_container", children: /* @__PURE__ */ jsxs("div", { className: "user_chat_message", children: [
103
- /* @__PURE__ */ jsx("div", { className: "user_chat_message_text", children: chat.text }),
104
- /* @__PURE__ */ jsx("div", { className: "time_chat", children: chat.timestamp ? formatAMPM(new Date(chat.timestamp)) : "" })
105
- ] }) }) : chat.role === "assistant" ? /* @__PURE__ */ jsxs("div", { className: "assistant_chat_messages_container", children: [
106
- chat.firstMessage ? /* @__PURE__ */ jsx("div", { className: "chat_logo_circle" }) : /* @__PURE__ */ jsx("div", { className: "chat_logo_circle_empty" }),
107
- /* @__PURE__ */ jsxs("div", { className: "response_main_container", children: [
108
- /* @__PURE__ */ jsx(
109
- "div",
110
- {
111
- className: `assistant_with_dropdown_container ${chat.thinkingResponse ? "" : "dis_none"}`,
112
- children: (_a = chat.thinkingResponse) == null ? void 0 : _a.thinkingHeading
113
- }
114
- ),
115
- /* @__PURE__ */ jsxs(
116
- "div",
117
- {
118
- className: `assistant_main_container ${chat.bodyType === "questions" ? "questions-container" : ""}`,
119
- children: [
120
- /* @__PURE__ */ jsxs("div", { className: "assistant_text_container", children: [
121
- chat.type === "jsx" && chat.jsx,
122
- chat.type === "form" && chat.formComponent,
123
- chat.type === "table" && chat.tableComponent,
124
- chat.type === "text" && chat.text
125
- ] }),
126
- /* @__PURE__ */ jsx("div", { className: "time_chat", children: chat.timestamp ? formatAMPM(new Date(chat.timestamp)) : "" })
127
- ]
128
- }
129
- ),
130
- /* @__PURE__ */ jsxs("div", { className: "assistant_actions_container", children: [
131
- /* @__PURE__ */ jsxs("div", { className: "left_icon_container_action", children: [
132
- /* @__PURE__ */ jsx(
133
- "button",
134
- {
135
- className: `asst_feedback_buttons good_feedback ${chat.enableLikes ? "" : "dis_none"} ${((_b = chat.extra) == null ? void 0 : _b.status) === "liked" ? "liked" : ""} ${chat.isAnimateLike ? "animatingLike" : ""}`,
136
- onClick: () => handleLikeClick(chat, idx)
137
- }
138
- ),
139
- /* @__PURE__ */ jsx(
140
- "button",
141
- {
142
- className: `asst_feedback_buttons bad_feedback ${chat.enableLikes ? "" : "dis_none"} ${((_c = chat.extra) == null ? void 0 : _c.status) === "disliked" ? "disliked" : ""} ${chat.isAnimateDislike ? "animatingDislike" : ""}`,
143
- onClick: () => handleDislikeClick(chat, idx)
144
- }
145
- ),
146
- /* @__PURE__ */ jsx(
147
- "button",
148
- {
149
- className: `asst_feedback_buttons speaker ${chat.enableSpeaker ? "" : "dis_none"}`
150
- }
151
- )
152
- ] }),
153
- /* @__PURE__ */ jsx("div", { className: "button_url_container", children: /* @__PURE__ */ jsx(
154
- "button",
155
- {
156
- className: `asst_feedback_buttons ${chat.enableNewThread ? "" : "dis_none"}`,
157
- children: t("chatBot.newThread")
158
- }
159
- ) }),
160
- /* @__PURE__ */ jsx("div", { className: "button_url_container", children: /* @__PURE__ */ jsx(
161
- "button",
162
- {
163
- className: `asst_feedback_buttons ${chat.enableAddToPage ? "" : "dis_none"}`,
164
- children: t("chatBot.addToPage")
165
- }
166
- ) })
167
- ] })
168
- ] })
169
- ] }) : null
170
- ] }, idx);
171
- }),
172
- isAssistantThinking && /* @__PURE__ */ jsx("div", { className: "assistant_chat_messages_container", children: thinking ? /* @__PURE__ */ jsx(IrisThinking, { thinking }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
173
- /* @__PURE__ */ jsx("div", { className: "chat_logo_circle" }),
174
- /* @__PURE__ */ jsxs("div", { className: `loading_messages ${isAssistantThinking ? "" : "dis_none"}`, children: [
175
- /* @__PURE__ */ jsx("span", { className: "dot" }),
176
- /* @__PURE__ */ jsx("span", { className: "dot" }),
177
- /* @__PURE__ */ jsx("span", { className: "dot" })
178
- ] })
179
- ] }) })
180
- ]
181
- }
182
- ),
183
- /* @__PURE__ */ jsx("div", { className: "conversation-footer-container", children: /* @__PURE__ */ jsx(
184
- ChatInput,
185
- {
186
- activeList,
187
- customInputComponent,
188
- handleMicClick,
189
- handleRefresh,
190
- handleSaveChat,
191
- inputValue: input,
192
- isStopIcon,
193
- minRows: 1,
194
- setInputValue: setInput,
195
- setUserChats,
196
- showSuggestionBanner,
197
- suggestionBanner,
198
- userChats,
199
- onCloseSuggestionBanner,
200
- onSendIconClick,
201
- onStopIconClick
202
- }
203
- ) }),
204
- /* @__PURE__ */ jsx(ChatBotFooter, { footerText })
205
- ] });
206
- }
207
- export {
208
- ConversationScreen
209
- };
@@ -1,4 +0,0 @@
1
- import { CustomScreenProps } from './Chatbot.types';
2
-
3
- export declare function CustomScreen({ onClose, customScreenJsx, userChats, setUserChats, onSendIconClick, activeList, handleRefresh, handleMicClick, suggestionBanner, isStopIcon, onStopIconClick, onCloseSuggestionBanner, showSuggestionBanner, customInputComponent, isFullWidth, footerText, }: CustomScreenProps): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=customScreen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customScreen.d.ts","sourceRoot":"","sources":["../../../src/components/Chatbot/customScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,eAAe,EACf,SAAS,EACT,YAAY,EACZ,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,UAAU,GACX,EAAE,iBAAiB,2CA0CnB"}
@@ -1,66 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import default_1 from "../../node_modules/@mui/icons-material/Clear.js";
4
- import { Button } from "../Button/index.js";
5
- import { ChatBotFooter } from "./chatBotFooter.js";
6
- import ChatInput from "./chatInput.js";
7
- function CustomScreen({
8
- onClose,
9
- customScreenJsx,
10
- userChats,
11
- setUserChats,
12
- onSendIconClick,
13
- activeList,
14
- handleRefresh,
15
- handleMicClick,
16
- suggestionBanner,
17
- isStopIcon,
18
- onStopIconClick,
19
- onCloseSuggestionBanner,
20
- showSuggestionBanner,
21
- customInputComponent,
22
- isFullWidth,
23
- footerText
24
- }) {
25
- const [input, setInput] = useState("");
26
- return /* @__PURE__ */ jsxs("div", { className: "chatbot-landing-screen-container", style: { pointerEvents: "auto" }, children: [
27
- !isFullWidth && /* @__PURE__ */ jsx("div", { className: "chatbot-landing-screen-container-close-icon", children: /* @__PURE__ */ jsx(
28
- Button,
29
- {
30
- className: "chatbot-component-header-close-icon",
31
- icon: /* @__PURE__ */ jsx(default_1, {}),
32
- iconPlacement: "left",
33
- size: "large",
34
- type: "default",
35
- variant: "text",
36
- onClick: onClose
37
- }
38
- ) }),
39
- /* @__PURE__ */ jsx("div", { className: "chatbot-landing-screen-container-body", children: customScreenJsx }),
40
- /* @__PURE__ */ jsx("div", { className: "conversation-footer-container", children: /* @__PURE__ */ jsx(
41
- ChatInput,
42
- {
43
- customScreen: true,
44
- activeList,
45
- customInputComponent,
46
- handleMicClick,
47
- handleRefresh,
48
- inputValue: input,
49
- isStopIcon,
50
- minRows: 1,
51
- setInputValue: setInput,
52
- setUserChats,
53
- showSuggestionBanner,
54
- suggestionBanner,
55
- userChats,
56
- onCloseSuggestionBanner,
57
- onSendIconClick,
58
- onStopIconClick
59
- }
60
- ) }),
61
- /* @__PURE__ */ jsx(ChatBotFooter, { footerText })
62
- ] });
63
- }
64
- export {
65
- CustomScreen
66
- };
@@ -1,4 +0,0 @@
1
- import { HistoryPanelProps } from './Chatbot.types';
2
-
3
- export declare function HistoryPanel({ historyPanelData, isConversationLoading, onClose, onSearchChange, onSelectConversation, onToggleGroup, openGroups, onMenuAction, activeConversationId, }: HistoryPanelProps): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=historyPanel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"historyPanel.d.ts","sourceRoot":"","sources":["../../../src/components/Chatbot/historyPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA2B,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AA0DlF,wBAAgB,YAAY,CAAC,EAC3B,gBAAqB,EACrB,qBAA6B,EAC7B,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,oBAAoB,GACrB,EAAE,iBAAiB,2CAqXnB"}
@@ -1,374 +0,0 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useMemo, useState, useRef, useEffect } from "react";
3
- import { getAssetUrl } from "../../utils/assetBase.js";
4
- import { Skeleton } from "../Skeleton/index.js";
5
- import { useTranslation } from "../../i18n/useTranslation.js";
6
- const CloseIcon = getAssetUrl("icons/close.svg");
7
- const ACTION_LABEL_KEYS = {
8
- share: "chatBot.history.share",
9
- rename: "chatBot.history.rename",
10
- pin: "chatBot.history.pin",
11
- unpin: "chatBot.history.unpin",
12
- delete: "chatBot.history.delete"
13
- };
14
- function HistoryPanelSkeletonRow() {
15
- return /* @__PURE__ */ jsx(Skeleton, { className: "history-panel-skeleton-item", height: 42, variant: "rounded", width: "100%" });
16
- }
17
- function HistoryPanelSkeletonGroupLabel() {
18
- return /* @__PURE__ */ jsx(Skeleton, { className: "history-panel-skeleton-label", height: 16, variant: "rounded", width: "35%" });
19
- }
20
- function HistoryPanelSkeleton() {
21
- return /* @__PURE__ */ jsxs(
22
- "div",
23
- {
24
- "aria-busy": "true",
25
- "aria-live": "polite",
26
- className: "history-panel-skeleton",
27
- "data-testid": "history-panel-skeleton",
28
- children: [
29
- /* @__PURE__ */ jsxs("div", { className: "history-panel-skeleton-pinned", children: [
30
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {}),
31
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {})
32
- ] }),
33
- /* @__PURE__ */ jsxs("div", { className: "history-panel-skeleton-group-block", children: [
34
- /* @__PURE__ */ jsx(HistoryPanelSkeletonGroupLabel, {}),
35
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {}),
36
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {}),
37
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {})
38
- ] }),
39
- /* @__PURE__ */ jsxs("div", { className: "history-panel-skeleton-group-block", children: [
40
- /* @__PURE__ */ jsx(HistoryPanelSkeletonGroupLabel, {}),
41
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {}),
42
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {}),
43
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {})
44
- ] }),
45
- /* @__PURE__ */ jsxs("div", { className: "history-panel-skeleton-group-block", children: [
46
- /* @__PURE__ */ jsx(HistoryPanelSkeletonGroupLabel, {}),
47
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {}),
48
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {}),
49
- /* @__PURE__ */ jsx(HistoryPanelSkeletonRow, {})
50
- ] })
51
- ]
52
- }
53
- );
54
- }
55
- function HistoryPanel({
56
- historyPanelData = [],
57
- isConversationLoading = false,
58
- onClose,
59
- onSearchChange,
60
- onSelectConversation,
61
- onToggleGroup,
62
- openGroups,
63
- onMenuAction,
64
- activeConversationId
65
- }) {
66
- const { t } = useTranslation();
67
- const baseGroups = useMemo(() => {
68
- if (Array.isArray(historyPanelData)) return historyPanelData;
69
- return historyPanelData.groups || [];
70
- }, [historyPanelData]);
71
- const pinnedItems = useMemo(() => {
72
- const fromObject = !Array.isArray(historyPanelData) && Array.isArray(historyPanelData.pinned) ? historyPanelData.pinned : [];
73
- const fromGroups = (baseGroups || []).flatMap(
74
- (g) => (g.conversation_list || []).filter((it) => !!it.pinned)
75
- );
76
- return [...fromObject, ...fromGroups];
77
- }, [historyPanelData, baseGroups]);
78
- const groupsData = useMemo(
79
- () => (baseGroups || []).map((g) => ({
80
- ...g,
81
- conversation_list: (g.conversation_list || []).filter((it) => !it.pinned)
82
- })),
83
- [baseGroups]
84
- );
85
- const [query, setQuery] = useState("");
86
- const [internalOpen, setInternalOpen] = useState({});
87
- const [focusedIndex, setFocusedIndex] = useState(-1);
88
- const containerRef = useRef(null);
89
- const [openMenuId, setOpenMenuId] = useState(null);
90
- const isActiveConversation = (conversationId) => {
91
- if (activeConversationId == null || conversationId == null) return false;
92
- return String(activeConversationId) === String(conversationId);
93
- };
94
- useEffect(() => {
95
- const init = {};
96
- (groupsData || []).forEach((g) => {
97
- if (g.group_name) init[g.group_name] = true;
98
- });
99
- setInternalOpen((prev) => ({ ...init, ...prev }));
100
- }, [groupsData]);
101
- const isControlledGroups = openGroups !== void 0 && openGroups !== null && Object.keys(openGroups).length > 0;
102
- const groupsState = useMemo(() => {
103
- if (!isControlledGroups) return internalOpen;
104
- const merged = {};
105
- (groupsData || []).forEach((g) => {
106
- const n = g.group_name;
107
- if (!n) return;
108
- merged[n] = openGroups[n] !== void 0 ? openGroups[n] : true;
109
- });
110
- return merged;
111
- }, [isControlledGroups, openGroups, internalOpen, groupsData]);
112
- const handleSearch = (e) => {
113
- const value = e.target.value ?? "";
114
- setQuery(value);
115
- onSearchChange == null ? void 0 : onSearchChange(value);
116
- };
117
- const handleToggle = (name) => {
118
- const next = !groupsState[name];
119
- if (openGroups == null) setInternalOpen((prev) => ({ ...prev, [name]: next }));
120
- onToggleGroup == null ? void 0 : onToggleGroup(name, next);
121
- };
122
- const filtered = useMemo(() => {
123
- if (!query) return groupsData || [];
124
- const q = query.toLowerCase();
125
- return (groupsData || []).map((g) => {
126
- const list = (g.conversation_list || []).filter((c) => {
127
- var _a, _b;
128
- const byName = (_a = c.name) == null ? void 0 : _a.toLowerCase().includes(q);
129
- const byModule = (_b = c.module_name) == null ? void 0 : _b.toLowerCase().includes(q);
130
- return byName || byModule;
131
- });
132
- return { ...g, conversation_list: list };
133
- }).filter((g) => (g.conversation_list || []).length > 0);
134
- }, [groupsData, query]);
135
- const filteredPinned = useMemo(() => {
136
- if (!pinnedItems || pinnedItems.length === 0) return [];
137
- if (!query) return pinnedItems;
138
- const q = query.toLowerCase();
139
- return pinnedItems.filter((item) => {
140
- var _a, _b;
141
- const byName = (_a = item.name) == null ? void 0 : _a.toLowerCase().includes(q);
142
- const byModule = (_b = item.module_name) == null ? void 0 : _b.toLowerCase().includes(q);
143
- return byName || byModule;
144
- });
145
- }, [pinnedItems, query]);
146
- const flatItems = useMemo(() => {
147
- const out = [];
148
- (filteredPinned || []).forEach((item) => {
149
- out.push({ groupName: "pinned", item });
150
- });
151
- (filtered || []).forEach((g) => {
152
- if (!groupsState[g.group_name]) return;
153
- (g.conversation_list || []).forEach((item) => {
154
- out.push({ groupName: g.group_name, item });
155
- });
156
- });
157
- return out;
158
- }, [filtered, filteredPinned, groupsState]);
159
- const currentFocused = flatItems[focusedIndex];
160
- useEffect(() => {
161
- const onDocClick = (e) => {
162
- const target = e.target;
163
- if (!containerRef.current) return;
164
- const isInsideMenu = target.closest(".history-item-menu");
165
- const isOnTrigger = target.closest(".item-menu-trigger");
166
- if (isInsideMenu || isOnTrigger) return;
167
- if (openMenuId != null) setOpenMenuId(null);
168
- };
169
- document.addEventListener("mousedown", onDocClick);
170
- return () => {
171
- document.removeEventListener("mousedown", onDocClick);
172
- };
173
- }, [openMenuId]);
174
- const focusItemAt = (idx) => {
175
- if (!containerRef.current) return;
176
- const nodes = containerRef.current.querySelectorAll(".history-item");
177
- const clamped = Math.max(0, Math.min(idx, nodes.length - 1));
178
- const el = nodes[clamped];
179
- if (el) {
180
- setFocusedIndex(clamped);
181
- requestAnimationFrame(() => {
182
- el.focus();
183
- });
184
- }
185
- };
186
- const handleContainerKeyDown = (e) => {
187
- if (flatItems.length === 0) return;
188
- switch (e.key) {
189
- case "ArrowDown": {
190
- e.preventDefault();
191
- const next = focusedIndex < 0 ? 0 : Math.min(focusedIndex + 1, flatItems.length - 1);
192
- focusItemAt(next);
193
- break;
194
- }
195
- case "ArrowUp": {
196
- e.preventDefault();
197
- const prev = focusedIndex <= 0 ? 0 : focusedIndex - 1;
198
- focusItemAt(prev);
199
- break;
200
- }
201
- case "Home":
202
- e.preventDefault();
203
- focusItemAt(0);
204
- break;
205
- case "End":
206
- e.preventDefault();
207
- focusItemAt(flatItems.length - 1);
208
- break;
209
- case "Enter":
210
- if (focusedIndex >= 0 && flatItems[focusedIndex]) {
211
- e.preventDefault();
212
- onSelectConversation == null ? void 0 : onSelectConversation(flatItems[focusedIndex].item);
213
- }
214
- break;
215
- }
216
- };
217
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "history-panel-container", onKeyDown: handleContainerKeyDown, children: [
218
- /* @__PURE__ */ jsxs("div", { className: "history-panel-header", children: [
219
- /* @__PURE__ */ jsx("span", { children: t("chatBot.history.title") }),
220
- /* @__PURE__ */ jsx("img", { alt: t("chatBot.closeAlt"), src: CloseIcon, onClick: onClose })
221
- ] }),
222
- /* @__PURE__ */ jsx("div", { className: "history-panel-search", children: /* @__PURE__ */ jsx(
223
- "input",
224
- {
225
- "aria-label": t("chatBot.history.searchAriaLabel"),
226
- placeholder: t("chatBot.history.searchPlaceholder"),
227
- type: "text",
228
- value: query,
229
- onChange: handleSearch,
230
- onKeyDown: (e) => {
231
- if (e.key === "ArrowDown") {
232
- e.preventDefault();
233
- focusItemAt(0);
234
- }
235
- }
236
- }
237
- ) }),
238
- /* @__PURE__ */ jsx("div", { className: "history-panel-groups", children: isConversationLoading ? /* @__PURE__ */ jsx(HistoryPanelSkeleton, {}) : /* @__PURE__ */ jsxs(Fragment, { children: [
239
- filteredPinned.length > 0 && /* @__PURE__ */ jsx("ul", { className: "history-pinned-list", children: filteredPinned.map((item, idx) => {
240
- const isActive = isActiveConversation(item.conversation_id);
241
- return /* @__PURE__ */ jsxs(
242
- "li",
243
- {
244
- "aria-current": isActive ? "true" : void 0,
245
- className: "history-item history-pinned-item" + (isActive ? " active" : ""),
246
- role: "button",
247
- tabIndex: currentFocused && currentFocused.groupName === "pinned" && currentFocused.item === item ? 0 : -1,
248
- onClick: () => onSelectConversation == null ? void 0 : onSelectConversation(item),
249
- onKeyDown: (e) => {
250
- if (e.key === "Enter" || e.key === " ") onSelectConversation == null ? void 0 : onSelectConversation(item);
251
- },
252
- children: [
253
- /* @__PURE__ */ jsxs("div", { className: "history-item-row", children: [
254
- /* @__PURE__ */ jsxs("div", { className: "history-item-name", children: [
255
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "pin-icon", children: "📌" }),
256
- item.name
257
- ] }),
258
- /* @__PURE__ */ jsx(
259
- "button",
260
- {
261
- "aria-expanded": openMenuId === item.conversation_id,
262
- "aria-haspopup": "menu",
263
- className: "item-menu-trigger" + (openMenuId === item.conversation_id || isActive ? " always-visible" + (openMenuId === item.conversation_id ? " open" : "") : ""),
264
- title: t("chatBot.history.moreActions"),
265
- type: "button",
266
- onClick: (e) => {
267
- e.stopPropagation();
268
- setOpenMenuId(
269
- (prev) => prev === item.conversation_id ? null : item.conversation_id ?? null
270
- );
271
- },
272
- children: "⋯"
273
- }
274
- )
275
- ] }),
276
- openMenuId === item.conversation_id && /* @__PURE__ */ jsx("div", { className: "history-item-menu", role: "menu", children: ["share", "rename", "unpin", "delete"].map((action) => /* @__PURE__ */ jsx(
277
- "button",
278
- {
279
- className: `menu-item ${action === "delete" ? "danger" : ""}`.trim(),
280
- role: "menuitem",
281
- type: "button",
282
- onClick: (e) => {
283
- e.stopPropagation();
284
- onMenuAction == null ? void 0 : onMenuAction(action, item);
285
- setOpenMenuId(null);
286
- },
287
- children: t(ACTION_LABEL_KEYS[action] ?? action)
288
- },
289
- action
290
- )) })
291
- ]
292
- },
293
- `pinned-${item.conversation_id}-${idx}`
294
- );
295
- }) }),
296
- filtered.map((group) => {
297
- const name = group.group_name ?? "";
298
- const isOpen = !!groupsState[name];
299
- return /* @__PURE__ */ jsxs("div", { className: "history-group", children: [
300
- /* @__PURE__ */ jsxs(
301
- "button",
302
- {
303
- "aria-expanded": isOpen,
304
- className: "history-group-header",
305
- type: "button",
306
- onClick: () => {
307
- handleToggle(name);
308
- },
309
- children: [
310
- /* @__PURE__ */ jsx("span", { className: "chevron", children: isOpen ? "▾" : "▸" }),
311
- /* @__PURE__ */ jsx("span", { className: "group-title", children: name })
312
- ]
313
- }
314
- ),
315
- isOpen && /* @__PURE__ */ jsx("ul", { className: "history-group-list", children: (group.conversation_list || []).map((item, idx) => {
316
- const isActive = isActiveConversation(item.conversation_id);
317
- return /* @__PURE__ */ jsxs(
318
- "li",
319
- {
320
- "aria-current": isActive ? "true" : void 0,
321
- className: "history-item" + (isActive ? " active" : ""),
322
- role: "button",
323
- tabIndex: currentFocused && currentFocused.groupName === name && currentFocused.item === item ? 0 : -1,
324
- onClick: () => onSelectConversation == null ? void 0 : onSelectConversation(item),
325
- children: [
326
- /* @__PURE__ */ jsxs("div", { className: "history-item-row", children: [
327
- /* @__PURE__ */ jsx("div", { className: "history-item-name", children: item.name }),
328
- /* @__PURE__ */ jsx(
329
- "button",
330
- {
331
- "aria-expanded": openMenuId === item.conversation_id,
332
- "aria-haspopup": "menu",
333
- className: "item-menu-trigger" + (openMenuId === item.conversation_id || isActive ? " always-visible" + (openMenuId === item.conversation_id ? " open" : "") : ""),
334
- title: t("chatBot.history.moreActions"),
335
- type: "button",
336
- onClick: (e) => {
337
- e.stopPropagation();
338
- setOpenMenuId(
339
- (prev) => prev === item.conversation_id ? null : item.conversation_id ?? null
340
- );
341
- },
342
- children: "⋯"
343
- }
344
- )
345
- ] }),
346
- openMenuId === item.conversation_id && /* @__PURE__ */ jsx("div", { className: "history-item-menu", role: "menu", children: ["share", "rename", "pin", "delete"].map((action) => /* @__PURE__ */ jsx(
347
- "button",
348
- {
349
- className: `menu-item ${action === "delete" ? "danger" : ""}`.trim(),
350
- role: "menuitem",
351
- type: "button",
352
- onClick: (e) => {
353
- e.stopPropagation();
354
- onMenuAction == null ? void 0 : onMenuAction(action, item);
355
- setOpenMenuId(null);
356
- },
357
- children: t(ACTION_LABEL_KEYS[action] ?? action)
358
- },
359
- action
360
- )) })
361
- ]
362
- },
363
- `${name}-${item.conversation_id}-${idx}`
364
- );
365
- }) })
366
- ] }, name);
367
- }),
368
- filtered.length === 0 && filteredPinned.length === 0 && /* @__PURE__ */ jsx("div", { className: "history-empty-state", children: t("chatBot.history.noConversations") })
369
- ] }) })
370
- ] });
371
- }
372
- export {
373
- HistoryPanel
374
- };
@@ -1,5 +0,0 @@
1
- import { TFunction } from '../../i18n';
2
-
3
- export declare const formatAMPM: (date: Date) => string;
4
- export declare const getDateLabel: (dateString?: string, t?: TFunction, locale?: string) => string;
5
- //# sourceMappingURL=utils.d.ts.map