quickblox-react-ui-kit 0.3.0-beta.4 → 0.3.1-beta.1

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