@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.
Files changed (69) hide show
  1. package/README.md +34 -39
  2. package/dist/chatbot-widget.es.js +4356 -4374
  3. package/dist/chatbot-widget.umd.js +16 -15
  4. package/dist/locales/en.json.d.ts +2 -1
  5. package/dist/locales/vi.json.d.ts +7 -5
  6. package/dist/src/assets/Icons.d.ts +2 -0
  7. package/dist/src/assets/createIcon.d.ts +2 -2
  8. package/dist/src/components/ChatWidget.d.ts +3 -3
  9. package/dist/src/components/ChatWindow.d.ts +3 -3
  10. package/dist/src/components/FloatingButton.d.ts +3 -3
  11. package/dist/src/components/index.d.ts +4 -0
  12. package/dist/src/components/modals/AddChat.d.ts +3 -3
  13. package/dist/src/components/modals/AddGroup.d.ts +6 -0
  14. package/dist/src/components/modals/AddMember.d.ts +3 -3
  15. package/dist/src/components/modals/FileViewer.d.ts +3 -3
  16. package/dist/src/components/modals/ThemeModal.d.ts +2 -2
  17. package/dist/src/components/modals/UpdateGroup.d.ts +3 -3
  18. package/dist/src/components/modals/UserProfileModal.d.ts +3 -3
  19. package/dist/src/components/modals/index.d.ts +2 -1
  20. package/dist/src/components/shared/ChatAvatar.d.ts +1 -1
  21. package/dist/src/components/shared/MemberAvatarFallBack.d.ts +5 -0
  22. package/dist/src/components/shared/ToastContainer.d.ts +2 -3
  23. package/dist/src/components/shared/index.d.ts +3 -0
  24. package/dist/src/components/sidebar/AppSideBar.d.ts +2 -3
  25. package/dist/src/components/sidebar/ChatInfoPanel.d.ts +11 -0
  26. package/dist/src/components/sidebar/ChatList.d.ts +4 -4
  27. package/dist/src/components/sidebar/ChatSearchBar.d.ts +2 -2
  28. package/dist/src/components/sidebar/SideBarInfoChat.d.ts +4 -4
  29. package/dist/src/components/sidebar/index.d.ts +1 -0
  30. package/dist/src/components/view/ChatHeader.d.ts +3 -3
  31. package/dist/src/components/view/ChatInput.d.ts +1 -2
  32. package/dist/src/components/view/ContactList.d.ts +3 -3
  33. package/dist/src/components/view/GroupList.d.ts +3 -3
  34. package/dist/src/components/view/MessageFiles.d.ts +3 -3
  35. package/dist/src/components/view/MessageItem.d.ts +3 -3
  36. package/dist/src/components/view/MessageList.d.ts +2 -2
  37. package/dist/src/components/view/index.d.ts +3 -2
  38. package/dist/src/constants/common.d.ts +1 -0
  39. package/dist/src/constants/file.d.ts +2 -0
  40. package/dist/src/constants/index.d.ts +2 -0
  41. package/dist/src/contexts/FileViewerContext.d.ts +5 -5
  42. package/dist/src/contexts/ToastContext.d.ts +3 -3
  43. package/dist/src/contexts/index.d.ts +2 -1
  44. package/dist/src/hooks/index.d.ts +3 -0
  45. package/dist/src/hooks/useChat.d.ts +2 -2
  46. package/dist/src/hooks/useDragDropFiles.d.ts +5 -4
  47. package/dist/src/hooks/useFileViewer.d.ts +1 -1
  48. package/dist/src/hooks/useSetting.d.ts +1 -1
  49. package/dist/src/hooks/useToast.d.ts +1 -1
  50. package/dist/src/hooks/useTranslation.d.ts +2 -1
  51. package/dist/src/locales/index.d.ts +3 -0
  52. package/dist/src/services/chat.service.d.ts +3 -4
  53. package/dist/src/services/index.d.ts +2 -0
  54. package/dist/src/services/language.service.d.ts +2 -2
  55. package/dist/src/store/index.d.ts +2 -0
  56. package/dist/src/store/selectors/index.d.ts +1 -0
  57. package/dist/src/store/selectors/setting.d.ts +5 -5
  58. package/dist/src/store/slices/chatSlice.d.ts +3 -4
  59. package/dist/src/store/slices/index.d.ts +2 -0
  60. package/dist/src/store/slices/settingSlice.d.ts +2 -3
  61. package/dist/src/store/store.d.ts +2 -2
  62. package/dist/src/styles/index.d.ts +1 -0
  63. package/dist/src/types/chat.type.d.ts +2 -2
  64. package/dist/src/types/types.d.ts +2 -6
  65. package/dist/src/utils/chat.utils.d.ts +1 -2
  66. package/dist/src/utils/file.utils.d.ts +16 -0
  67. package/dist/src/utils/format.utils.d.ts +2 -0
  68. package/dist/src/utils/index.d.ts +4 -0
  69. 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
- | `logoUrl` | string | ❌ | URL of the logo image to display in the widget header |
194
- | `primaryColor` | string | ❌ | Primary color (hex format). Default: #6366f1 |
195
- | `chatKey` | string | | Authentication key to connect to backend |
196
- | `auth` | object | ✅ | User authentication information |
197
- | `auth.code` | string | ✅ | Unique user identifier |
198
- | `auth.name` | string | ✅ | User name |
199
- | `auth.avatar` | string | ✅ | URL of user avatar image |
200
- | `auth.phone` | string | | User phone number |
201
- | `auth.email` | string | | User email address |
202
- | `features` | object | | Feature configuration object with properties: `attachments`, `languages`, `communication`, `chatModes`, `customizations` |
203
- | `features.attachments` | array | ❌ | Allowed file types for upload: `'image'`, `'video'`, `'audio'`, `'file'`, `'multiple'`. If not provided, no file upload allowed |
204
- | `features.languages` | array | ❌ | Supported languages: `'english'`, `'vietnamese'`. When multiple languages are enabled, a language switcher appears in the widget. Default: `['english']` |
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 switching by adding language options to the `languages` array in features:
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
- languages: ['english', 'vietnamese'],
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
- languages: ['english', 'vietnamese'],
477
+ customizations: ['multi-language'],
478
478
  },
479
479
  // ... other options
480
480
  });
481
481
  ```
482
482
 
483
- Supported languages:
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 a workspace
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