quickblox-react-ui-kit 0.3.0 → 0.3.1-beta.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 (115) hide show
  1. package/dist/CommonTypes/CommonTypes.d.ts +142 -0
  2. package/dist/CommonTypes/FunctionResult.d.ts +0 -54
  3. package/dist/Data/DefaultConfigurations.d.ts +2 -2
  4. package/dist/Data/Stubs.d.ts +6 -5
  5. package/dist/Data/dto/dialog/LocalDialogDTO.d.ts +1 -1
  6. package/dist/Data/dto/dialog/RemoteDialogDTO.d.ts +2 -2
  7. package/dist/Data/dto/user/LocalUserDTO.d.ts +1 -1
  8. package/dist/Data/dto/user/RemoteUserDTO.d.ts +1 -1
  9. package/dist/Data/source/remote/Mapper/MessageDTOMapper.d.ts +1 -0
  10. package/dist/Data/source/remote/RemoteDataSource.d.ts +1 -1
  11. package/dist/Domain/entity/LastMessageEntity.d.ts +1 -1
  12. package/dist/Domain/entity/UserEntity.d.ts +1 -1
  13. package/dist/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.d.ts +3 -1
  14. package/dist/Presentation/ui-components/TextField/TextField.d.ts +2 -2
  15. package/dist/QBconfig.d.ts +2 -76
  16. package/dist/index-ui.js +767 -787
  17. package/dist/index-ui.js.map +1 -1
  18. package/dist/qb-api-calls/index.d.ts +14 -12
  19. package/dist/utils/formatFileSize.d.ts +1 -0
  20. package/dist/utils/parse.d.ts +1 -0
  21. package/global.d.ts +158 -2835
  22. package/package.json +3 -1
  23. package/src/App.tsx +3 -2
  24. package/src/CommonTypes/CommonTypes.ts +229 -0
  25. package/src/CommonTypes/FunctionResult.ts +0 -59
  26. package/src/Data/Creator.ts +1 -0
  27. package/src/Data/DefaultConfigurations.ts +6 -2
  28. package/src/Data/Stubs.ts +47 -47
  29. package/src/Data/dto/dialog/LocalDialogDTO.ts +2 -2
  30. package/src/Data/dto/dialog/RemoteDialogDTO.ts +4 -4
  31. package/src/Data/dto/user/LocalUserDTO.ts +2 -2
  32. package/src/Data/dto/user/RemoteUserDTO.ts +2 -2
  33. package/src/Data/mapper/DialogLocalDTOMapper.ts +4 -10
  34. package/src/Data/mapper/DialogRemoteDTOMapper.ts +11 -22
  35. package/src/Data/mapper/UserLocalDTOMapper.ts +2 -2
  36. package/src/Data/mapper/UserRemoteDTOMapper.ts +2 -2
  37. package/src/Data/repository/ConnectionRepository.ts +1 -0
  38. package/src/Data/repository/UsersRepository.ts +1 -1
  39. package/src/Data/source/local/ChatLocalStorageDataSource.ts +14 -14
  40. package/src/Data/source/remote/Mapper/DialogDTOMapper.ts +70 -52
  41. package/src/Data/source/remote/Mapper/FileDTOMapper.ts +4 -0
  42. package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +1 -0
  43. package/src/Data/source/remote/Mapper/UserDTOMapper.ts +1 -0
  44. package/src/Data/source/remote/RemoteDataSource.ts +76 -12
  45. package/src/Domain/entity/LastMessageEntity.ts +1 -1
  46. package/src/Domain/entity/UserEntity.ts +1 -1
  47. package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +2 -2
  48. package/src/Presentation/Views/Dialog/useDialogViewModel.ts +44 -150
  49. package/src/Presentation/Views/DialogInfo/DialogInfo.tsx +2 -1
  50. package/src/Presentation/Views/DialogList/DialogList.tsx +65 -2
  51. package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +3 -0
  52. package/src/Presentation/Views/EditDialog/EditDialog.tsx +4 -3
  53. package/src/Presentation/Views/InviteMembers/InviteMembers.tsx +9 -1
  54. package/src/Presentation/Views/InviteMembers/useInviteMembersViewModel.ts +11 -1
  55. package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +1 -0
  56. package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +9 -41
  57. package/src/Presentation/layouts/TestStage/LoginView/Login.tsx +7 -11
  58. package/src/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.tsx +30 -2
  59. package/src/Presentation/ui-components/SettingsItem/SettingsItem.stories.tsx +1 -0
  60. package/src/Presentation/ui-components/TextField/TextField.tsx +58 -48
  61. package/src/QBconfig.ts +13 -11
  62. package/src/qb-api-calls/index.ts +44 -14
  63. package/src/utils/formatFileSize.ts +8 -0
  64. package/src/utils/parse.ts +2 -0
  65. package/storybook-static/703.2cbec951.iframe.bundle.js +33 -0
  66. package/storybook-static/703.2cbec951.iframe.bundle.js.map +1 -0
  67. package/storybook-static/{758.53b4954a.iframe.bundle.js → 938.56e9d83c.iframe.bundle.js} +1 -14
  68. package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.1b74ae55.iframe.bundle.js +14 -0
  69. package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.1b74ae55.iframe.bundle.js.map +1 -0
  70. package/storybook-static/Presentation-ui-components-Button-Button-stories.84103f20.iframe.bundle.js +14 -0
  71. package/storybook-static/Presentation-ui-components-Button-Button-stories.84103f20.iframe.bundle.js.map +1 -0
  72. package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bf9005d3.iframe.bundle.js +14 -0
  73. package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bf9005d3.iframe.bundle.js.map +1 -0
  74. package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.f81a8e38.iframe.bundle.js +14 -0
  75. package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.f81a8e38.iframe.bundle.js.map +1 -0
  76. package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.141a3ae7.iframe.bundle.js +14 -0
  77. package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.141a3ae7.iframe.bundle.js.map +1 -0
  78. package/storybook-static/Presentation-ui-components-Header-Header-stories.9f45c30e.iframe.bundle.js +14 -0
  79. package/storybook-static/Presentation-ui-components-Header-Header-stories.9f45c30e.iframe.bundle.js.map +1 -0
  80. package/storybook-static/Presentation-ui-components-Loader-Loader-stories.af01e15d.iframe.bundle.js +14 -0
  81. package/storybook-static/Presentation-ui-components-Loader-Loader-stories.af01e15d.iframe.bundle.js.map +1 -0
  82. package/storybook-static/Presentation-ui-components-Message-Message-stories.264d251d.iframe.bundle.js +14 -0
  83. package/storybook-static/Presentation-ui-components-Message-Message-stories.264d251d.iframe.bundle.js.map +1 -0
  84. package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.bf8a24d1.iframe.bundle.js +1 -0
  85. package/storybook-static/{Presentation-ui-components-Placeholder-Placeholder-stories.871f508c.iframe.bundle.js → Presentation-ui-components-Placeholder-Placeholder-stories.97287936.iframe.bundle.js} +14 -1
  86. package/storybook-static/Presentation-ui-components-Placeholder-Placeholder-stories.97287936.iframe.bundle.js.map +1 -0
  87. package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.a9f5cd67.iframe.bundle.js +14 -0
  88. package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.a9f5cd67.iframe.bundle.js.map +1 -0
  89. package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.429a72d5.iframe.bundle.js +14 -0
  90. package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.429a72d5.iframe.bundle.js.map +1 -0
  91. package/storybook-static/Presentation-ui-components-TextField-TextField-stories.fd8caf6c.iframe.bundle.js +14 -0
  92. package/storybook-static/Presentation-ui-components-TextField-TextField-stories.fd8caf6c.iframe.bundle.js.map +1 -0
  93. package/storybook-static/{Presentation-ui-components-Toast-Toast-stories.55e63162.iframe.bundle.js → Presentation-ui-components-Toast-Toast-stories.b903385b.iframe.bundle.js} +14 -1
  94. package/storybook-static/Presentation-ui-components-Toast-Toast-stories.b903385b.iframe.bundle.js.map +1 -0
  95. package/storybook-static/{Presentation-ui-components-UserListItem-UserListItem-stories.04d3eefe.iframe.bundle.js → Presentation-ui-components-UserListItem-UserListItem-stories.8781472b.iframe.bundle.js} +14 -1
  96. package/storybook-static/Presentation-ui-components-UserListItem-UserListItem-stories.8781472b.iframe.bundle.js.map +1 -0
  97. package/storybook-static/iframe.html +2 -2
  98. package/storybook-static/{main.597d432b.iframe.bundle.js → main.2f6d7582.iframe.bundle.js} +1 -1
  99. package/storybook-static/project.json +1 -1
  100. package/storybook-static/runtime~main.af13ca55.iframe.bundle.js +1 -0
  101. package/webpack.config.js +2 -1
  102. package/storybook-static/758.53b4954a.iframe.bundle.js.map +0 -1
  103. package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.cf806856.iframe.bundle.js +0 -1
  104. package/storybook-static/Presentation-ui-components-Button-Button-stories.4fac7996.iframe.bundle.js +0 -1
  105. package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.6665bbfb.iframe.bundle.js +0 -1
  106. package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.cf340397.iframe.bundle.js +0 -1
  107. package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.b32a1e17.iframe.bundle.js +0 -1
  108. package/storybook-static/Presentation-ui-components-Header-Header-stories.073c4507.iframe.bundle.js +0 -1
  109. package/storybook-static/Presentation-ui-components-Loader-Loader-stories.9bf3fb63.iframe.bundle.js +0 -1
  110. package/storybook-static/Presentation-ui-components-Message-Message-stories.343dfae0.iframe.bundle.js +0 -1
  111. package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.c2ead6a5.iframe.bundle.js +0 -1
  112. package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.527e000e.iframe.bundle.js +0 -1
  113. package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.2ff75703.iframe.bundle.js +0 -1
  114. package/storybook-static/Presentation-ui-components-TextField-TextField-stories.4a2eef3e.iframe.bundle.js +0 -1
  115. package/storybook-static/runtime~main.7ee2126e.iframe.bundle.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickblox-react-ui-kit",
