@satek-team-intern/chatbot-widget 0.10.8 → 0.11.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.
Files changed (84) hide show
  1. package/README.md +82 -32
  2. package/dist/assets/background_chatlive_setting.webp +0 -0
  3. package/dist/chatbot-widget.es.js +5636 -3926
  4. package/dist/chatbot-widget.umd.js +1 -25
  5. package/dist/index.d.ts +1 -0
  6. package/package.json +6 -7
  7. package/dist/locales/en.json.d.ts +0 -263
  8. package/dist/locales/vi.json.d.ts +0 -264
  9. package/dist/src/assets/Icons.d.ts +0 -48
  10. package/dist/src/assets/createIcon.d.ts +0 -20
  11. package/dist/src/assets/index.d.ts +0 -2
  12. package/dist/src/components/ChatWidget.d.ts +0 -3
  13. package/dist/src/components/ChatWindow.d.ts +0 -32
  14. package/dist/src/components/FloatingButton.d.ts +0 -17
  15. package/dist/src/components/index.d.ts +0 -7
  16. package/dist/src/components/modals/AddChat.d.ts +0 -16
  17. package/dist/src/components/modals/AddGroup.d.ts +0 -7
  18. package/dist/src/components/modals/AddMember.d.ts +0 -7
  19. package/dist/src/components/modals/FileViewer.d.ts +0 -10
  20. package/dist/src/components/modals/ThemeModal.d.ts +0 -8
  21. package/dist/src/components/modals/UpdateGroup.d.ts +0 -10
  22. package/dist/src/components/modals/UserProfileModal.d.ts +0 -10
  23. package/dist/src/components/modals/index.d.ts +0 -5
  24. package/dist/src/components/shared/AvatarFallBack.d.ts +0 -5
  25. package/dist/src/components/shared/ChatAvatar.d.ts +0 -5
  26. package/dist/src/components/shared/MemberAvatarFallBack.d.ts +0 -5
  27. package/dist/src/components/shared/ToastContainer.d.ts +0 -2
  28. package/dist/src/components/shared/index.d.ts +0 -3
  29. package/dist/src/components/sidebar/AppSideBar.d.ts +0 -4
  30. package/dist/src/components/sidebar/ChatInfoPanel.d.ts +0 -11
  31. package/dist/src/components/sidebar/ChatList.d.ts +0 -8
  32. package/dist/src/components/sidebar/ChatSearchBar.d.ts +0 -10
  33. package/dist/src/components/sidebar/SideBarInfoChat.d.ts +0 -11
  34. package/dist/src/components/sidebar/index.d.ts +0 -4
  35. package/dist/src/components/view/ChatHeader.d.ts +0 -14
  36. package/dist/src/components/view/ChatInput.d.ts +0 -4
  37. package/dist/src/components/view/ChatListItem.d.ts +0 -9
  38. package/dist/src/components/view/ContactList.d.ts +0 -6
  39. package/dist/src/components/view/GroupList.d.ts +0 -8
  40. package/dist/src/components/view/ImageFileItem.d.ts +0 -10
  41. package/dist/src/components/view/MessageFiles.d.ts +0 -20
  42. package/dist/src/components/view/MessageItem.d.ts +0 -8
  43. package/dist/src/components/view/MessageList.d.ts +0 -2
  44. package/dist/src/components/view/ThemeSetting.d.ts +0 -3
  45. package/dist/src/components/view/index.d.ts +0 -10
  46. package/dist/src/config/configEnv.d.ts +0 -11
  47. package/dist/src/constants/common.d.ts +0 -13
  48. package/dist/src/constants/file.d.ts +0 -3
  49. package/dist/src/constants/index.d.ts +0 -2
  50. package/dist/src/contexts/FileViewerContext.d.ts +0 -14
  51. package/dist/src/contexts/ToastContext.d.ts +0 -4
  52. package/dist/src/contexts/index.d.ts +0 -3
  53. package/dist/src/contexts/toast-context.d.ts +0 -16
  54. package/dist/src/hooks/index.d.ts +0 -7
  55. package/dist/src/hooks/useChat.d.ts +0 -2
  56. package/dist/src/hooks/useDragDropFiles.d.ts +0 -12
  57. package/dist/src/hooks/useFileViewer.d.ts +0 -2
  58. package/dist/src/hooks/useSetting.d.ts +0 -5
  59. package/dist/src/hooks/useToast.d.ts +0 -1
  60. package/dist/src/hooks/useTranslation.d.ts +0 -5
  61. package/dist/src/hooks/useVoiceRecorder.d.ts +0 -14
  62. package/dist/src/index.d.ts +0 -5
  63. package/dist/src/locales/index.d.ts +0 -3
  64. package/dist/src/services/chat.service.d.ts +0 -43
  65. package/dist/src/services/index.d.ts +0 -2
  66. package/dist/src/services/language.service.d.ts +0 -18
  67. package/dist/src/store/index.d.ts +0 -3
  68. package/dist/src/store/selectors/index.d.ts +0 -1
  69. package/dist/src/store/selectors/setting.d.ts +0 -35
  70. package/dist/src/store/slices/chatSlice.d.ts +0 -25
  71. package/dist/src/store/slices/index.d.ts +0 -2
  72. package/dist/src/store/slices/settingSlice.d.ts +0 -13
  73. package/dist/src/store/store.d.ts +0 -16
  74. package/dist/src/styles/index.d.ts +0 -1
  75. package/dist/src/types/chat.type.d.ts +0 -297
  76. package/dist/src/types/index.d.ts +0 -2
  77. package/dist/src/types/types.d.ts +0 -61
  78. package/dist/src/utils/chat.utils.d.ts +0 -35
  79. package/dist/src/utils/file.utils.d.ts +0 -20
  80. package/dist/src/utils/format.utils.d.ts +0 -7
  81. package/dist/src/utils/formatDateLabel.d.ts +0 -1
  82. package/dist/src/utils/index.d.ts +0 -5
  83. package/dist/src/utils/validate.utils.d.ts +0 -1
  84. package/dist/src/utils/voice.utils.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
- x: 20,
84
- y: 20,
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
- x: 20,
132
- y: 20,
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
- x: 20,
191
- y: 20,
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
- | `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
+ | 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
- x: 20,
251
- y: 20,
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
- ### Allow color change
430
+ ### Configure widget customizations
424
431
 
425
- Enable users to change the widget's color and theme using customization features:
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: ['change-color', 'change-theme'],
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: ['change-color', 'change-theme'],
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