@satek-team-intern/chatbot-widget 0.10.5 → 0.10.7

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 (38) hide show
  1. package/README.md +57 -61
  2. package/dist/chatbot-widget.es.js +3997 -3098
  3. package/dist/chatbot-widget.umd.js +20 -18
  4. package/dist/locales/en.json.d.ts +161 -35
  5. package/dist/locales/vi.json.d.ts +161 -35
  6. package/dist/src/assets/Icons.d.ts +3 -0
  7. package/dist/src/assets/createIcon.d.ts +3 -2
  8. package/dist/src/assets/index.d.ts +1 -0
  9. package/dist/src/components/modals/AddGroup.d.ts +1 -0
  10. package/dist/src/components/modals/AddMember.d.ts +1 -0
  11. package/dist/src/components/modals/UpdateGroup.d.ts +1 -3
  12. package/dist/src/components/modals/index.d.ts +0 -1
  13. package/dist/src/components/shared/AvatarFallBack.d.ts +5 -0
  14. package/dist/src/components/shared/index.d.ts +1 -1
  15. package/dist/src/components/sidebar/AppSideBar.d.ts +3 -4
  16. package/dist/src/components/sidebar/ChatInfoPanel.d.ts +1 -0
  17. package/dist/src/components/sidebar/ChatList.d.ts +1 -4
  18. package/dist/src/components/view/ChatListItem.d.ts +9 -0
  19. package/dist/src/components/view/GroupList.d.ts +0 -1
  20. package/dist/src/components/view/ImageFileItem.d.ts +10 -0
  21. package/dist/src/components/view/MessageFiles.d.ts +14 -1
  22. package/dist/src/components/view/MessageItem.d.ts +2 -1
  23. package/dist/src/components/view/ThemeSetting.d.ts +3 -0
  24. package/dist/src/components/view/index.d.ts +3 -0
  25. package/dist/src/constants/common.d.ts +12 -0
  26. package/dist/src/constants/file.d.ts +1 -0
  27. package/dist/src/hooks/useSetting.d.ts +5 -2
  28. package/dist/src/hooks/useTranslation.d.ts +2 -1
  29. package/dist/src/services/language.service.d.ts +1 -1
  30. package/dist/src/store/selectors/setting.d.ts +3 -3
  31. package/dist/src/store/slices/chatSlice.d.ts +4 -1
  32. package/dist/src/store/slices/settingSlice.d.ts +5 -1
  33. package/dist/src/types/chat.type.d.ts +3 -5
  34. package/dist/src/types/types.d.ts +11 -1
  35. package/dist/src/utils/chat.utils.d.ts +16 -2
  36. package/dist/src/utils/file.utils.d.ts +8 -4
  37. package/dist/src/utils/format.utils.d.ts +6 -1
  38. package/package.json +2 -1
package/README.md CHANGED
@@ -76,7 +76,12 @@ export default function App() {
76
76
  attachments: ['image', 'video', 'file'],
77
77
  communication: ['voice'],
78
78
  chatModes: ['single', 'group'],
79
- customizations: ['change-color', 'change-theme', 'multi-language'],
79
+ customizations: ['change-color', 'change-theme'],
80
+ }}
81
+ language="english"
82
+ initPosition={{
83
+ x: 20,
84
+ y: 20,
80
85
  }}
81
86
  />
82
87
  );
@@ -119,7 +124,12 @@ if (container) {
119
124
  attachments: ['image', 'video', 'audio', 'file', 'multiple'],
120
125
  communication: ['voice'],
121
126
  chatModes: ['single', 'group'],
122
- customizations: ['change-color', 'change-theme', 'multi-language'],
127
+ customizations: ['change-color', 'change-theme'],
128
+ }}
129
+ language="english"
130
+ initPosition={{
131
+ x: 20,
132
+ y: 20,
123
133
  }}
124
134
  />
125
135
  </React.StrictMode>,
@@ -173,7 +183,12 @@ Or use jsdelivr CDN:
173
183
  attachments: ['image', 'video', 'audio', 'file', 'multiple'],
174
184
  communication: ['voice'],
175
185
  chatModes: ['single', 'group'],
176
- customizations: ['change-color', 'change-theme', 'multi-language'],
186
+ customizations: ['change-color', 'change-theme'],
187
+ },
188
+ language: 'english',
189
+ initPosition: {
190
+ x: 20,
191
+ y: 20,
177
192
  },
178
193
  });
179
194
  </script>
@@ -187,24 +202,26 @@ Or use jsdelivr CDN:
187
202
 
188
203
  ### Props / Options