3
- "version": "0.3.0",
3
+ "version": "0.3.1-beta.2",
4
4
  "main": "dist/index-ui.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -12,6 +12,7 @@
12
12
  "qb-ai-core": "^0.1.3",
13
13
  "qb-ai-rephrase": "^0.1.2",
14
14
  "qb-ai-translate": "^0.1.2",
15
+ "quickblox": "^2.16.3",
15
16
  "react": "^18.2.0",
16
17
  "react-dom": "^18.2.0",
17
18
  "react-router-dom": "^6.11.1",
@@ -86,6 +87,7 @@
86
87
  "lint": "eslint ./src",
87
88
  "eject": "react-scripts eject",
88
89
  "storybook": "storybook dev -p 6006",
90
+ "build-storybook": "storybook build",
89
91
  "build:storybook": "storybook build"
90
92
  },
91
93
  "lint-staged": {
package/src/App.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import './App.scss';
3
3
  import { Route, Routes, useNavigate } from 'react-router-dom';
4
+ import QB from 'quickblox/quickblox';
4
5
  import useQBConnection from './Presentation/providers/QuickBloxUIKitProvider/useQBConnection';
5
6
  import { LocalDataSource } from './Data/source/local/LocalDataSource';
6
7
  import Login from './Presentation/layouts/TestStage/LoginView/Login';
@@ -27,8 +28,8 @@ function App() {
27
28
  const { connectionRepository } = useQBConnection();
28
29
 
29
30
  const initLoginData: LoginData = {
30
- login: '',
31
- password: '',
31
+ login: 'artimed',
32
+ password: 'quickblox',
32
33
  };
33
34
 
34
35
  const [currentUser, setCurrentUser] = React.useState(initLoginData);
@@ -0,0 +1,229 @@
1
+ import {
2
+ QBSystemMessage,
3
+ QBUser,
4
+ ChatMessageAttachment,
5
+ QBChatDialog,
6
+ QBChatNewMessage,
7
+ QBConfig,
8
+ QBCustomField,
9
+ } from 'quickblox';
10
+ import { Tone } from '../Presentation/Views/Dialog/AIWidgets/Tone';
11
+
12
+ export type ProxyConfig = {
13
+ api: string;
14
+ servername: string;
15
+ port: string;
16
+ };
17
+ export interface WidgetConfig {
18
+ organizationName: string;
19
+ openAIModel: string;
20
+ apiKey: string;
21
+ maxTokens: number;
22
+ useDefault: boolean;
23
+ proxyConfig: ProxyConfig;
24
+ }
25
+
26
+ export interface AITranslateWidgetConfig extends WidgetConfig {
27
+ defaultLanguage: string;
28
+ languages: string[];
29
+ }
30
+
31
+ export interface AIRephraseWidgetConfig extends WidgetConfig {
32
+ defaultTone: string;
33
+ Tones: Tone[];
34
+ }
35
+
36
+ export interface QBUIKitConfig extends QBConfig {
37
+ credentials: {
38
+ appId: number;
39
+ accountKey: string;
40
+ authKey: string;
41
+ authSecret: string;
42
+ sessionToken: string;
43
+ };
44
+ configAIApi: {
45
+ AIAnswerAssistWidgetConfig: WidgetConfig;
46
+ AITranslateWidgetConfig: AITranslateWidgetConfig;
47
+ AIRephraseWidgetConfig: AIRephraseWidgetConfig;
48
+ };
49
+ appConfig: {
50
+ maxFileSize: number;
51
+ sessionTimeOut: number;
52
+ chatProtocol: {
53
+ active: number;
54
+ };
55
+ debug: boolean;
56
+ enableForwarding: boolean;
57
+ enableReplying: boolean;
58
+ regexUserName?: string;
59
+ endpoints: {
60
+ api: string;
61
+ chat: string;
62
+ };
63
+ // on: {
64
+ // sessionExpired: (handleResponse: any, retry: any) => Promise<void>;
65
+ // };
66
+ streamManagement: {
67
+ enable: boolean;
68
+ };
69
+ };
70
+ }
71
+
72
+ interface QBSystemMessageExtension {
73
+ [key: string]: string | undefined;
74
+ notification_type: string;
75
+ action?: 'read' | 'delete';
76
+ }
77
+
78
+ export interface QBUIKitSystemMessage extends QBSystemMessage {
79
+ // id: string;
80
+ // userId: QBUser['id'];
81
+ // body: null | string;
82
+ extension?: QBSystemMessageExtension | Dictionary<any> | undefined;
83
+ }
84
+
85
+ // type Primitive = string | number | boolean | undefined | null | Date | File;
86
+
87
+ // type SetTails<T, R extends Primitive> = T extends Array<unknown>
88
+ // ? Array<T[number] extends Primitive ? R : SetTails<T[number], R>>
89
+ // : {
90
+ // [K in keyof T]: T[K] extends Primitive ? R : SetTails<T[K], R>;
91
+ // };
92
+
93
+ // interface QBConfig {
94
+ // credentials: {
95
+ // appId: number;
96
+ // accountKey: string;
97
+ // authKey: string;
98
+ // authSecret: string;
99
+ // sessionToken: string; // ??? ui-kit
100
+ // };
101
+ // configAIApi: {
102
+ // // ui-kit
103
+ // AIAnswerAssistWidgetConfig: WidgetConfig;
104
+ // AITranslateWidgetConfig: AITranslateWidgetConfig;
105
+ // AIRephraseWidgetConfig: AIRephraseWidgetConfig;
106
+ // };
107
+ // appConfig: {
108
+ // maxFileSize: number; // ui-kit
109
+ // sessionTimeOut: number; // ?? webRTc -> ui-kit
110
+ // chatProtocol: {
111
+ // active: number;
112
+ // };
113
+ // debug: boolean;
114
+ // enableForwarding: boolean; // ui-kit
115
+ // enableReplying: boolean; // ui-kit
116
+ // regexUserName?: string; // ui-kit
117
+ // endpoints: {
118
+ // api: string;
119
+ // chat: string;
120
+ // };
121
+ // // on: {
122
+ // // sessionExpired: (handleResponse: any, retry: any) => Promise<void>;
123
+ // // };
124
+ // streamManagement: {
125
+ // enable: boolean;
126
+ // };
127
+ // };
128
+ // }
129
+
130
+ /*
131
+ * QuickBlox Types - start
132
+
133
+ */
134
+
135
+ // type Dictionary<T> = Record<string, T>;
136
+ //
137
+ // type RequiredProps<T, K extends keyof T> = T & Required<Pick<T, K>>;
138
+ //
139
+ // declare enum QBChatProtocol {
140
+ // BOSH = 1,
141
+ // WebSockets = 2,
142
+ // }
143
+ //
144
+ // interface ICEServer {
145
+ // urls: string;
146
+ // username: string;
147
+ // credential: string;
148
+ // }
149
+
150
+ export enum QBChatDialogType {
151
+ PUBLIC_GROUP = 1,
152
+ GROUP = 2,
153
+ PRIVATE = 3,
154
+ }
155
+
156
+ export interface QBUIKitChatDialog extends QBChatDialog {
157
+ /** ID of the dialog. Generated automatically by the server after dialog creation. */
158
+ _id: string;
159
+ /** ID of dialog's owner. */
160
+ user_id: QBUser['id'];
161
+ /** Date & time when a record was created, filled automatically. */
162
+ created_at: string;
163
+ /** Date & time when a record was created, filled automatically. */
164
+ updated_at: string;
165
+ /**
166
+ * Type of dialog. Possible values are:
167
+ * - type=1 (`PUBLIC_GROUP`)
168
+ * - type=2 (`GROUP`)
169
+ * - type=3 (`PRIVATE`)
170
+ */
171
+ type: QBChatDialogType;
172
+ /**
173
+ * Name of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
174
+ * The maximum length for the dialog name is 200 symbols.
175
+ */
176
+ name: string;
177
+ /**
178
+ * Photo of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
179
+ * Can contain a link to a file in Content module, Custom Objects module or just a web link.
180
+ */
181
+ photo: null | string;
182
+ /**
183
+ * JID of XMPP room for group chat to connect. Nil if type=3 (PRIVATE).
184
+ * Generated automatically by the server after dialog creation.
185
+ */
186
+ xmpp_room_jid: string | null;
187
+ /** Array of users' IDs - dialog occupants. Does not make sense if type=1 (PUBLIC_GROUP). */
188
+ occupants_ids: number[];
189
+ /** Last sent message in this dialog. */
190
+ last_message: string | null;
191
+ /** Timestamp of last sent message in this dialog. */
192
+ last_message_date_sent: number | null;
193
+ /** ID of the user who sent last message in this dialog. */
194
+ last_message_user_id: QBUser['id'] | null;
195
+ /** ID of last message in this dialog. */
196
+ last_message_id: string | null;
197
+ /** Number of unread messages in this dialog for a current user. */
198
+ unread_messages_count: number | null;
199
+ /**
200
+ * - Information about class and fields in Custom Objects.
201
+ * - Any dialog can be extended using Custom Objects to store additional parameters.
202
+ */
203
+ data?: {
204
+ /** Class name in Custom Objects. */
205
+ class_name: string;
206
+ /** Field name of class in Custom Objects. Can be many: 1..N. */
207
+ [field_name_N: string]: QBCustomField;
208
+ };
209
+ new_occupants_ids?: number[]; // TODO: EXTENDS TYPE AND SWITCH TO THIS NEW TYPE
210
+ joined?: boolean; // TODO: EXTENDS TYPE AND SWITCH TO THIS NEW TYPE
211
+ }
212
+
213
+ export interface QBUIKitChatNewMessage extends QBChatNewMessage {
214
+ type: 'chat' | 'groupchat';
215
+ body: string;
216
+ notification_type?: string; // TODO: NED ADD TO TYPE
217
+ dialog_id: QBChatDialog['_id']; // TODO: NED ADD TO TYPE
218
+ extension: {
219
+ attachments?: ChatMessageAttachment[];
220
+ save_to_history: 0 | 1;
221
+ dialog_id: QBChatDialog['_id'];
222
+ notification_type?: string; // TODO: NED ADD TO TYPE
223
+ sender_id?: QBUser['id']; // TODO: NED ADD TO TYPE
224
+ qb_message_action?: 'forward' | 'reply'; // TODO: NED ADD TO TYPE
225
+ origin_sender_name?: string; // TODO: NED ADD TO TYPE
226
+ qb_original_messages?: string; // TODO: NED ADD TO TYPE
227
+ };
228
+ markable: 0 | 1;
229
+ }
@@ -5,62 +5,3 @@ export type FunctionResult<T> = {
5
5
  error: any;
6
6
  };
7
7
 
8
- export type ProxyConfig = {
9
- api: string;
10
- servername: string;
11
- port: string;
12
- };
13
- export interface WidgetConfig {
14
- organizationName: string;
15
- openAIModel: string;
16
- apiKey: string;
17
- maxTokens: number;
18
- useDefault: boolean;
19
- proxyConfig: ProxyConfig;
20
- }
21
-
22
- export interface AITranslateWidgetConfig extends WidgetConfig {
23
- defaultLanguage: string;
24
- languages: string[];
25
- }
26
-
27
- export interface AIRephraseWidgetConfig extends WidgetConfig {
28
- defaultTone: string;
29
- Tones: Tone[];
30
- }
31
-
32
- export interface QBConfig {
33
- credentials: {
34
- appId: number;
35
- accountKey: string;
36
- authKey: string;
37
- authSecret: string;
38
- sessionToken: string;
39
- };
40
- configAIApi: {
41
- AIAnswerAssistWidgetConfig: WidgetConfig;
42
- AITranslateWidgetConfig: AITranslateWidgetConfig;
43
- AIRephraseWidgetConfig: AIRephraseWidgetConfig;
44
- };
45
- appConfig: {
46
- maxFileSize: number;
47
- sessionTimeOut: number;
48
- chatProtocol: {
49
- active: number;
50
- };
51
- debug: boolean;
52
- enableForwarding: boolean;
53
- enableReplying: boolean;
54
- regexUserName?: string;
55
- endpoints: {
56
- api: string;
57
- chat: string;
58
- };
59
- // on: {
60
- // sessionExpired: (handleResponse: any, retry: any) => Promise<void>;
61
- // };
62
- streamManagement: {
63
- enable: boolean;
64
- };
65
- };
66
- }
@@ -1,3 +1,4 @@
1
+ import QB from 'quickblox/quickblox';
1
2
  import ChatMessageAttachmentEntity from '../Domain/entity/ChatMessageAttachmentEntity';
2
3
  import { DialogType } from '../Domain/entity/DialogTypes';
3
4
  import { MessageEntity } from '../Domain/entity/MessageEntity';
@@ -1,4 +1,8 @@
1
- import { ProxyConfig, QBConfig } from '../CommonTypes/FunctionResult';
1
+ import {
2
+ AITranslateWidgetConfig,
3
+ ProxyConfig,
4
+ QBUIKitConfig,
5
+ } from '../CommonTypes/CommonTypes';
2
6
 
3
7
  const supportedLanguagesForIATranslate: string[] = [
4
8
  'English',
@@ -130,7 +134,7 @@ export class DefaultConfigurations {
130
134
  }
131
135
 
132
136
  //
133
- static getDefaultQBConfig(): QBConfig {
137
+ static getDefaultQBConfig(): QBUIKitConfig {
134
138
  return {
135
139
  credentials: {
136
140
  appId: -1,
package/src/Data/Stubs.ts CHANGED
@@ -20,6 +20,7 @@ import { MessageLocalDTOMapper } from './mapper/MessageLocalDTOMapper';
20
20
  import { LocalMessageDTO } from './dto/message/LocalMessageDTO';
21
21
  import { LocalDataSource } from './source/local/LocalDataSource';
22
22
  import { FileEntity } from '../Domain/entity/FileEntity';
23
+ import { QBUIKitChatDialog } from '../CommonTypes/CommonTypes';
23
24
 
24
25
  export class Stubs {
25
26
  static createMessageEntityWithParams(
@@ -104,10 +105,9 @@ export class Stubs {
104
105
  for (const item of dialogsEntities) {
105
106
  const dialogDTO: LocalDialogDTO =
106
107
  // eslint-disable-next-line no-await-in-loop
107
- await dialogsDTOtoEntityMapper.fromEntity<
108
- DialogEntity,
109
- RemoteDialogDTO
110
- >(item);
108
+ await dialogsDTOtoEntityMapper.fromEntity<DialogEntity, LocalDialogDTO>(
109
+ item,
110
+ );
111
111
 
112
112
  // eslint-disable-next-line @typescript-eslint/no-unused-vars,promise/catch-or-return,promise/always-return
113
113
  ds.saveDialog(dialogDTO)
@@ -379,7 +379,7 @@ export class Stubs {
379
379
  '',
380
380
  '_',
381
381
  {
382
- dateSent: '',
382
+ dateSent: 0,
383
383
  text: '',
384
384
  userId: 0,
385
385
  },
@@ -395,7 +395,7 @@ export class Stubs {
395
395
  { todo: '' },
396
396
  '',
397
397
  {
398
- dateSent: '',
398
+ dateSent: 0,
399
399
  text: '',
400
400
  userId: 0,
401
401
  },
@@ -412,7 +412,7 @@ export class Stubs {
412
412
  { todo: '' },
413
413
  '',
414
414
  {
415
- dateSent: '',
415
+ dateSent: 0,
416
416
  text: '',
417
417
  userId: 0,
418
418
  },
@@ -430,7 +430,7 @@ export class Stubs {
430
430
  customData: { todo: '' },
431
431
  id: '',
432
432
  name: '_',
433
- lastMessage: { dateSent: '', text: '', userId: 0 },
433
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
434
434
  ownerId: '',
435
435
  type: -1,
436
436
  unreadMessageCount: 0,
@@ -461,7 +461,7 @@ export class Stubs {
461
461
  '111',
462
462
  '_111',
463
463
  {
464
- dateSent: '01.02.2023',
464
+ dateSent: 0,
465
465
  text: 'text test',
466
466
  userId: 777,
467
467
  },
@@ -477,7 +477,7 @@ export class Stubs {
477
477
  { todo: '' },
478
478
  '111',
479
479
  {
480
- dateSent: '01.02.2023',
480
+ dateSent: 0,
481
481
  text: 'text test',
482
482
  userId: 777,
483
483
  },
@@ -494,7 +494,7 @@ export class Stubs {
494
494
  { todo: '' },
495
495
  '111',
496
496
  {
497
- dateSent: '01.02.2023',
497
+ dateSent: 0,
498
498
  text: 'text test',
499
499
  userId: 777,
500
500
  },
@@ -513,7 +513,7 @@ export class Stubs {
513
513
  id: '111',
514
514
  name: '_111',
515
515
  lastMessage: {
516
- dateSent: '01.02.2023',
516
+ dateSent: 0,
517
517
  text: 'text test',
518
518
  userId: 777,
519
519
  },
@@ -534,9 +534,9 @@ export class Stubs {
534
534
  switch (dialogType) {
535
535
  case DialogType.private:
536
536
  dto.id = '111';
537
- dto.lastMessageDateSent = '01.02.2023';
537
+ dto.lastMessageDateSent = 0;
538
538
  dto.lastMessageText = 'text test';
539
- dto.lastMessageUserId = '777';
539
+ dto.lastMessageUserId = 777;
540
540
  dto.ownerId = '999';
541
541
  dto.type = dialogType;
542
542
  dto.unreadMessageCount = 555;
@@ -545,9 +545,9 @@ export class Stubs {
545
545
  break;
546
546
  case DialogType.public:
547
547
  dto.id = '111';
548
- dto.lastMessageDateSent = '01.02.2023';
548
+ dto.lastMessageDateSent = 0;
549
549
  dto.lastMessageText = 'text test';
550
- dto.lastMessageUserId = '777';
550
+ dto.lastMessageUserId = 777;
551
551
  dto.ownerId = '999';
552
552
  dto.type = dialogType;
553
553
  dto.unreadMessageCount = 555;
@@ -557,9 +557,9 @@ export class Stubs {
557
557
  break;
558
558
  case DialogType.group:
559
559
  dto.id = '111';
560
- dto.lastMessageDateSent = '01.02.2023';
560
+ dto.lastMessageDateSent = 0;
561
561
  dto.lastMessageText = 'text test';
562
- dto.lastMessageUserId = '777';
562
+ dto.lastMessageUserId = 777;
563
563
  dto.ownerId = '999';
564
564
  dto.type = dialogType;
565
565
  dto.unreadMessageCount = 555;
@@ -602,8 +602,8 @@ export class Stubs {
602
602
  participantId: '',
603
603
  participantsIds: [],
604
604
  lastMessageText: '',
605
- lastMessageDateSent: '',
606
- lastMessageUserId: '',
605
+ lastMessageDateSent: 0,
606
+ lastMessageUserId: 0,
607
607
  lastMessageId: '',
608
608
  unreadMessageCount: 0,
609
609
  updatedAt: '',
@@ -617,8 +617,8 @@ export class Stubs {
617
617
  participantId: '',
618
618
  participantsIds: [],
619
619
  lastMessageText: '',
620
- lastMessageDateSent: '',
621
- lastMessageUserId: '',
620
+ lastMessageDateSent: 0,
621
+ lastMessageUserId: 0,
622
622
  lastMessageId: '',
623
623
  unreadMessageCount: 0,
624
624
  updatedAt: '',
@@ -632,8 +632,8 @@ export class Stubs {
632
632
  participantId: '',
633
633
  participantsIds: [],
634
634
  lastMessageText: '',
635
- lastMessageDateSent: '',
636
- lastMessageUserId: '',
635
+ lastMessageDateSent: 0,
636
+ lastMessageUserId: 0,
637
637
  lastMessageId: '',
638
638
  unreadMessageCount: 0,
639
639
  updatedAt: '',
@@ -647,8 +647,8 @@ export class Stubs {
647
647
  participantId: '',
648
648
  participantsIds: [],
649
649
  lastMessageText: '',
650
- lastMessageDateSent: '',
651
- lastMessageUserId: '',
650
+ lastMessageDateSent: 0,
651
+ lastMessageUserId: 0,
652
652
  lastMessageId: '',
653
653
  unreadMessageCount: 0,
654
654
  updatedAt: '',
@@ -662,8 +662,8 @@ export class Stubs {
662
662
  participantId: '',
663
663
  participantsIds: [],
664
664
  lastMessageText: '',
665
- lastMessageDateSent: '',
666
- lastMessageUserId: '',
665
+ lastMessageDateSent: 0,
666
+ lastMessageUserId: 0,
667
667
  lastMessageId: '',
668
668
  unreadMessageCount: 0,
669
669
  updatedAt: '',
@@ -677,8 +677,8 @@ export class Stubs {
677
677
  participantId: '',
678
678
  participantsIds: [],
679
679
  lastMessageText: '',
680
- lastMessageDateSent: '',
681
- lastMessageUserId: '',
680
+ lastMessageDateSent: 0,
681
+ lastMessageUserId: 0,
682
682
  lastMessageId: '',
683
683
  unreadMessageCount: 0,
684
684
  updatedAt: '',
@@ -692,8 +692,8 @@ export class Stubs {
692
692
  participantId: '',
693
693
  participantsIds: [],
694
694
  lastMessageText: '',
695
- lastMessageDateSent: '',
696
- lastMessageUserId: '',
695
+ lastMessageDateSent: 0,
696
+ lastMessageUserId: 0,
697
697
  lastMessageId: '',
698
698
  unreadMessageCount: 0,
699
699
  updatedAt: '',
@@ -704,11 +704,11 @@ export class Stubs {
704
704
  }
705
705
 
706
706
  static createPublicDialogQBWithEmptyValues() {
707
- const qbDialog: QBChatDialog = {
707
+ const qbDialog: QBUIKitChatDialog = {
708
708
  _id: '111',
709
709
  created_at: '01.03.2023',
710
710
  last_message: 'test message',
711
- last_message_date_sent: '02.03.2023',
711
+ last_message_date_sent: 0,
712
712
  last_message_id: '100',
713
713
  last_message_user_id: 112,
714
714
  name: '',
@@ -726,11 +726,11 @@ export class Stubs {
726
726
  }
727
727
 
728
728
  static createPrivateDialogQBWithEmptyValues() {
729
- const qbDialog: QBChatDialog = {
729
+ const qbDialog: QBUIKitChatDialog = {
730
730
  _id: '111',
731
731
  created_at: '01.03.2023',
732
732
  last_message: 'test message',
733
- last_message_date_sent: '02.03.2023',
733
+ last_message_date_sent: 0,
734
734
  last_message_id: '100',
735
735
  last_message_user_id: 112,
736
736
  name: '',
@@ -748,11 +748,11 @@ export class Stubs {
748
748
  }
749
749
 
750
750
  static createGroupDialogQBWithEmptyValues() {
751
- const qbDialog: QBChatDialog = {
751
+ const qbDialog: QBUIKitChatDialog = {
752
752
  _id: '111',
753
753
  created_at: '01.03.2023',
754
754
  last_message: 'test message',
755
- last_message_date_sent: '02.03.2023',
755
+ last_message_date_sent: 0,
756
756
  last_message_id: '100',
757
757
  last_message_user_id: 112,
758
758
  name: '',
@@ -773,7 +773,7 @@ export class Stubs {
773
773
  dialogType: DialogType,
774
774
  id: string,
775
775
  name: string,
776
- dateSentLastMessage: string,
776
+ dateSentLastMessage: number,
777
777
  textLastMessage: string,
778
778
  userIdLastMessage: number,
779
779
  ownerId: string,
@@ -844,7 +844,7 @@ export class Stubs {
844
844
  id: '012345',
845
845
  name: 'error dialog',
846
846
  lastMessage: {
847
- dateSent: '31.03.2023',
847
+ dateSent: 0,
848
848
  text: 'text test',
849
849
  userId: 12345,
850
850
  },
@@ -866,7 +866,7 @@ export class Stubs {
866
866
  login: string,
867
867
  created_at: string,
868
868
  updated_at: string,
869
- last_request_at: number,
869
+ last_request_at: string,
870
870
  custom_data: string | null = null,
871
871
  user_tags: string | null = null,
872
872
  blob_id = '',
@@ -906,7 +906,7 @@ export class Stubs {
906
906
  DialogType.private,
907
907
  '101',
908
908
  'Stub1 Private Dialog',
909
- '31.03.2023',
909
+ 0,
910
910
  'Test text message for private dialog',
911
911
  11,
912
912
  '11',
@@ -921,7 +921,7 @@ export class Stubs {
921
921
  DialogType.public,
922
922
  '102',
923
923
  'Stub2 Public Dialog',
924
- '31.03.2023',
924
+ 0,
925
925
  'Test text message for public dialog',
926
926
  12,
927
927
  '12',
@@ -938,7 +938,7 @@ export class Stubs {
938
938
  DialogType.group,
939
939
  '103',
940
940
  'Stub 3 Group Dialog',
941
- '31.03.2023',
941
+ 0,
942
942
  'Test text message for group dialog',
943
943
  13,
944
944
  '13',
@@ -964,7 +964,7 @@ export class Stubs {
964
964
  'login_user11',
965
965
  '31.03.2023',
966
966
  '31.03.2023',
967
- 0,
967
+ '',
968
968
  );
969
969
 
970
970
  const user12: UserEntity = Stubs.createUserEntityWithParams(
@@ -974,7 +974,7 @@ export class Stubs {
974
974
  'login_user12',
975
975
  '31.03.2023',
976
976
  '31.03.2023',
977
- 0,
977
+ '',
978
978
  );
979
979
 
980
980
  const user13: UserEntity = Stubs.createUserEntityWithParams(
@@ -984,7 +984,7 @@ export class Stubs {
984
984
  'login_user13',
985
985
  '31.03.2023',
986
986
  '31.03.2023',
987
- 0,
987
+ '',
988
988
  );
989
989
 
990
990
  users.push(user11);
@@ -15,7 +15,7 @@ export class LocalDialogDTO {
15
15
 
16
16
  public lastMessageText: string;
17
17
 
18
- public lastMessageDateSent: string;
18
+ public lastMessageDateSent: number;
19
19
 
20
20
  public lastMessageUserId: string;
21
21
 
@@ -33,7 +33,7 @@ export class LocalDialogDTO {
33
33
  this.participantsIds = [];
34
34
  this.updatedAt = '';
35
35
  this.lastMessageText = '';
36
- this.lastMessageDateSent = '';
36
+ this.lastMessageDateSent = 0;
37
37
  this.lastMessageUserId = '';
38
38
  this.unreadMessageCount = 0;
39
39
  this.name = '';