@satek-team-intern/chatbot-widget 0.10.0 → 0.10.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.
- package/README.md +34 -39
- package/dist/chatbot-widget.es.js +4356 -4374
- package/dist/chatbot-widget.umd.js +16 -15
- package/dist/locales/en.json.d.ts +2 -1
- package/dist/locales/vi.json.d.ts +7 -5
- package/dist/src/assets/Icons.d.ts +2 -0
- package/dist/src/assets/createIcon.d.ts +2 -2
- package/dist/src/components/ChatWidget.d.ts +3 -3
- package/dist/src/components/ChatWindow.d.ts +3 -3
- package/dist/src/components/FloatingButton.d.ts +3 -3
- package/dist/src/components/index.d.ts +4 -0
- package/dist/src/components/modals/AddChat.d.ts +3 -3
- package/dist/src/components/modals/AddGroup.d.ts +6 -0
- package/dist/src/components/modals/AddMember.d.ts +3 -3
- package/dist/src/components/modals/FileViewer.d.ts +3 -3
- package/dist/src/components/modals/ThemeModal.d.ts +2 -2
- package/dist/src/components/modals/UpdateGroup.d.ts +3 -3
- package/dist/src/components/modals/UserProfileModal.d.ts +3 -3
- package/dist/src/components/modals/index.d.ts +2 -1
- package/dist/src/components/shared/ChatAvatar.d.ts +1 -1
- package/dist/src/components/shared/MemberAvatarFallBack.d.ts +5 -0
- package/dist/src/components/shared/ToastContainer.d.ts +2 -3
- package/dist/src/components/shared/index.d.ts +3 -0
- package/dist/src/components/sidebar/AppSideBar.d.ts +2 -3
- package/dist/src/components/sidebar/ChatInfoPanel.d.ts +11 -0
- package/dist/src/components/sidebar/ChatList.d.ts +4 -4
- package/dist/src/components/sidebar/ChatSearchBar.d.ts +2 -2
- package/dist/src/components/sidebar/SideBarInfoChat.d.ts +4 -4
- package/dist/src/components/sidebar/index.d.ts +1 -0
- package/dist/src/components/view/ChatHeader.d.ts +3 -3
- package/dist/src/components/view/ChatInput.d.ts +1 -2
- package/dist/src/components/view/ContactList.d.ts +3 -3
- package/dist/src/components/view/GroupList.d.ts +3 -3
- package/dist/src/components/view/MessageFiles.d.ts +3 -3
- package/dist/src/components/view/MessageItem.d.ts +3 -3
- package/dist/src/components/view/MessageList.d.ts +2 -2
- package/dist/src/components/view/index.d.ts +3 -2
- package/dist/src/constants/common.d.ts +1 -0
- package/dist/src/constants/file.d.ts +2 -0
- package/dist/src/constants/index.d.ts +2 -0
- package/dist/src/contexts/FileViewerContext.d.ts +5 -5
- package/dist/src/contexts/ToastContext.d.ts +3 -3
- package/dist/src/contexts/index.d.ts +2 -1
- package/dist/src/hooks/index.d.ts +3 -0
- package/dist/src/hooks/useChat.d.ts +2 -2
- package/dist/src/hooks/useDragDropFiles.d.ts +5 -4
- package/dist/src/hooks/useFileViewer.d.ts +1 -1
- package/dist/src/hooks/useSetting.d.ts +1 -1
- package/dist/src/hooks/useToast.d.ts +1 -1
- package/dist/src/hooks/useTranslation.d.ts +2 -1
- package/dist/src/locales/index.d.ts +3 -0
- package/dist/src/services/chat.service.d.ts +3 -4
- package/dist/src/services/index.d.ts +2 -0
- package/dist/src/services/language.service.d.ts +2 -2
- package/dist/src/store/index.d.ts +2 -0
- package/dist/src/store/selectors/index.d.ts +1 -0
- package/dist/src/store/selectors/setting.d.ts +5 -5
- package/dist/src/store/slices/chatSlice.d.ts +3 -4
- package/dist/src/store/slices/index.d.ts +2 -0
- package/dist/src/store/slices/settingSlice.d.ts +2 -3
- package/dist/src/store/store.d.ts +2 -2
- package/dist/src/styles/index.d.ts +1 -0
- package/dist/src/types/chat.type.d.ts +2 -2
- package/dist/src/types/types.d.ts +2 -6
- package/dist/src/utils/chat.utils.d.ts +1 -2
- package/dist/src/utils/file.utils.d.ts +16 -0
- package/dist/src/utils/format.utils.d.ts +2 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -61,6 +61,7 @@ export default function App() {
|
|
|
61
61
|
return (
|
|
62
62
|
<ChatWidget
|
|
63
63
|
title="Hỗ trợ"
|
|
64
|
+
workspace="dev"
|
|
64
65
|
logoUrl="https://example.com/logo.png"
|
|
65
66
|
primaryColor="#6366f1"
|
|
66
67
|
auth={{
|
|
@@ -73,10 +74,9 @@ export default function App() {
|
|
|
73
74
|
chatKey="your_chat_key_here"
|
|
74
75
|
features={{
|
|
75
76
|
attachments: ['image', 'video', 'file'],
|
|
76
|
-
languages: ['english', 'vietnamese'],
|
|
77
77
|
communication: ['voice'],
|
|
78
78
|
chatModes: ['single', 'group'],
|
|
79
|
-
customizations: ['change-color', 'change-theme'],
|
|
79
|
+
customizations: ['change-color', 'change-theme', 'multi-language'],
|
|
80
80
|
}}
|
|
81
81
|
/>
|
|
82
82
|
);
|
|
@@ -104,6 +104,7 @@ if (container) {
|
|
|
104
104
|
<React.StrictMode>
|
|
105
105
|
<ChatWidget
|
|
106
106
|
title="Hỗ trợ khách hàng"
|
|
107
|
+
workspace="production"
|
|
107
108
|
logoUrl="https://example.com/logo.png"
|
|
108
109
|
primaryColor="#6366f1"
|
|
109
110
|
auth={{
|
|
@@ -116,10 +117,9 @@ if (container) {
|
|
|
116
117
|
chatKey="your_chat_key_here"
|
|
117
118
|
features={{
|
|
118
119
|
attachments: ['image', 'video', 'audio', 'file', 'multiple'],
|
|
119
|
-
languages: ['english', 'vietnamese'],
|
|
120
120
|
communication: ['voice'],
|
|
121
121
|
chatModes: ['single', 'group'],
|
|
122
|
-
customizations: ['change-color', 'change-theme'],
|
|
122
|
+
customizations: ['change-color', 'change-theme', 'multi-language'],
|
|
123
123
|
}}
|
|
124
124
|
/>
|
|
125
125
|
</React.StrictMode>,
|
|
@@ -158,6 +158,7 @@ Or use jsdelivr CDN:
|
|
|
158
158
|
<script>
|
|
159
159
|
ChatbotWidget.init({
|
|
160
160
|
title: 'Customer Support',
|
|
161
|
+
workspace: 'production',
|
|
161
162
|
logoUrl: 'https://example.com/logo.png',
|
|
162
163
|
primaryColor: '#6366f1',
|
|
163
164
|
auth: {
|
|
@@ -170,10 +171,9 @@ Or use jsdelivr CDN:
|
|
|
170
171
|
chatKey: 'your_chat_key_here',
|
|
171
172
|
features: {
|
|
172
173
|
attachments: ['image', 'video', 'audio', 'file', 'multiple'],
|
|
173
|
-
languages: ['english', 'vietnamese'],
|
|
174
174
|
communication: ['voice'],
|
|
175
175
|
chatModes: ['single', 'group'],
|
|
176
|
-
customizations: ['change-color', 'change-theme'],
|
|
176
|
+
customizations: ['change-color', 'change-theme', 'multi-language'],
|
|
177
177
|
},
|
|
178
178
|
});
|
|
179
179
|
</script>
|
|
@@ -187,30 +187,31 @@ Or use jsdelivr CDN:
|
|
|
187
187
|
|
|
188
188
|
### Props / Options
|
|
189
189
|
|
|
190
|
-
| Name | Type | Required | Description
|
|
191
|
-
| ------------------------- | ------ | -------- |
|
|
192
|
-
| `title` | string | ✅ | Title of the chat widget
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `auth
|
|
198
|
-
| `auth.
|
|
199
|
-
| `auth.
|
|
200
|
-
| `auth.
|
|
201
|
-
| `auth.
|
|
202
|
-
| `
|
|
203
|
-
| `features
|
|
204
|
-
| `features.
|
|
205
|
-
| `features.communication` | array | ❌ | Communication features: `'voice'` for voice recording and audio messages. Default: `[]`
|
|
206
|
-
| `features.chatModes` | array | ❌ | Supported chat modes: `'single'` for one-to-one chat, `'group'` for group chat. Default: `['single']`
|
|
207
|
-
| `features.customizations` | array | ❌ | User customization options: `'change-color'` to allow color customization, `'change-theme'` to allow theme switching. Default: `[]`
|
|
190
|
+
| Name | Type | Required | Description |
|
|
191
|
+
| ------------------------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
192
|
+
| `title` | string | ✅ | Title of the chat widget |
|
|
193
|
+
| `workspace` | string | ❌ | Workspace identifier for multi-workspace support. Max 50 chars, supports lowercase, numbers, symbols (\_), (-), (.) |
|
|
194
|
+
| `logoUrl` | string | ❌ | URL of the logo image to display in the widget header |
|
|
195
|
+
| `primaryColor` | string | ❌ | Primary color (hex format). Default: #6366f1 |
|
|
196
|
+
| `chatKey` | string | ✅ | Authentication key to connect to backend |
|
|
197
|
+
| `auth` | object | ✅ | User authentication information |
|
|
198
|
+
| `auth.code` | string | ✅ | Unique user identifier |
|
|
199
|
+
| `auth.name` | string | ✅ | User name |
|
|
200
|
+
| `auth.avatar` | string | ✅ | URL of user avatar image |
|
|
201
|
+
| `auth.phone` | string | ❌ | User phone number |
|
|
202
|
+
| `auth.email` | string | ✅ | User email address |
|
|
203
|
+
| `features` | object | ❌ | Feature configuration object with properties: `attachments`, `communication`, `chatModes`, `customizations` |
|
|
204
|
+
| `features.attachments` | array | ❌ | Allowed file types for upload: `'image'`, `'video'`, `'audio'`, `'file'`, `'multiple'`. If not provided, no file upload allowed |
|
|
205
|
+
| `features.communication` | array | ❌ | Communication features: `'voice'` for voice recording and audio messages. Default: `[]` |
|
|
206
|
+
| `features.chatModes` | array | ❌ | Supported chat modes: `'single'` for one-to-one chat, `'group'` for group chat. Default: `['single']` |
|
|
207
|
+
| `features.customizations` | array | ❌ | User customization options: `'change-color'` to allow color customization, `'change-theme'` to allow theme switching. Default: `[]` |
|
|
208
208
|
|
|
209
209
|
### Configuration example
|
|
210
210
|
|
|
211
211
|
```javascript
|
|
212
212
|
{
|
|
213
213
|
title: 'Customer Support',
|
|
214
|
+
workspace: 'production',
|
|
214
215
|
logoUrl: 'https://example.com/logo.png',
|
|
215
216
|
primaryColor: '#FF6B6B',
|
|
216
217
|
auth: {
|
|
@@ -223,10 +224,9 @@ Or use jsdelivr CDN:
|
|
|
223
224
|
chatKey: 'secure_key_abc123xyz',
|
|
224
225
|
features: {
|
|
225
226
|
attachments: ['image', 'video', 'file', 'multiple'],
|
|
226
|
-
languages: ['english', 'vietnamese'],
|
|
227
227
|
communication: ['voice'],
|
|
228
228
|
chatModes: ['single', 'group'],
|
|
229
|
-
customizations: ['change-color', 'change-theme'],
|
|
229
|
+
customizations: ['change-color', 'change-theme', 'multi-language'],
|
|
230
230
|
},
|
|
231
231
|
}
|
|
232
232
|
```
|
|
@@ -311,9 +311,9 @@ ChatbotWidget.init({
|
|
|
311
311
|
<ChatWidget
|
|
312
312
|
features={{
|
|
313
313
|
attachments: ['image', 'video', 'file'],
|
|
314
|
-
languages: ['english', 'vietnamese'],
|
|
315
314
|
communication: ['voice'],
|
|
316
315
|
chatModes: ['single', 'group'],
|
|
316
|
+
customizations: ['multi-language'],
|
|
317
317
|
}}
|
|
318
318
|
// ... other props
|
|
319
319
|
/>
|
|
@@ -325,9 +325,9 @@ ChatbotWidget.init({
|
|
|
325
325
|
ChatbotWidget.init({
|
|
326
326
|
features: {
|
|
327
327
|
attachments: ['image', 'video', 'file'],
|
|
328
|
-
languages: ['english', 'vietnamese'],
|
|
329
328
|
communication: ['voice'],
|
|
330
329
|
chatModes: ['single', 'group'],
|
|
330
|
+
customizations: ['multi-language'],
|
|
331
331
|
},
|
|
332
332
|
// ... other options
|
|
333
333
|
});
|
|
@@ -454,16 +454,16 @@ ChatbotWidget.init({
|
|
|
454
454
|
});
|
|
455
455
|
```
|
|
456
456
|
|
|
457
|
-
### Configure language support
|
|
457
|
+
### Configure multi-language support
|
|
458
458
|
|
|
459
|
-
Enable language
|
|
459
|
+
Enable multi-language support by adding `'multi-language'` to the customizations array:
|
|
460
460
|
|
|
461
461
|
**React:**
|
|
462
462
|
|
|
463
463
|
```jsx
|
|
464
464
|
<ChatWidget
|
|
465
465
|
features={{
|
|
466
|
-
|
|
466
|
+
customizations: ['multi-language'],
|
|
467
467
|
}}
|
|
468
468
|
// ... other props
|
|
469
469
|
/>
|
|
@@ -474,18 +474,13 @@ Enable language switching by adding language options to the `languages` array in
|
|
|
474
474
|
```javascript
|
|
475
475
|
ChatbotWidget.init({
|
|
476
476
|
features: {
|
|
477
|
-
|
|
477
|
+
customizations: ['multi-language'],
|
|
478
478
|
},
|
|
479
479
|
// ... other options
|
|
480
480
|
});
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
- `'english'` - English
|
|
486
|
-
- `'vietnamese'` - Tiếng Việt
|
|
487
|
-
|
|
488
|
-
**Note:** When multiple language options are enabled, users will see a language switcher in the widget interface.
|
|
483
|
+
When `'multi-language'` is enabled, users will see a language switcher in the widget interface to switch between available languages (English and Vietnamese).
|
|
489
484
|
|
|
490
485
|
---
|
|
491
486
|
|
|
@@ -548,7 +543,7 @@ This documentation provides detailed instructions on how to use the Chat SDK fun
|
|
|
548
543
|
// Create SDK instance
|
|
549
544
|
const chatSDK = new initSChat();
|
|
550
545
|
|
|
551
|
-
// Create SDK instance with
|
|
546
|
+
// Create SDK instance with workspace. Max 50 chars. Supports lowercase, numbers, and symbols (_), (-), (.).
|
|
552
547
|
const chatSDK = new initSChat('dev');
|
|
553
548
|
|
|
554
549
|
// Configure if needed
|