189
204
 
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: `[]` |
205
+ | Name | Type | Required | Description |
206
+ | ------------------------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
207
+ | `title` | string | ✅ | Title of the chat widget |
208
+ | `workspace` | string | ✅ | Workspace identifier for multi-workspace support. Max 50 chars, supports lowercase, numbers, symbols (\_), (-), (.) |
209
+ | `logoUrl` | string | ❌ | URL of the logo image to display in the widget header |
210
+ | `primaryColor` | string | ❌ | Primary color (hex format). Default: #6366f1 |
211
+ | `chatKey` | string | ✅ | Authentication key to connect to backend |
212
+ | `auth` | object | ✅ | User authentication information |
213
+ | `auth.code` | string | ✅ | Unique user identifier |
214
+ | `auth.name` | string | ✅ | User name |
215
+ | `auth.avatar` | string | ✅ | URL of user avatar image |
216
+ | `auth.phone` | string | ❌ | User phone number |
217
+ | `auth.email` | string | ✅ | User email address |
218
+ | `features` | object | ❌ | Feature configuration object with properties: `attachments`, `communication`, `chatModes`, `customizations` |
219
+ | `features.attachments` | array | ❌ | Allowed file types for upload: `'image'`, `'video'`, `'audio'`, `'file'`, `'multiple'`. If not provided, no file upload allowed |
220
+ | `features.communication` | array | ❌ | Communication features: `'voice'` for voice recording and audio messages. Default: `[]` |
221
+ | `features.chatModes` | array | ❌ | Supported chat modes: `'single'` for one-to-one chat, `'group'` for group chat. Default: `['single']` |
222
+ | `features.customizations` | array | ❌ | User customization options: `'change-color'` to allow color customization, `'change-theme'` to allow theme switching. Default: `[]` |
223
+ | `language` | string | ❌ | Initial language setting: `'english'` or `'vietnamese'`. If not provided, user can toggle language via UI button. Default: `'vietnamese'` |
224
+ | `initPosition` | object | ❌ | Initial position of the widget. Object with `x` (distance from right edge) and `y` (distance from bottom edge) in pixels |
208
225
 
209
226
  ### Configuration example
210
227
 
@@ -226,7 +243,12 @@ Or use jsdelivr CDN:
226
243
  attachments: ['image', 'video', 'file', 'multiple'],
227
244
  communication: ['voice'],
228
245
  chatModes: ['single', 'group'],
229
- customizations: ['change-color', 'change-theme', 'multi-language'],
246
+ customizations: ['change-color', 'change-theme'],
247
+ },
248
+ language: 'english',
249
+ initPosition: {
250
+ x: 20,
251
+ y: 20,
230
252
  },
231
253
  }
232
254
  ```
@@ -303,36 +325,6 @@ ChatbotWidget.init({
303
325
  });
304
326
  ```
305
327
 
306
- ### Configure features
307
-
308
- **React:**
309
-
310
- ```jsx
311
- <ChatWidget
312
- features={{
313
- attachments: ['image', 'video', 'file'],
314
- communication: ['voice'],
315
- chatModes: ['single', 'group'],
316
- customizations: ['multi-language'],
317
- }}
318
- // ... other props
319
- />
320
- ```
321
-
322
- **UMD:**
323
-
324
- ```javascript
325
- ChatbotWidget.init({
326
- features: {
327
- attachments: ['image', 'video', 'file'],
328
- communication: ['voice'],
329
- chatModes: ['single', 'group'],
330
- customizations: ['multi-language'],
331
- },
332
- // ... other options
333
- });
334
- ```
335
-
336
328
  ### Configure supported attachments
337
329
 
338
330
  Specify which file types users can upload:
@@ -454,17 +446,15 @@ ChatbotWidget.init({
454
446
  });
455
447
  ```
456
448
 
457
- ### Configure multi-language support
449
+ ### Configure language support
458
450
 
459
- Enable multi-language support by adding `'multi-language'` to the customizations array:
451
+ You can set the initial language for the widget using the `language` prop:
460
452
 
461
453
  **React:**
462
454
 
463
455
  ```jsx
464
456
  <ChatWidget
465
- features={{
466
- customizations: ['multi-language'],
467
- }}
457
+ language="vietnamese"
468
458
  // ... other props
469
459
  />
470
460
  ```
@@ -473,14 +463,20 @@ Enable multi-language support by adding `'multi-language'` to the customizations
473
463
 
474
464
  ```javascript
475
465
  ChatbotWidget.init({
476
- features: {
477
- customizations: ['multi-language'],
478
- },
466
+ language: 'vietnamese',
479
467
  // ... other options
480
468
  });
481
469
  ```
482
470
 
483
- When `'multi-language'` is enabled, users will see a language switcher in the widget interface to switch between available languages (English and Vietnamese).
471
+ **Language behavior:**
472
+
473
+ - **When `language` is provided**: The widget will use the specified language (either `'english'` or `'vietnamese'`) and the user can toggle to another language via the UI button
474
+ - **When `language` is not provided**: The widget defaults to Vietnamese, and users can toggle between English and Vietnamese using the language switcher button in the interface
475
+
476
+ Supported languages:
477
+
478
+ - `'english'` - English interface
479
+ - `'vietnamese'` - Vietnamese interface
484
480
 
485
481
  ---
486
482