@satek-team-intern/chatbot-widget 0.10.8 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -32
- package/dist/assets/background_chatlive_setting.webp +0 -0
- package/dist/chatbot-widget.es.js +5636 -3926
- package/dist/chatbot-widget.umd.js +5 -21
- package/dist/constants/scenario_guest_vi.json.d.ts +103 -0
- package/dist/index.d.ts +1 -0
- package/dist/locales/en.json.d.ts +75 -7
- package/dist/locales/vi.json.d.ts +76 -8
- package/dist/src/assets/Icons.d.ts +67 -48
- package/dist/src/assets/createIcon.d.ts +5 -1
- package/dist/src/components/ChatWindow.d.ts +2 -31
- package/dist/src/components/FloatingButton.d.ts +1 -17
- package/dist/src/components/account/MultiChatManager.d.ts +6 -0
- package/dist/src/components/account/index.d.ts +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/modals/AddGroup.d.ts +0 -1
- package/dist/src/components/modals/AddMember.d.ts +0 -1
- package/dist/src/components/modals/UpdateGroup.d.ts +0 -2
- package/dist/src/components/modals/UserProfileModal.d.ts +1 -10
- package/dist/src/components/shared/AvatarFallBack.d.ts +2 -2
- package/dist/src/components/shared/OnboardingFormBlock.d.ts +10 -0
- package/dist/src/components/shared/QuickReplyButton.d.ts +13 -0
- package/dist/src/components/shared/index.d.ts +2 -1
- package/dist/src/components/sidebar/AppSideBar.d.ts +1 -4
- package/dist/src/components/sidebar/ChatInfoPanel.d.ts +0 -1
- package/dist/src/components/sidebar/ChatList.d.ts +0 -1
- package/dist/src/components/sidebar/ChatSearchBar.d.ts +0 -1
- package/dist/src/components/sidebar/ChatSidebar.d.ts +9 -0
- package/dist/src/components/sidebar/index.d.ts +1 -0
- package/dist/src/components/view/ChatHeader.d.ts +0 -4
- package/dist/src/components/view/ChatListItem.d.ts +1 -3
- package/dist/src/components/view/ChatMainArea.d.ts +9 -0
- package/dist/src/components/view/ChatMainHeader.d.ts +6 -0
- package/dist/src/components/view/ChatliveSetting.d.ts +1 -0
- package/dist/src/components/view/ContactList.d.ts +1 -1
- package/dist/src/components/view/EmptyChatState.d.ts +1 -0
- package/dist/src/components/view/FileIconMap.d.ts +8 -0
- package/dist/src/components/view/GroupList.d.ts +1 -0
- package/dist/src/components/view/ImageFileItem.d.ts +1 -1
- package/dist/src/components/view/MessageFiles.d.ts +3 -0
- package/dist/src/components/view/MessageItem.d.ts +1 -2
- package/dist/src/components/view/SettingSection.d.ts +1 -0
- package/dist/src/components/view/ThemeSetting.d.ts +1 -3
- package/dist/src/components/view/WindowResizeHandles.d.ts +6 -0
- package/dist/src/components/view/index.d.ts +6 -0
- package/dist/src/constants/common.d.ts +3 -1
- package/dist/src/constants/index.d.ts +4 -0
- package/dist/src/constants/onboarding.d.ts +4 -0
- package/dist/src/constants/permissionRules.d.ts +25 -0
- package/dist/src/constants/permissions.d.ts +15 -0
- package/dist/src/hooks/index.d.ts +7 -1
- package/dist/src/hooks/useChat.d.ts +2 -2
- package/dist/src/hooks/useChatActions.d.ts +9 -0
- package/dist/src/hooks/useChatSearch.d.ts +27 -0
- package/dist/src/hooks/useChatWidget.d.ts +4 -0
- package/dist/src/hooks/usePermissions.d.ts +9 -0
- package/dist/src/hooks/useProcessOnboarding.d.ts +3 -0
- package/dist/src/hooks/useSetting.d.ts +4 -1
- package/dist/src/hooks/useVoiceRecorder.d.ts +1 -1
- package/dist/src/hooks/useWindowControls.d.ts +14 -0
- package/dist/src/services/chat.service.d.ts +8 -9
- package/dist/src/services/chatManager.service.d.ts +16 -0
- package/dist/src/services/index.d.ts +1 -0
- package/dist/src/store/selectors/chat.d.ts +5 -0
- package/dist/src/store/selectors/index.d.ts +1 -0
- package/dist/src/store/selectors/setting.d.ts +3 -34
- package/dist/src/store/slices/chatSlice.d.ts +108 -5
- package/dist/src/store/slices/index.d.ts +2 -0
- package/dist/src/store/slices/layoutSlice.d.ts +12 -0
- package/dist/src/store/slices/onboardingSlice.d.ts +15 -0
- package/dist/src/store/slices/settingSlice.d.ts +5 -2
- package/dist/src/store/store.d.ts +5 -1
- package/dist/src/types/chat.type.d.ts +79 -6
- package/dist/src/types/index.d.ts +2 -0
- package/dist/src/types/layout.type.d.ts +13 -0
- package/dist/src/types/onboarding.type.d.ts +45 -0
- package/dist/src/types/types.d.ts +23 -10
- package/dist/src/utils/chat.utils.d.ts +7 -12
- package/dist/src/utils/engine.utils.d.ts +5 -0
- package/dist/src/utils/file.utils.d.ts +4 -6
- package/dist/src/utils/format.utils.d.ts +1 -1
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/text.utils.d.ts +1 -0
- package/package.json +2 -1
- package/dist/src/components/modals/AddChat.d.ts +0 -16
- package/dist/src/components/modals/ThemeModal.d.ts +0 -8
- package/dist/src/components/shared/ChatAvatar.d.ts +0 -5
- package/dist/src/components/shared/MemberAvatarFallBack.d.ts +0 -5
- package/dist/src/components/sidebar/SideBarInfoChat.d.ts +0 -11
- package/dist/src/styles/index.d.ts +0 -1
- package/dist/src/utils/formatDateLabel.d.ts +0 -1
package/README.md
CHANGED
|
@@ -60,6 +60,7 @@ import { ChatWidget } from '@satek-vn/chatbot-widget';
|
|
|
60
60
|
export default function App() {
|
|
61
61
|
return (
|
|
62
62
|
<ChatWidget
|
|
63
|
+
scope="internal"
|
|
63
64
|
title="Hỗ trợ"
|
|
64
65
|
workspace="dev"
|
|
65
66
|
logoUrl="https://example.com/logo.png"
|
|
@@ -80,8 +81,8 @@ export default function App() {
|
|
|
80
81
|
}}
|
|
81
82
|
language="english"
|
|
82
83
|
initPosition={{
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
right: 20,
|
|
85
|
+
bottom: 20,
|
|
85
86
|
}}
|
|
86
87
|
/>
|
|
87
88
|
);
|
|
@@ -108,6 +109,7 @@ if (container) {
|
|
|
108
109
|
ReactDOM.createRoot(container).render(
|
|
109
110
|
<React.StrictMode>
|
|
110
111
|
<ChatWidget
|
|
112
|
+
scope="internal"
|
|
111
113
|
title="Hỗ trợ khách hàng"
|
|
112
114
|
workspace="production"
|
|
113
115
|
logoUrl="https://example.com/logo.png"
|
|
@@ -128,8 +130,8 @@ if (container) {
|
|
|
128
130
|
}}
|
|
129
131
|
language="english"
|
|
130
132
|
initPosition={{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
right: 20,
|
|
134
|
+
bottom: 20,
|
|
133
135
|
}}
|
|
134
136
|
/>
|
|
135
137
|
</React.StrictMode>,
|
|
@@ -167,6 +169,7 @@ Or use jsdelivr CDN:
|
|
|
167
169
|
<script src="https://unpkg.com/@satek-vn/chatbot-widget/dist/chatbot-widget.umd.js"></script>
|
|
168
170
|
<script>
|
|
169
171
|
ChatbotWidget.init({
|
|
172
|
+
scope: 'internal',
|
|
170
173
|
title: 'Customer Support',
|
|
171
174
|
workspace: 'production',
|
|
172
175
|
logoUrl: 'https://example.com/logo.png',
|
|
@@ -187,8 +190,8 @@ Or use jsdelivr CDN:
|
|
|
187
190
|
},
|
|
188
191
|
language: 'english',
|
|
189
192
|
initPosition: {
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
right: 20,
|
|
194
|
+
bottom: 20,
|
|
192
195
|
},
|
|
193
196
|
});
|
|
194
197
|
</script>
|
|
@@ -202,31 +205,34 @@ Or use jsdelivr CDN:
|
|
|
202
205
|
|
|
203
206
|
### Props / Options
|
|
204
207
|
|
|
205
|
-
| Name | Type | Required | Description
|
|
206
|
-
| ------------------------- | ------ | -------- |
|
|
207
|
-
| `
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `auth
|
|
214
|
-
| `auth.
|
|
215
|
-
| `auth.
|
|
216
|
-
| `auth.
|
|
217
|
-
| `auth.
|
|
218
|
-
| `
|
|
219
|
-
| `features
|
|
220
|
-
| `features.
|
|
221
|
-
| `features.
|
|
222
|
-
| `features.
|
|
223
|
-
| `
|
|
224
|
-
| `
|
|
208
|
+
| Name | Type | Required | Description |
|
|
209
|
+
| ------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
210
|
+
| `scope` | string | ❌ | Widget scope: `'external'` for external websites, `'internal'` for internal systems. Default: `'external'` |
|
|
211
|
+
| `title` | string | ✅ | Title of the chat widget |
|
|
212
|
+
| `workspace` | string | ✅ | Workspace identifier for multi-workspace support. Max 50 chars, supports lowercase, numbers, symbols (\_), (-), (.) |
|
|
213
|
+
| `logoUrl` | string | ❌ | URL of the logo image to display in the widget header |
|
|
214
|
+
| `primaryColor` | string | ❌ | Primary color (hex format). Default: #6366f1 |
|
|
215
|
+
| `chatKey` | string | ✅ | Authentication key to connect to backend |
|
|
216
|
+
| `auth` | object | ✅ | User authentication information |
|
|
217
|
+
| `auth.code` | string | ✅ | Unique user identifier |
|
|
218
|
+
| `auth.name` | string | ✅ | User name |
|
|
219
|
+
| `auth.avatar` | string | ✅ | URL of user avatar image |
|
|
220
|
+
| `auth.phone` | string | ❌ | User phone number |
|
|
221
|
+
| `auth.email` | string | ✅ | User email address |
|
|
222
|
+
| `features` | object | ❌ | Feature configuration object with properties: `attachments`, `communication`, `chatModes`, `customizations` |
|
|
223
|
+
| `features.attachments` | array | ❌ | Allowed file types for upload: `'image'`, `'video'`, `'audio'`, `'file'`, `'multiple'`. If not provided, no file upload allowed |
|
|
224
|
+
| `features.communication` | array | ❌ | Communication features: `'voice'` for voice recording and audio messages. Default: `[]` |
|
|
225
|
+
| `features.chatModes` | array | ❌ | Supported chat modes: `'single'` for one-to-one chat, `'group'` for group chat. Default: `['single']` |
|
|
226
|
+
| `features.customizations` | array | ❌ | User customization options: `'change-color'` to allow color customization, `'change-theme'` to allow theme switching, `'drag-and-drop'` to enable widget repositioning, `'resize-window'` to allow resizing the chat window. Default: `[]` |
|
|
227
|
+
| `language` | string | ❌ | Initial language setting: `'english'` or `'vietnamese'`. If not provided, user can toggle language via UI button. Default: `'vietnamese'` |
|
|
228
|
+
| `initPosition` | object | ❌ | Initial position of the widget. Object with `right` (distance from right edge) and `bottom` (distance from bottom edge) in pixels |
|
|
229
|
+
| `disabledMembers` | array | ❌ | List of member IDs (codes) to hide from the member list in group chat. Only applies when `scope` is `'internal'` |
|
|
225
230
|
|
|
226
231
|
### Configuration example
|
|
227
232
|
|
|
228
233
|
```javascript
|
|
229
234
|
{
|
|
235
|
+
scope: 'internal',
|
|
230
236
|
title: 'Customer Support',
|
|
231
237
|
workspace: 'production',
|
|
232
238
|
logoUrl: 'https://example.com/logo.png',
|
|
@@ -247,9 +253,10 @@ Or use jsdelivr CDN:
|
|
|
247
253
|
},
|
|
248
254
|
language: 'english',
|
|
249
255
|
initPosition: {
|
|
250
|
-
|
|
251
|
-
|
|
256
|
+
right: 20,
|
|
257
|
+
bottom: 20,
|
|
252
258
|
},
|
|
259
|
+
disabledMembers: ['user_1008', 'user_1002'],
|
|
253
260
|
}
|
|
254
261
|
```
|
|
255
262
|
|
|
@@ -420,16 +427,21 @@ Supported chat modes:
|
|
|
420
427
|
- `'single'` - One-to-one direct messaging
|
|
421
428
|
- `'group'` - Group chat with multiple participants
|
|
422
429
|
|
|
423
|
-
###
|
|
430
|
+
### Configure widget customizations
|
|
424
431
|
|
|
425
|
-
Enable users to
|
|
432
|
+
Enable users to customize the widget interface and behavior:
|
|
426
433
|
|
|
427
434
|
**React:**
|
|
428
435
|
|
|
429
436
|
```jsx
|
|
430
437
|
<ChatWidget
|
|
431
438
|
features={{
|
|
432
|
-
customizations: [
|
|
439
|
+
customizations: [
|
|
440
|
+
'change-color',
|
|
441
|
+
'change-theme',
|
|
442
|
+
'drag-and-drop',
|
|
443
|
+
'resize-window',
|
|
444
|
+
],
|
|
433
445
|
}}
|
|
434
446
|
// ... other props
|
|
435
447
|
/>
|
|
@@ -440,12 +452,24 @@ Enable users to change the widget's color and theme using customization features
|
|
|
440
452
|
```javascript
|
|
441
453
|
ChatbotWidget.init({
|
|
442
454
|
features: {
|
|
443
|
-
customizations: [
|
|
455
|
+
customizations: [
|
|
456
|
+
'change-color',
|
|
457
|
+
'change-theme',
|
|
458
|
+
'drag-and-drop',
|
|
459
|
+
'resize-window',
|
|
460
|
+
],
|
|
444
461
|
},
|
|
445
462
|
// ... other options
|
|
446
463
|
});
|
|
447
464
|
```
|
|
448
465
|
|
|
466
|
+
Supported customization options:
|
|
467
|
+
|
|
468
|
+
- `'change-color'` - Allow users to change the primary color of the widget
|
|
469
|
+
- `'change-theme'` - Allow users to toggle between light and dark themes
|
|
470
|
+
- `'drag-and-drop'` - Allow users to reposition the widget on the screen by dragging it
|
|
471
|
+
- `'resize-window'` - Allow users to resize the chat window by dragging its edges
|
|
472
|
+
|
|
449
473
|
### Configure language support
|
|
450
474
|
|
|
451
475
|
You can set the initial language for the widget using the `language` prop:
|
|
@@ -1011,6 +1035,31 @@ await chatSDK.actionMessage(123, 456, 'remove');
|
|
|
1011
1035
|
|
|
1012
1036
|
---
|
|
1013
1037
|
|
|
1038
|
+
### `getSystemMessages(limit, page)` - Get list of system messages
|
|
1039
|
+
|
|
1040
|
+
Retrieve a list of system messages for the current member.
|
|
1041
|
+
|
|
1042
|
+
**Parameters:**
|
|
1043
|
+
- `limit` (Number, optional): Per page (default: 20)
|
|
1044
|
+
- `page` (Number, optional): Page (default: 1)
|
|
1045
|
+
|
|
1046
|
+
**Returns:** Promise returning result
|
|
1047
|
+
|
|
1048
|
+
**Example:**
|
|
1049
|
+
|
|
1050
|
+
```javascript
|
|
1051
|
+
// Get last 20 messages
|
|
1052
|
+
const messages = await chatSDK.getSystemMessages();
|
|
1053
|
+
|
|
1054
|
+
// Get 50 messages
|
|
1055
|
+
const moreMessages = await chatSDK.getSystemMessages(50);
|
|
1056
|
+
|
|
1057
|
+
// Load history: page 2
|
|
1058
|
+
const oldMessages = await chatSDK.getSystemMessages(20, 2);
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
---
|
|
1062
|
+
|
|
1014
1063
|
## Event System
|
|
1015
1064
|
|
|
1016
1065
|
SDK uses an event system to notify real-time changes.
|
|
@@ -1019,6 +1068,7 @@ SDK uses an event system to notify real-time changes.
|
|
|
1019
1068
|
|
|
1020
1069
|
```javascript
|
|
1021
1070
|
chatSDK.EVENTS = {
|
|
1071
|
+
system_message: 'system.messages', // System message
|
|
1022
1072
|
chats_created: 'chats.created', // New chat created
|
|
1023
1073
|
chats_updated: 'chats.updated', // Chat updated
|
|
1024
1074
|
chats_deleted: 'chats.deleted', // Chat deleted
|
|
Binary file
|