impact-chatbot 2.0.0
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/README.md +321 -0
- package/dist/components/ChatFooter.d.ts +55 -0
- package/dist/components/ChatInput.d.ts +27 -0
- package/dist/components/ChatLayout.d.ts +44 -0
- package/dist/components/ChatPlaceholder.d.ts +3 -0
- package/dist/components/HighlightedRenderer.d.ts +14 -0
- package/dist/components/LinkRenderer.d.ts +4 -0
- package/dist/components/LoadingOverlay.d.ts +2 -0
- package/dist/components/ModuleSelection.d.ts +28 -0
- package/dist/components/RedirectLink.d.ts +5 -0
- package/dist/components/SavedChat.d.ts +2 -0
- package/dist/components/SelectedModule.d.ts +7 -0
- package/dist/components/TextRenderer.d.ts +7 -0
- package/dist/components/chatbot-input/components/FilterValueInput.d.ts +15 -0
- package/dist/components/chatbot-input/hooks/useMentionState.d.ts +33 -0
- package/dist/components/chatbot-input/index.d.ts +3 -0
- package/dist/components/chatbot-input/index_new.d.ts +3 -0
- package/dist/components/chatbot-input/index_old_backup.d.ts +3 -0
- package/dist/components/chatbot-input/utils/apiHelpers.d.ts +50 -0
- package/dist/components/chatbot-input/utils/domHelpers.d.ts +82 -0
- package/dist/components/chatbot-input/utils/mentionHelpers.d.ts +48 -0
- package/dist/components/memory-modal/components/Memories.d.ts +2 -0
- package/dist/components/memory-modal/index.d.ts +2 -0
- package/dist/components/memory-modal/service.d.ts +3 -0
- package/dist/components/memory-modal/styling.d.ts +1 -0
- package/dist/components/message-template/components/message-actions/LikeDislikeActions.d.ts +7 -0
- package/dist/components/message-template/components/message-content/ButtonContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/CheckboxContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/ChipsContent.d.ts +5 -0
- package/dist/components/message-template/components/message-content/CombinedContent.d.ts +5 -0
- package/dist/components/message-template/components/message-content/DatePickerContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/GraphContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/InputContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/QuestionsContent.d.ts +5 -0
- package/dist/components/message-template/components/message-content/RadioContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/SelectContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/SelectableChips.d.ts +7 -0
- package/dist/components/message-template/components/message-content/SliderContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/TableContent.d.ts +4 -0
- package/dist/components/message-template/components/message-content/TextContent.d.ts +5 -0
- package/dist/components/message-template/components/message-content/tabular-content/components/AgentResponse.d.ts +4 -0
- package/dist/components/message-template/components/message-content/tabular-content/components/Steps.d.ts +4 -0
- package/dist/components/message-template/components/message-content/tabular-content/index.d.ts +6 -0
- package/dist/components/message-template/components/message-types/BotMessage.d.ts +7 -0
- package/dist/components/message-template/components/message-types/LoaderMessage.d.ts +4 -0
- package/dist/components/message-template/components/message-types/UserMessage.d.ts +4 -0
- package/dist/components/message-template/components/message-types/streamed-content/AxiosEventSource.d.ts +17 -0
- package/dist/components/message-template/components/message-types/streamed-content/StreamedContent.d.ts +16 -0
- package/dist/components/message-template/components/message-types/streamed-content/ThinkinHeaderInfo.d.ts +2 -0
- package/dist/components/message-template/components/message-types/streamed-content/ThinkingIndicator.d.ts +9 -0
- package/dist/components/message-template/components/message-types/streamed-content/steps-response-tab/StepsResponseTab.d.ts +2 -0
- package/dist/components/message-template/components/message-types/streamed-content/steps-response-tab/components/AgentResponse.d.ts +2 -0
- package/dist/components/message-template/components/message-types/streamed-content/steps-response-tab/components/Steps.d.ts +12 -0
- package/dist/components/message-template/components/message-types/streamed-content/styling.d.ts +1 -0
- package/dist/components/message-template/index.d.ts +2 -0
- package/dist/components/message-template/reference.d.ts +2 -0
- package/dist/components/message-template/utils.d.ts +4 -0
- package/dist/components/upload-modal/index.d.ts +2 -0
- package/dist/constants.d.ts +17 -0
- package/dist/core/constants/index.d.ts +5 -0
- package/dist/core/styles/colours.d.ts +213 -0
- package/dist/core/styles/globalStyles.d.ts +2 -0
- package/dist/core/utils/functions.d.ts +7 -0
- package/dist/core/utils/replaceSpecialCharacter.d.ts +1 -0
- package/dist/hooks/useAgentFlow.d.ts +5 -0
- package/dist/hooks/useBotConfiguration.d.ts +5 -0
- package/dist/hooks/useChatFlow.d.ts +16 -0
- package/dist/hooks/useChatSession.d.ts +8 -0
- package/dist/hooks/useChatState.d.ts +134 -0
- package/dist/hooks/useConversationManagement.d.ts +10 -0
- package/dist/hooks/useDragAndDrop.d.ts +6 -0
- package/dist/impact-ui-components/ConfirmationDialog/index.d.ts +24 -0
- package/dist/index.cjs.css +360 -0
- package/dist/index.cjs.js +9950 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.css +360 -0
- package/dist/index.esm.js +9928 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/services/chatbot-services.d.ts +14 -0
- package/dist/services/conversation-service.d.ts +6 -0
- package/dist/styling.d.ts +2 -0
- package/dist/temp.d.ts +65 -0
- package/dist/utils/coreUtils.d.ts +25 -0
- package/dist/utlis.d.ts +56 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
# @impact/chatbot v2.0.0
|
|
2
|
+
|
|
3
|
+
Standalone chatbot library - TypeScript conversion of smartBot with enhanced features.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This library is a **TypeScript conversion** of `src/core/commonComponents/smartBot` with additional enhancements for widget rendering, streaming, and special character handling.
|
|
8
|
+
|
|
9
|
+
**Key Features:**
|
|
10
|
+
- TypeScript support with full type declarations
|
|
11
|
+
- Widget data accumulation for tables, graphs, and combined content
|
|
12
|
+
- Special character decoding (`ia_char` placeholders)
|
|
13
|
+
- Streaming/SSE support with abort handling
|
|
14
|
+
- Step-by-step progress indicators
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
|
|
22
|
+
- Node.js 16+
|
|
23
|
+
- npm 8+
|
|
24
|
+
- Host application with Redux store configured
|
|
25
|
+
|
|
26
|
+
### Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Navigate to the chatbot-v2 directory
|
|
30
|
+
cd frontend/chatbot-v2
|
|
31
|
+
|
|
32
|
+
# Install dependencies
|
|
33
|
+
npm install --legacy-peer-deps
|
|
34
|
+
|
|
35
|
+
# Build the library
|
|
36
|
+
npm run build
|
|
37
|
+
|
|
38
|
+
# Create distributable package
|
|
39
|
+
npm pack
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This creates `impact-chatbot-2.0.0.tgz` in the project root.
|
|
43
|
+
|
|
44
|
+
### Install in Host Application
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# From host app directory (e.g., mtp-mfe-inventorysmart/frontend)
|
|
48
|
+
npm install ../../chatbot-v2/impact-chatbot-2.0.0.tgz --legacy-peer-deps
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Build Guide
|
|
54
|
+
|
|
55
|
+
### Development Build
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Install dependencies (use legacy-peer-deps for compatibility)
|
|
59
|
+
npm install --legacy-peer-deps
|
|
60
|
+
|
|
61
|
+
# Build library (creates dist/ folder)
|
|
62
|
+
npm run build
|
|
63
|
+
|
|
64
|
+
# Type check only (no emit)
|
|
65
|
+
npm run typecheck
|
|
66
|
+
|
|
67
|
+
# Create tarball for distribution
|
|
68
|
+
npm pack
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Build Output Structure
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
dist/
|
|
75
|
+
├── index.cjs.js # CommonJS bundle (~5.4MB)
|
|
76
|
+
├── index.esm.js # ESM bundle (~5.3MB)
|
|
77
|
+
├── index.cjs.css # Styles (~8KB)
|
|
78
|
+
├── index.esm.css # Styles (~8KB)
|
|
79
|
+
├── index.cjs.js.map # Source map
|
|
80
|
+
├── index.esm.js.map # Source map
|
|
81
|
+
├── *.d.ts # Type declarations
|
|
82
|
+
├── chatbot/ # SVG assets
|
|
83
|
+
├── components/ # Component type declarations
|
|
84
|
+
├── hooks/ # Hook type declarations
|
|
85
|
+
└── services/ # Service type declarations
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Rebuild After Changes
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Quick rebuild and reinstall in host app
|
|
92
|
+
npm run build && npm pack
|
|
93
|
+
|
|
94
|
+
# Then in host app directory:
|
|
95
|
+
npm install ../../chatbot-v2/impact-chatbot-2.0.0.tgz --legacy-peer-deps
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Installation in Host Application
|
|
101
|
+
|
|
102
|
+
### Step 1: Install the Package
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# From local tarball (recommended)
|
|
106
|
+
npm install ./path/to/impact-chatbot-2.0.0.tgz --legacy-peer-deps
|
|
107
|
+
|
|
108
|
+
# Or link locally during development
|
|
109
|
+
cd chatbot-v2 && npm link
|
|
110
|
+
cd ../host-app && npm link @impact/chatbot
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Step 2: Configure Module Aliases
|
|
114
|
+
|
|
115
|
+
The library requires the host application to provide certain modules. Add these aliases to your bundler config:
|
|
116
|
+
|
|
117
|
+
**Webpack (craco.config.js or webpack.config.js):**
|
|
118
|
+
```javascript
|
|
119
|
+
const path = require('path');
|
|
120
|
+
|
|
121
|
+
module.exports = {
|
|
122
|
+
webpack: {
|
|
123
|
+
alias: {
|
|
124
|
+
'core': path.resolve(__dirname, 'src/core'),
|
|
125
|
+
'coreAssets': path.resolve(__dirname, 'src/assets'),
|
|
126
|
+
'config': path.resolve(__dirname, 'src/config'),
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Vite (vite.config.js):**
|
|
133
|
+
```javascript
|
|
134
|
+
import { defineConfig } from 'vite';
|
|
135
|
+
import path from 'path';
|
|
136
|
+
|
|
137
|
+
export default defineConfig({
|
|
138
|
+
resolve: {
|
|
139
|
+
alias: {
|
|
140
|
+
'core': path.resolve(__dirname, 'src/core'),
|
|
141
|
+
'coreAssets': path.resolve(__dirname, 'src/assets'),
|
|
142
|
+
'config': path.resolve(__dirname, 'src/config'),
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Step 3: Import Styles
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
// In your app's entry point (e.g., index.js or App.js)
|
|
152
|
+
import '@impact/chatbot/dist/index.esm.css';
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Step 4: Configure Redux Store
|
|
156
|
+
|
|
157
|
+
Ensure your Redux store has the required reducers:
|
|
158
|
+
|
|
159
|
+
```javascript
|
|
160
|
+
// store.js
|
|
161
|
+
import { combineReducers } from 'redux';
|
|
162
|
+
import smartBotReducer from 'core/reducers/smartBotReducer';
|
|
163
|
+
import filterReducer from 'core/reducers/filterReducer';
|
|
164
|
+
|
|
165
|
+
const rootReducer = combineReducers({
|
|
166
|
+
smartBotReducer,
|
|
167
|
+
filterReducer,
|
|
168
|
+
// ... other reducers
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Usage
|
|
175
|
+
|
|
176
|
+
### Basic Usage
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
import SmartBot from '@impact/chatbot';
|
|
180
|
+
|
|
181
|
+
function App() {
|
|
182
|
+
const [showModal, setShowModal] = useState(false);
|
|
183
|
+
const [minimizedMode, setMinimizedMode] = useState(false);
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<SmartBot
|
|
187
|
+
userName="John Doe"
|
|
188
|
+
showModal={showModal}
|
|
189
|
+
setShowModal={setShowModal}
|
|
190
|
+
minimizedMode={minimizedMode}
|
|
191
|
+
setMinimizedMode={setMinimizedMode}
|
|
192
|
+
invokeBot={true}
|
|
193
|
+
dateFormat="MM/DD/YYYY"
|
|
194
|
+
/>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Props Reference
|
|
200
|
+
|
|
201
|
+
| Prop | Type | Required | Description |
|
|
202
|
+
|------|------|----------|-------------|
|
|
203
|
+
| `userName` | string | Yes | Display name for user messages |
|
|
204
|
+
| `showModal` | boolean | Yes | Controls chatbot visibility |
|
|
205
|
+
| `setShowModal` | function | Yes | Callback to toggle visibility |
|
|
206
|
+
| `minimizedMode` | boolean | Yes | Whether chatbot is minimized |
|
|
207
|
+
| `setMinimizedMode` | function | Yes | Callback to toggle minimize |
|
|
208
|
+
| `invokeBot` | boolean | No | Auto-invoke bot on mount |
|
|
209
|
+
| `dateFormat` | string | No | Date format for messages |
|
|
210
|
+
| `baseUrl` | string | No | API base URL override |
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## External Dependencies
|
|
215
|
+
|
|
216
|
+
The host application must provide these modules via aliases:
|
|
217
|
+
|
|
218
|
+
### Required Modules
|
|
219
|
+
|
|
220
|
+
| Alias | Path | Description |
|
|
221
|
+
|-------|------|-------------|
|
|
222
|
+
| `core` | `src/core` | Redux actions, utilities, styles |
|
|
223
|
+
| `coreAssets` | `src/assets` | SVG icons and images |
|
|
224
|
+
| `config` | `src/config` | API configuration |
|
|
225
|
+
|
|
226
|
+
### Key Dependencies from Host
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
core/
|
|
230
|
+
├── actions/
|
|
231
|
+
│ ├── smartBotActions.js
|
|
232
|
+
│ └── tenantConfigActions.js
|
|
233
|
+
├── reducers/
|
|
234
|
+
│ └── smartBotReducer.js
|
|
235
|
+
├── Utils/
|
|
236
|
+
│ ├── axios.js
|
|
237
|
+
│ └── functions/utils.js (replaceSpecialCharacter)
|
|
238
|
+
├── commonComponents/
|
|
239
|
+
│ ├── dateRangePicker/
|
|
240
|
+
│ └── AgGrid/
|
|
241
|
+
└── styles/
|
|
242
|
+
└── colours.js
|
|
243
|
+
|
|
244
|
+
config/
|
|
245
|
+
└── api.js (COMBINED_CROSS_DIMENSIONAL_API)
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
See [DEPENDENCIES.md](./DEPENDENCIES.md) for the complete list.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Troubleshooting
|
|
253
|
+
|
|
254
|
+
### Common Issues
|
|
255
|
+
|
|
256
|
+
**1. Module not found errors**
|
|
257
|
+
```
|
|
258
|
+
Module not found: Can't resolve 'core/...'
|
|
259
|
+
```
|
|
260
|
+
Solution: Ensure module aliases are configured in your bundler.
|
|
261
|
+
|
|
262
|
+
**2. Peer dependency warnings**
|
|
263
|
+
```
|
|
264
|
+
npm WARN peer dependencies
|
|
265
|
+
```
|
|
266
|
+
Solution: Use `--legacy-peer-deps` flag during installation.
|
|
267
|
+
|
|
268
|
+
**3. Redux state errors**
|
|
269
|
+
```
|
|
270
|
+
Cannot read property 'smartBotReducer' of undefined
|
|
271
|
+
```
|
|
272
|
+
Solution: Ensure `smartBotReducer` is added to your Redux store.
|
|
273
|
+
|
|
274
|
+
**4. Styles not loading**
|
|
275
|
+
```
|
|
276
|
+
Chatbot appears unstyled
|
|
277
|
+
```
|
|
278
|
+
Solution: Import the CSS file in your app entry point.
|
|
279
|
+
|
|
280
|
+
### Debug Mode
|
|
281
|
+
|
|
282
|
+
To enable debug logging (development only):
|
|
283
|
+
```javascript
|
|
284
|
+
localStorage.setItem('CHATBOT_DEBUG', 'true');
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Changelog
|
|
290
|
+
|
|
291
|
+
### v2.0.0 (Current)
|
|
292
|
+
|
|
293
|
+
**Features:**
|
|
294
|
+
- TypeScript conversion with full type declarations
|
|
295
|
+
- Widget data accumulation for streaming responses
|
|
296
|
+
- Special character decoding (`replaceSpecialCharacter`)
|
|
297
|
+
- Step update logic with position preservation
|
|
298
|
+
- Streaming abort handling (`wasStreamingAborted`)
|
|
299
|
+
|
|
300
|
+
**Bug Fixes:**
|
|
301
|
+
- Fixed table widget not rendering from `widget_data`
|
|
302
|
+
- Fixed step order during streaming
|
|
303
|
+
- Fixed submit button appearing after abort
|
|
304
|
+
- Removed debug console.log statements
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Source
|
|
309
|
+
|
|
310
|
+
Converted from: `frontend/src/core/commonComponents/smartBot`
|
|
311
|
+
|
|
312
|
+
## Migration from Original smartBot
|
|
313
|
+
|
|
314
|
+
This library is a drop-in replacement for the original smartBot component:
|
|
315
|
+
|
|
316
|
+
1. Install the package
|
|
317
|
+
2. Configure module aliases
|
|
318
|
+
3. Import from `@impact/chatbot` instead of `core/commonComponents/smartBot`
|
|
319
|
+
4. Import the CSS file
|
|
320
|
+
|
|
321
|
+
All props, behavior, and functionality remain compatible with the original.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
declare const ChatFooter: {
|
|
3
|
+
({ classes, globalClasses, showExtendedContent, endCurrentSession, setShowExtendedContent, userInput, setUserInput, fetchUserResultsFromQuery, loader, currentMode, setSelectedModule, chatDataRef, chatDataScreenLinkRef, initiateNewChat, setShowAlert, activeConversationId, setActiveConversationId, setChatDataState, selectedModule, isModuleChanged, setIsModuleChanged, prepareDataAndSendToAgent, currentAgentId, currentSessionId, baseUrl, customChatConfig, chatBotInfoRef, }: {
|
|
4
|
+
classes: any;
|
|
5
|
+
globalClasses: any;
|
|
6
|
+
showExtendedContent: any;
|
|
7
|
+
endCurrentSession: any;
|
|
8
|
+
setShowExtendedContent: any;
|
|
9
|
+
userInput: any;
|
|
10
|
+
setUserInput: any;
|
|
11
|
+
fetchUserResultsFromQuery: any;
|
|
12
|
+
loader: any;
|
|
13
|
+
currentMode: any;
|
|
14
|
+
setSelectedModule: any;
|
|
15
|
+
chatDataRef: any;
|
|
16
|
+
chatDataScreenLinkRef: any;
|
|
17
|
+
initiateNewChat: any;
|
|
18
|
+
setShowAlert: any;
|
|
19
|
+
activeConversationId: any;
|
|
20
|
+
setActiveConversationId: any;
|
|
21
|
+
setChatDataState: any;
|
|
22
|
+
selectedModule: any;
|
|
23
|
+
isModuleChanged: any;
|
|
24
|
+
setIsModuleChanged: any;
|
|
25
|
+
prepareDataAndSendToAgent: any;
|
|
26
|
+
currentAgentId: any;
|
|
27
|
+
currentSessionId: any;
|
|
28
|
+
baseUrl: any;
|
|
29
|
+
customChatConfig: any;
|
|
30
|
+
chatBotInfoRef: any;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
propTypes: {
|
|
33
|
+
classes: PropTypes.Validator<object>;
|
|
34
|
+
globalClasses: PropTypes.Validator<object>;
|
|
35
|
+
showExtendedContent: PropTypes.Validator<boolean>;
|
|
36
|
+
endCurrentSession: PropTypes.Validator<(...args: any[]) => any>;
|
|
37
|
+
setShowExtendedContent: PropTypes.Validator<(...args: any[]) => any>;
|
|
38
|
+
userInput: PropTypes.Validator<string>;
|
|
39
|
+
setUserInput: PropTypes.Validator<(...args: any[]) => any>;
|
|
40
|
+
fetchUserResultsFromQuery: PropTypes.Validator<(...args: any[]) => any>;
|
|
41
|
+
loader: PropTypes.Validator<boolean>;
|
|
42
|
+
currentMode: PropTypes.Validator<string>;
|
|
43
|
+
setSelectedModule: PropTypes.Validator<(...args: any[]) => any>;
|
|
44
|
+
chatDataRef: PropTypes.Validator<object>;
|
|
45
|
+
chatDataScreenLinkRef: PropTypes.Validator<object>;
|
|
46
|
+
initiateNewChat: PropTypes.Validator<(...args: any[]) => any>;
|
|
47
|
+
setShowAlert: PropTypes.Validator<(...args: any[]) => any>;
|
|
48
|
+
prepareDataAndSendToAgent: PropTypes.Validator<(...args: any[]) => any>;
|
|
49
|
+
currentAgentId: PropTypes.Validator<string>;
|
|
50
|
+
currentSessionId: PropTypes.Validator<string>;
|
|
51
|
+
baseUrl: PropTypes.Validator<string>;
|
|
52
|
+
customChatConfig: PropTypes.Validator<object>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export default ChatFooter;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
declare const ChatInput: {
|
|
3
|
+
({ classes, globalClasses, userInput, setUserInput, fetchUserResultsFromQuery, loader, currentMode, prepareDataAndSendToAgent, currentAgentId, currentSessionId, baseUrl, customChatConfig, chatBotInfoRef }: {
|
|
4
|
+
classes: any;
|
|
5
|
+
globalClasses: any;
|
|
6
|
+
userInput: any;
|
|
7
|
+
setUserInput: any;
|
|
8
|
+
fetchUserResultsFromQuery: any;
|
|
9
|
+
loader: any;
|
|
10
|
+
currentMode: any;
|
|
11
|
+
prepareDataAndSendToAgent: any;
|
|
12
|
+
currentAgentId: any;
|
|
13
|
+
currentSessionId: any;
|
|
14
|
+
baseUrl: any;
|
|
15
|
+
customChatConfig: any;
|
|
16
|
+
chatBotInfoRef: any;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
propTypes: {
|
|
19
|
+
classes: PropTypes.Validator<object>;
|
|
20
|
+
globalClasses: PropTypes.Validator<object>;
|
|
21
|
+
userInput: PropTypes.Validator<string>;
|
|
22
|
+
setUserInput: PropTypes.Validator<(...args: any[]) => any>;
|
|
23
|
+
fetchUserResultsFromQuery: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
|
+
loader: PropTypes.Validator<boolean>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default ChatInput;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
declare const ChatLayout: {
|
|
3
|
+
({ classes, globalClasses, showModal, minimizedMode, handleMouseDown, isDraggingRef, minimizedBtnRef, setShowModal, setMinimizedMode, closeBot, showExtendedContent, setShowExtendedContent, currentMode, setCurrentMode, enableRefreshAction, refreshLoader, refreshAndUpdateUserManual, children, }: {
|
|
4
|
+
classes: any;
|
|
5
|
+
globalClasses: any;
|
|
6
|
+
showModal: any;
|
|
7
|
+
minimizedMode: any;
|
|
8
|
+
handleMouseDown: any;
|
|
9
|
+
isDraggingRef: any;
|
|
10
|
+
minimizedBtnRef: any;
|
|
11
|
+
setShowModal: any;
|
|
12
|
+
setMinimizedMode: any;
|
|
13
|
+
closeBot: any;
|
|
14
|
+
showExtendedContent: any;
|
|
15
|
+
setShowExtendedContent: any;
|
|
16
|
+
currentMode: any;
|
|
17
|
+
setCurrentMode: any;
|
|
18
|
+
enableRefreshAction: any;
|
|
19
|
+
refreshLoader: any;
|
|
20
|
+
refreshAndUpdateUserManual: any;
|
|
21
|
+
children: any;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
propTypes: {
|
|
24
|
+
classes: PropTypes.Validator<object>;
|
|
25
|
+
globalClasses: PropTypes.Validator<object>;
|
|
26
|
+
showModal: PropTypes.Validator<boolean>;
|
|
27
|
+
minimizedMode: PropTypes.Validator<boolean>;
|
|
28
|
+
handleMouseDown: PropTypes.Validator<(...args: any[]) => any>;
|
|
29
|
+
isDraggingRef: PropTypes.Validator<object>;
|
|
30
|
+
minimizedBtnRef: PropTypes.Validator<object>;
|
|
31
|
+
setShowModal: PropTypes.Validator<(...args: any[]) => any>;
|
|
32
|
+
setMinimizedMode: PropTypes.Validator<(...args: any[]) => any>;
|
|
33
|
+
closeBot: PropTypes.Validator<(...args: any[]) => any>;
|
|
34
|
+
showExtendedContent: PropTypes.Validator<boolean>;
|
|
35
|
+
setShowExtendedContent: PropTypes.Validator<(...args: any[]) => any>;
|
|
36
|
+
currentMode: PropTypes.Validator<string>;
|
|
37
|
+
setCurrentMode: PropTypes.Validator<(...args: any[]) => any>;
|
|
38
|
+
enableRefreshAction: PropTypes.Validator<boolean>;
|
|
39
|
+
refreshLoader: PropTypes.Validator<boolean>;
|
|
40
|
+
refreshAndUpdateUserManual: PropTypes.Validator<(...args: any[]) => any>;
|
|
41
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export default ChatLayout;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HighlightedRenderer will take sentence
|
|
3
|
+
* as a param to it and replace the word
|
|
4
|
+
* which is inside this braces like this
|
|
5
|
+
* {word} with a highlighted word and
|
|
6
|
+
* return back this new sentence with
|
|
7
|
+
* these words highlighted
|
|
8
|
+
* @param {string} sentence
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
declare const HighlightedRenderer: ({ sentence }: {
|
|
12
|
+
sentence: any;
|
|
13
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default HighlightedRenderer;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
declare const ModuleSelection: {
|
|
3
|
+
({ classes, selectedModule, isCardVisible, setIsCardVisible, currentMode, setSelectedModule, fetchUserResultsFromQuery, setScreenName, setLink, activeConversationId, setIsModuleChanged }: {
|
|
4
|
+
classes: any;
|
|
5
|
+
selectedModule: any;
|
|
6
|
+
isCardVisible: any;
|
|
7
|
+
setIsCardVisible: any;
|
|
8
|
+
currentMode: any;
|
|
9
|
+
setSelectedModule: any;
|
|
10
|
+
fetchUserResultsFromQuery: any;
|
|
11
|
+
setScreenName: any;
|
|
12
|
+
setLink: any;
|
|
13
|
+
activeConversationId: any;
|
|
14
|
+
setIsModuleChanged: any;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
propTypes: {
|
|
17
|
+
classes: PropTypes.Validator<object>;
|
|
18
|
+
selectedModule: PropTypes.Validator<object>;
|
|
19
|
+
isCardVisible: PropTypes.Validator<boolean>;
|
|
20
|
+
setIsCardVisible: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
+
currentMode: PropTypes.Validator<string>;
|
|
22
|
+
setSelectedModule: PropTypes.Validator<(...args: any[]) => any>;
|
|
23
|
+
fetchUserResultsFromQuery: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
|
+
setScreenName: PropTypes.Validator<(...args: any[]) => any>;
|
|
25
|
+
setLink: PropTypes.Validator<(...args: any[]) => any>;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export default ModuleSelection;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const SelectedModule: ({ onSelect, selectedModule, currentMode, activeConversationId }: {
|
|
2
|
+
onSelect: any;
|
|
3
|
+
selectedModule: any;
|
|
4
|
+
currentMode: any;
|
|
5
|
+
activeConversationId: any;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SelectedModule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component to render filter value input based on display_type
|
|
3
|
+
* This component handles different field types similar to form/index.jsx
|
|
4
|
+
*/
|
|
5
|
+
declare const FilterValueInput: ({ filterConfig, value, onChange, options, isLoading, isMulti, selectedOptions, setSelectedOptions, }: {
|
|
6
|
+
filterConfig: any;
|
|
7
|
+
value: any;
|
|
8
|
+
onChange: any;
|
|
9
|
+
options?: any[];
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
isMulti?: boolean;
|
|
12
|
+
selectedOptions?: any[];
|
|
13
|
+
setSelectedOptions: any;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default FilterValueInput;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to manage mention state
|
|
4
|
+
* @returns {Object} Mention state and setters
|
|
5
|
+
*/
|
|
6
|
+
export declare const useMentionState: () => {
|
|
7
|
+
showMentionSelect: boolean;
|
|
8
|
+
isSelectOpen: boolean;
|
|
9
|
+
mentionStartPos: any;
|
|
10
|
+
mentionSearch: string;
|
|
11
|
+
currentMentionGroupId: any;
|
|
12
|
+
selectionStage: string;
|
|
13
|
+
selectedFilter: any;
|
|
14
|
+
currentOptions: any[];
|
|
15
|
+
selectedOptions: any[];
|
|
16
|
+
isAllSelected: boolean;
|
|
17
|
+
isLoadingValues: boolean;
|
|
18
|
+
prevIsOpenRef: React.MutableRefObject<boolean>;
|
|
19
|
+
setShowMentionSelect: React.Dispatch<React.SetStateAction<boolean>>;
|
|
20
|
+
setIsSelectOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
21
|
+
setMentionStartPos: React.Dispatch<any>;
|
|
22
|
+
setMentionSearch: React.Dispatch<React.SetStateAction<string>>;
|
|
23
|
+
setCurrentMentionGroupId: React.Dispatch<any>;
|
|
24
|
+
setSelectionStage: React.Dispatch<React.SetStateAction<string>>;
|
|
25
|
+
setSelectedFilter: React.Dispatch<any>;
|
|
26
|
+
setCurrentOptions: React.Dispatch<React.SetStateAction<any[]>>;
|
|
27
|
+
setSelectedOptions: React.Dispatch<React.SetStateAction<any[]>>;
|
|
28
|
+
setIsAllSelected: React.Dispatch<React.SetStateAction<boolean>>;
|
|
29
|
+
setIsLoadingValues: React.Dispatch<React.SetStateAction<boolean>>;
|
|
30
|
+
resetMentionState: () => void;
|
|
31
|
+
initializeFilterSelection: (position: any, filterOptions: any) => void;
|
|
32
|
+
transitionToValueSelection: (filter: any, valueOptions: any) => void;
|
|
33
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build payload for filter options API
|
|
3
|
+
* @param {Object} filterConfig - The selected filter configuration
|
|
4
|
+
* @param {Array} existingFilters - Array of existing filter selections from editor
|
|
5
|
+
* @param {Array} filterOptions - All available filter options (to get full filter config)
|
|
6
|
+
* @returns {Object} API payload
|
|
7
|
+
*/
|
|
8
|
+
export declare const buildFilterOptionsPayload: (filterConfig: any, existingFilters?: any[], filterOptions?: any[]) => {
|
|
9
|
+
attributes: {
|
|
10
|
+
attribute_name: any;
|
|
11
|
+
dimension: any;
|
|
12
|
+
filter_type: string;
|
|
13
|
+
}[];
|
|
14
|
+
filter_type: string;
|
|
15
|
+
filters: {
|
|
16
|
+
filter_name: any;
|
|
17
|
+
filter_id: any;
|
|
18
|
+
filter_type: string;
|
|
19
|
+
dimension: any;
|
|
20
|
+
display_type: any;
|
|
21
|
+
check_configuration: any[];
|
|
22
|
+
is_mandatory: any;
|
|
23
|
+
extra: {};
|
|
24
|
+
values: any;
|
|
25
|
+
attribute_name: any;
|
|
26
|
+
operator: string;
|
|
27
|
+
display_order: any;
|
|
28
|
+
}[];
|
|
29
|
+
is_urm_filter: boolean;
|
|
30
|
+
screen_name: string;
|
|
31
|
+
application_code: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Fetch filter values from API (with caching)
|
|
35
|
+
* @param {Object} filterConfig - The selected filter configuration
|
|
36
|
+
* @param {Array} existingFilters - Array of existing filter selections from editor
|
|
37
|
+
* @param {Array} filterOptions - All available filter options (to get full filter config)
|
|
38
|
+
* @returns {Promise<Array>} Array of filter values
|
|
39
|
+
*/
|
|
40
|
+
export declare const fetchFilterValues: (filterConfig: any, existingFilters?: any[], filterOptions?: any[]) => Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Clear the filter values cache
|
|
43
|
+
* Useful for testing or when you want to force fresh data
|
|
44
|
+
*/
|
|
45
|
+
export declare const clearFilterValuesCache: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Get cache size (for debugging)
|
|
48
|
+
* @returns {number} Number of cached filter values
|
|
49
|
+
*/
|
|
50
|
+
export declare const getCacheSize: () => number;
|