quickblox-react-ui-kit 0.3.0 → 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 (103) 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 +654 -552
  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 +3 -1
  19. package/src/App.tsx +3 -2
  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 +10 -6
  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 +5 -1
  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 +17 -15
  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/iframe.html +2 -2
  86. package/storybook-static/{main.597d432b.iframe.bundle.js → main.2f6d7582.iframe.bundle.js} +1 -1
  87. package/storybook-static/project.json +1 -1
  88. package/storybook-static/runtime~main.8d5710fb.iframe.bundle.js +1 -0
  89. package/webpack.config.js +2 -1
  90. package/storybook-static/758.53b4954a.iframe.bundle.js.map +0 -1
  91. package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.cf806856.iframe.bundle.js +0 -1
  92. package/storybook-static/Presentation-ui-components-Button-Button-stories.4fac7996.iframe.bundle.js +0 -1
  93. package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.6665bbfb.iframe.bundle.js +0 -1
  94. package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.cf340397.iframe.bundle.js +0 -1
  95. package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.b32a1e17.iframe.bundle.js +0 -1
  96. package/storybook-static/Presentation-ui-components-Header-Header-stories.073c4507.iframe.bundle.js +0 -1
  97. package/storybook-static/Presentation-ui-components-Loader-Loader-stories.9bf3fb63.iframe.bundle.js +0 -1
  98. package/storybook-static/Presentation-ui-components-Message-Message-stories.343dfae0.iframe.bundle.js +0 -1
  99. package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.c2ead6a5.iframe.bundle.js +0 -1
  100. package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.527e000e.iframe.bundle.js +0 -1
  101. package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.2ff75703.iframe.bundle.js +0 -1
  102. package/storybook-static/Presentation-ui-components-TextField-TextField-stories.4a2eef3e.iframe.bundle.js +0 -1
  103. package/storybook-static/runtime~main.7ee2126e.iframe.bundle.js +0 -1
@@ -1,3 +1,4 @@
1
+ import QB from 'quickblox/quickblox';
1
2
  import { IMapper } from './IMapper';
2
3
  import { DialogEntity } from '../../Domain/entity/DialogEntity';
3
4
  import { DialogType } from '../../Domain/entity/DialogTypes';
@@ -86,9 +87,7 @@ export class DialogRemoteDTOMapper implements IMapper {
86
87
  dialog.id,
87
88
  dialog.name,
88
89
  {
89
- dateSent: dialog.lastMessageDateSent
90
- ? dialog.lastMessageDateSent
91
- : '',
90
+ dateSent: dialog.lastMessageDateSent,
92
91
  text: dialog.lastMessageText ? dialog.lastMessageText : '',
93
92
  userId: parseInt(dialog.lastMessageUserId, 10),
94
93
  },
@@ -104,9 +103,7 @@ export class DialogRemoteDTOMapper implements IMapper {
104
103
  { todo: '' },
105
104
  dialog.id,
106
105
  {
107
- dateSent: dialog.lastMessageDateSent
108
- ? dialog.lastMessageDateSent
109
- : '',
106
+ dateSent: dialog.lastMessageDateSent,
110
107
  text: dialog.lastMessageText ? dialog.lastMessageText : '',
111
108
  userId: parseInt(dialog.lastMessageUserId, 10),
112
109
  },
@@ -123,9 +120,7 @@ export class DialogRemoteDTOMapper implements IMapper {
123
120
  { todo: '' },
124
121
  dialog.id,
125
122
  {
126
- dateSent: dialog.lastMessageDateSent
127
- ? dialog.lastMessageDateSent
128
- : '',
123
+ dateSent: dialog.lastMessageDateSent,
129
124
  text: dialog.lastMessageText ? dialog.lastMessageText : '',
130
125
  userId: parseInt(dialog.lastMessageUserId, 10),
131
126
  },
@@ -186,7 +181,7 @@ export class DialogRemoteDTOMapper implements IMapper {
186
181
  public static createDefaultDialogEntity(owner_id: string): DialogEntity {
187
182
  return {
188
183
  customData: { todo: '' },
189
- lastMessage: { dateSent: '', text: '', userId: 0 },
184
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
190
185
  ownerId: owner_id,
191
186
  type: DialogType.public,
192
187
  unreadMessageCount: 0,
@@ -1,3 +1,4 @@
1
+ import QB from 'quickblox/quickblox';
1
2
  import { SubscriptionPerformer } from '../../Domain/use_cases/base/Subscribable/SubscriptionPerformer';
2
3
  import { stringifyError } from '../../utils/parse';
3
4
 
@@ -203,7 +203,7 @@ export default class UsersRepository {
203
203
  for (let i = 0; i < usersIds.length; i += 1) {
204
204
  let dto: RemoteUserDTO = new RemoteUserDTO();
205
205
 
206
- dto.id = usersIds[i].toString();
206
+ dto.id = usersIds[i]?.toString() || '-1';
207
207
  // eslint-disable-next-line no-await-in-loop
208
208
  dto = await this.remoteDataSource.getUser(dto);
209
209
  arrayUserDTO.push(dto);
@@ -6,7 +6,7 @@ const listChats: PublicDialogEntity[] = [
6
6
  id: '1',
7
7
  name: 'Chat 1',
8
8
  customData: { todo: '' },
9
- lastMessage: { dateSent: '', text: '', userId: 0 },
9
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
10
10
  ownerId: '',
11
11
  photo: '',
12
12
  type: 0,
@@ -17,7 +17,7 @@ const listChats: PublicDialogEntity[] = [
17
17
  id: '2',
18
18
  name: 'Chat 2',
19
19
  customData: { todo: '' },
20
- lastMessage: { dateSent: '', text: '', userId: 0 },
20
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
21
21
  ownerId: '',
22
22
  photo: '',
23
23
  type: 0,
@@ -28,7 +28,7 @@ const listChats: PublicDialogEntity[] = [
28
28
  id: '3',
29
29
  name: 'Chat 3',
30
30
  customData: { todo: '' },
31
- lastMessage: { dateSent: '', text: '', userId: 0 },
31
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
32
32
  ownerId: '',
33
33
  photo: '',
34
34
  type: 0,
@@ -39,7 +39,7 @@ const listChats: PublicDialogEntity[] = [
39
39
  id: '4',
40
40
  name: 'Chat 4',
41
41
  customData: { todo: '' },
42
- lastMessage: { dateSent: '', text: '', userId: 0 },
42
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
43
43
  ownerId: '',
44
44
  photo: '',
45
45
  type: 0,
@@ -50,7 +50,7 @@ const listChats: PublicDialogEntity[] = [
50
50
  id: '5',
51
51
  name: 'Chat 5',
52
52
  customData: { todo: '' },
53
- lastMessage: { dateSent: '', text: '', userId: 0 },
53
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
54
54
  ownerId: '',
55
55
  photo: '',
56
56
  type: 0,
@@ -64,7 +64,7 @@ const listCasheChats: PublicDialogEntity[] = [
64
64
  id: '1',
65
65
  name: 'Cash Chat 1',
66
66
  customData: { todo: '' },
67
- lastMessage: { dateSent: '', text: '', userId: 0 },
67
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
68
68
  ownerId: '',
69
69
  photo: '',
70
70
  type: 0,
@@ -75,7 +75,7 @@ const listCasheChats: PublicDialogEntity[] = [
75
75
  id: '2',
76
76
  name: 'Cash Chat 2',
77
77
  customData: { todo: '' },
78
- lastMessage: { dateSent: '', text: '', userId: 0 },
78
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
79
79
  ownerId: '',
80
80
  photo: '',
81
81
  type: 0,
@@ -86,7 +86,7 @@ const listCasheChats: PublicDialogEntity[] = [
86
86
  id: '3',
87
87
  name: 'Chat 3 from Cash',
88
88
  customData: { todo: '' },
89
- lastMessage: { dateSent: '', text: '', userId: 0 },
89
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
90
90
  ownerId: '',
91
91
  photo: '',
92
92
  type: 0,
@@ -97,7 +97,7 @@ const listCasheChats: PublicDialogEntity[] = [
97
97
  id: '4',
98
98
  name: 'Chat 4 from Cash',
99
99
  customData: { todo: '' },
100
- lastMessage: { dateSent: '', text: '', userId: 0 },
100
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
101
101
  ownerId: '',
102
102
  photo: '',
103
103
  type: 0,
@@ -108,7 +108,7 @@ const listCasheChats: PublicDialogEntity[] = [
108
108
  id: '5',
109
109
  name: 'Chat 5 from Cash',
110
110
  customData: { todo: '' },
111
- lastMessage: { dateSent: '', text: '', userId: 0 },
111
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
112
112
  ownerId: '',
113
113
  photo: '',
114
114
  type: 0,
@@ -119,7 +119,7 @@ const listCasheChats: PublicDialogEntity[] = [
119
119
  id: '6',
120
120
  name: 'Chat 6 from Cash',
121
121
  customData: { todo: '' },
122
- lastMessage: { dateSent: '', text: '', userId: 0 },
122
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
123
123
  ownerId: '',
124
124
  photo: '',
125
125
  type: 0,
@@ -133,7 +133,7 @@ const preloadedChats: PublicDialogEntity[] = [
133
133
  id: '1',
134
134
  name: 'Preload Chat 1',
135
135
  customData: { todo: '' },
136
- lastMessage: { dateSent: '', text: '', userId: 0 },
136
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
137
137
  ownerId: '',
138
138
  photo: '',
139
139
  type: 0,
@@ -144,7 +144,7 @@ const preloadedChats: PublicDialogEntity[] = [
144
144
  id: '2',
145
145
  name: 'Preload Chat 2',
146
146
  customData: { todo: '' },
147
- lastMessage: { dateSent: '', text: '', userId: 0 },
147
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
148
148
  ownerId: '',
149
149
  photo: '',
150
150
  type: 0,
@@ -155,7 +155,7 @@ const preloadedChats: PublicDialogEntity[] = [
155
155
  id: '3',
156
156
  name: 'Preload Chat 3',
157
157
  customData: { todo: '' },
158
- lastMessage: { dateSent: '', text: '', userId: 0 },
158
+ lastMessage: { dateSent: 0, text: '', userId: 0 },
159
159
  ownerId: '',
160
160
  photo: '',
161
161
  type: 0,
@@ -8,6 +8,10 @@ import {
8
8
  UNEXPECTED_MAPPER_DTO_EXCEPTION_EXCEPTION_CODE,
9
9
  UNEXPECTED_MAPPER_DTO_EXCEPTION_MESSAGE,
10
10
  } from '../../exception/MapperDTOException';
11
+ import {
12
+ QBChatDialogType,
13
+ QBUIKitChatDialog,
14
+ } from '../../../../CommonTypes/CommonTypes';
11
15
 
12
16
  type DtoValidator<T> = {
13
17
  [key in keyof T]: (v: unknown) => v is T[key];
@@ -26,7 +30,7 @@ export class DialogDTOMapper implements IDTOMapper {
26
30
 
27
31
  DialogDTOMapper.validateDTO(dialogDTO);
28
32
 
29
- const dialog: QBChatDialog = {
33
+ const dialog: QBUIKitChatDialog = {
30
34
  _id: dialogDTO.id,
31
35
  created_at: '',
32
36
  last_message: DialogDTOMapper.formatLastMessageText(
@@ -53,7 +57,8 @@ export class DialogDTOMapper implements IDTOMapper {
53
57
 
54
58
  // eslint-disable-next-line class-methods-use-this
55
59
  toTDO<TArg, TResult>(qbEntity: TArg): Promise<TResult> {
56
- const qbDialog: QBChatDialog = qbEntity as unknown as QBChatDialog;
60
+ const qbDialog: QBUIKitChatDialog =
61
+ qbEntity as unknown as QBUIKitChatDialog;
57
62
 
58
63
  DialogDTOMapper.validateQBChatDialog(qbDialog);
59
64
 
@@ -62,11 +67,13 @@ export class DialogDTOMapper implements IDTOMapper {
62
67
  dto.id = qbDialog._id;
63
68
  dto.lastMessageId = qbDialog.last_message_id || '';
64
69
  dto.lastMessageText = qbDialog.last_message as string;
65
- dto.lastMessageDateSent = qbDialog.last_message_date_sent as string;
70
+ dto.lastMessageDateSent = qbDialog.last_message_date_sent || 0;
66
71
  dto.lastMessageUserId =
67
72
  qbDialog.last_message_user_id === null
68
73
  ? ''
69
- : qbDialog.last_message_user_id.toString();
74
+ : // eslint-disable-next-line @typescript-eslint/no-unsafe-call
75
+ qbDialog.last_message_user_id.toString();
76
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
70
77
  dto.ownerId = qbDialog.user_id.toString();
71
78
  dto.type = qbDialog.type as number;
72
79
  dto.unreadMessageCount =
@@ -74,6 +81,7 @@ export class DialogDTOMapper implements IDTOMapper {
74
81
  ? 0
75
82
  : qbDialog.unread_messages_count;
76
83
  dto.updatedAt = qbDialog.updated_at;
84
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
77
85
  dto.participantId = qbDialog.user_id.toString();
78
86
  dto.name = qbDialog.name;
79
87
  dto.photo = qbDialog.photo === null ? '' : qbDialog.photo;
@@ -89,14 +97,17 @@ export class DialogDTOMapper implements IDTOMapper {
89
97
 
90
98
  dto.participantId = interlocutorId
91
99
  ? interlocutorId.toString()
92
- : qbDialog.user_id.toString();
100
+ : // eslint-disable-next-line @typescript-eslint/no-unsafe-call
101
+ qbDialog.user_id.toString();
93
102
  dto.id = qbDialog._id;
94
103
  dto.lastMessageText = qbDialog.last_message as string;
95
- dto.lastMessageDateSent = qbDialog.last_message_date_sent as string;
104
+ dto.lastMessageDateSent = qbDialog.last_message_date_sent || 0;
96
105
  dto.lastMessageUserId =
97
106
  qbDialog.last_message_user_id === null
98
107
  ? ''
99
- : qbDialog.last_message_user_id.toString();
108
+ : // eslint-disable-next-line @typescript-eslint/no-unsafe-call
109
+ qbDialog.last_message_user_id.toString();
110
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
100
111
  dto.ownerId = qbDialog.user_id.toString();
101
112
  dto.type = qbDialog.type;
102
113
  dto.unreadMessageCount =
@@ -108,11 +119,13 @@ export class DialogDTOMapper implements IDTOMapper {
108
119
  case DialogType.public:
109
120
  dto.id = qbDialog._id;
110
121
  dto.lastMessageText = qbDialog.last_message as string;
111
- dto.lastMessageDateSent = qbDialog.last_message_date_sent as string;
122
+ dto.lastMessageDateSent = qbDialog.last_message_date_sent || 0;
112
123
  dto.lastMessageUserId =
113
124
  qbDialog.last_message_user_id === null
114
125
  ? ''
115
- : qbDialog.last_message_user_id.toString();
126
+ : // eslint-disable-next-line @typescript-eslint/no-unsafe-call
127
+ qbDialog.last_message_user_id.toString();
128
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
116
129
  dto.ownerId = qbDialog.user_id.toString();
117
130
  dto.type = qbDialog.type;
118
131
  dto.unreadMessageCount =
@@ -120,6 +133,7 @@ export class DialogDTOMapper implements IDTOMapper {
120
133
  ? 0
121
134
  : qbDialog.unread_messages_count;
122
135
  dto.updatedAt = qbDialog.updated_at;
136
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
123
137
  dto.participantId = qbDialog.user_id.toString();
124
138
  dto.name = qbDialog.name;
125
139
  dto.photo = qbDialog.photo === null ? '' : qbDialog.photo;
@@ -127,11 +141,13 @@ export class DialogDTOMapper implements IDTOMapper {
127
141
  case DialogType.group:
128
142
  dto.id = qbDialog._id;
129
143
  dto.lastMessageText = qbDialog.last_message as string;
130
- dto.lastMessageDateSent = qbDialog.last_message_date_sent as string;
144
+ dto.lastMessageDateSent = qbDialog.last_message_date_sent || 0;
131
145
  dto.lastMessageUserId =
132
146
  qbDialog.last_message_user_id === null
133
147
  ? ''
134
- : qbDialog.last_message_user_id.toString();
148
+ : // eslint-disable-next-line @typescript-eslint/no-unsafe-call
149
+ qbDialog.last_message_user_id.toString();
150
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
135
151
  dto.ownerId = qbDialog.user_id.toString();
136
152
  dto.type = qbDialog.type;
137
153
  dto.unreadMessageCount =
@@ -282,105 +298,107 @@ export class DialogDTOMapper implements IDTOMapper {
282
298
  }
283
299
 
284
300
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
285
- private static validateQBChatDialog(qbDialog: QBChatDialog) {
286
- const qbDialogValidator: DtoValidator<QBChatDialog> = {
287
- _id(v: unknown): v is QBChatDialog['_id'] {
288
- const { _id } = v as QBChatDialog;
301
+ private static validateQBChatDialog(qbDialog: QBUIKitChatDialog) {
302
+ const qbDialogValidator: DtoValidator<QBUIKitChatDialog> = {
303
+ _id(v: unknown): v is QBUIKitChatDialog['_id'] {
304
+ const { _id } = v as QBUIKitChatDialog;
289
305
 
290
306
  return _id !== undefined && _id !== null;
291
307
  },
292
- created_at(v: unknown): v is QBChatDialog['created_at'] {
293
- const { created_at } = v as QBChatDialog;
308
+ created_at(v: unknown): v is QBUIKitChatDialog['created_at'] {
309
+ const { created_at } = v as QBUIKitChatDialog;
294
310
 
295
311
  return created_at !== undefined && created_at !== null;
296
312
  },
297
- data(v: unknown): v is QBChatDialog['data'] {
298
- const { data } = v as QBChatDialog;
313
+ data(v: unknown): v is QBUIKitChatDialog['data'] {
314
+ const { data } = v as QBUIKitChatDialog;
299
315
 
300
316
  return data !== undefined && data !== null;
301
317
  },
302
- joined(v: unknown): v is QBChatDialog['joined'] {
303
- const { joined } = v as QBChatDialog;
318
+ joined(v: unknown): v is QBUIKitChatDialog['joined'] {
319
+ const { joined } = v as QBUIKitChatDialog;
304
320
 
305
321
  return joined !== undefined && joined !== null;
306
322
  },
307
- last_message(v: unknown): v is QBChatDialog['last_message'] {
323
+ last_message(v: unknown): v is QBUIKitChatDialog['last_message'] {
308
324
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
309
- const { last_message } = v as QBChatDialog;
325
+ const { last_message } = v as QBUIKitChatDialog;
310
326
 
311
327
  // return last_message !== undefined && last_message !== null;
312
328
  return true;
313
329
  },
314
330
  last_message_date_sent(
315
331
  v: unknown,
316
- ): v is QBChatDialog['last_message_date_sent'] {
317
- const { last_message_date_sent } = v as QBChatDialog;
332
+ ): v is QBUIKitChatDialog['last_message_date_sent'] {
333
+ const { last_message_date_sent } = v as QBUIKitChatDialog;
318
334
 
319
335
  return (
320
336
  last_message_date_sent !== undefined &&
321
337
  last_message_date_sent !== null
322
338
  );
323
339
  },
324
- last_message_id(v: unknown): v is QBChatDialog['last_message_id'] {
325
- const { last_message_id } = v as QBChatDialog;
340
+ last_message_id(v: unknown): v is QBUIKitChatDialog['last_message_id'] {
341
+ const { last_message_id } = v as QBUIKitChatDialog;
326
342
 
327
343
  return last_message_id !== undefined && last_message_id !== null;
328
344
  },
329
345
  last_message_user_id(
330
346
  v: unknown,
331
- ): v is QBChatDialog['last_message_user_id'] {
332
- const { last_message_user_id } = v as QBChatDialog;
347
+ ): v is QBUIKitChatDialog['last_message_user_id'] {
348
+ const { last_message_user_id } = v as QBUIKitChatDialog;
333
349
 
334
350
  return (
335
351
  last_message_user_id !== undefined && last_message_user_id !== null
336
352
  );
337
353
  },
338
- name(v: unknown): v is QBChatDialog['name'] {
339
- const { name } = v as QBChatDialog;
354
+ name(v: unknown): v is QBUIKitChatDialog['name'] {
355
+ const { name } = v as QBUIKitChatDialog;
340
356
 
341
357
  return name !== undefined && name !== null;
342
358
  },
343
- occupants_ids(v: unknown): v is QBChatDialog['occupants_ids'] {
344
- const { occupants_ids } = v as QBChatDialog;
359
+ occupants_ids(v: unknown): v is QBUIKitChatDialog['occupants_ids'] {
360
+ const { occupants_ids } = v as QBUIKitChatDialog;
345
361
 
346
362
  return occupants_ids !== undefined && occupants_ids !== null;
347
363
  },
348
- new_occupants_ids(v: unknown): v is QBChatDialog['new_occupants_ids'] {
349
- const { new_occupants_ids } = v as QBChatDialog;
364
+ new_occupants_ids(
365
+ v: unknown,
366
+ ): v is QBUIKitChatDialog['new_occupants_ids'] {
367
+ const { new_occupants_ids } = v as QBUIKitChatDialog;
350
368
 
351
369
  return new_occupants_ids !== undefined && new_occupants_ids !== null;
352
370
  },
353
- photo(v: unknown): v is QBChatDialog['photo'] {
354
- const { photo } = v as QBChatDialog;
371
+ photo(v: unknown): v is QBUIKitChatDialog['photo'] {
372
+ const { photo } = v as QBUIKitChatDialog;
355
373
 
356
374
  return photo !== undefined && photo !== null;
357
375
  },
358
- type(v: unknown): v is QBChatDialog['type'] {
359
- const { type } = v as QBChatDialog;
376
+ type(v: unknown): v is QBUIKitChatDialog['type'] {
377
+ const { type } = v as QBUIKitChatDialog;
360
378
 
361
379
  return type !== undefined && type !== null;
362
380
  },
363
381
  unread_messages_count(
364
382
  v: unknown,
365
- ): v is QBChatDialog['unread_messages_count'] {
366
- const { unread_messages_count } = v as QBChatDialog;
383
+ ): v is QBUIKitChatDialog['unread_messages_count'] {
384
+ const { unread_messages_count } = v as QBUIKitChatDialog;
367
385
 
368
386
  return (
369
387
  unread_messages_count !== undefined && unread_messages_count !== null
370
388
  );
371
389
  },
372
- updated_at(v: unknown): v is QBChatDialog['updated_at'] {
373
- const { updated_at } = v as QBChatDialog;
390
+ updated_at(v: unknown): v is QBUIKitChatDialog['updated_at'] {
391
+ const { updated_at } = v as QBUIKitChatDialog;
374
392
 
375
393
  return updated_at !== undefined && updated_at !== null;
376
394
  },
377
- user_id(v: unknown): v is QBChatDialog['user_id'] {
378
- const { user_id } = v as QBChatDialog;
395
+ user_id(v: unknown): v is QBUIKitChatDialog['user_id'] {
396
+ const { user_id } = v as QBUIKitChatDialog;
379
397
 
380
398
  return user_id !== undefined && user_id !== null;
381
399
  },
382
- xmpp_room_jid(v: unknown): v is QBChatDialog['xmpp_room_jid'] {
383
- const { xmpp_room_jid } = v as QBChatDialog;
400
+ xmpp_room_jid(v: unknown): v is QBUIKitChatDialog['xmpp_room_jid'] {
401
+ const { xmpp_room_jid } = v as QBUIKitChatDialog;
384
402
 
385
403
  return xmpp_room_jid !== undefined && xmpp_room_jid !== null;
386
404
  },
@@ -1,3 +1,7 @@
1
+ import QB, {
2
+ QBBlobCreate,
3
+ QBBlobCreateUploadParams,
4
+ } from 'quickblox/quickblox';
1
5
  import { IDTOMapper } from './IDTOMapper';
2
6
  import { RemoteFileDTO } from '../../../dto/file/RemoteFileDTO';
3
7
  import {
@@ -1,3 +1,4 @@
1
+ import QB, { ChatMessageAttachment, QBChatMessage } from 'quickblox/quickblox';
1
2
  import { IDTOMapper } from './IDTOMapper';
2
3
  import { RemoteMessageDTO } from '../../../dto/message/RemoteMessageDTO';
3
4
  import {
@@ -1,3 +1,4 @@
1
+ import { QBUser } from 'quickblox/quickblox';
1
2
  import { IDTOMapper } from './IDTOMapper';
2
3
  import { RemoteUserDTO } from '../../../dto/user/RemoteUserDTO';
3
4
  import {
@@ -1,3 +1,19 @@
1
+ import QB, {
2
+ ChatMessageAttachment,
3
+ GetMessagesResult,
4
+ GetUserParams,
5
+ ListUserResponse,
6
+ QBBlobCreate,
7
+ QBBlobCreateUploadParams,
8
+ QBChatDialog,
9
+ QBChatMessage,
10
+ QBChatXMPPMessage,
11
+ QBGetDialogResult,
12
+ QBLoginParams,
13
+ QBSession,
14
+ QBSystemMessage,
15
+ QBUser,
16
+ } from 'quickblox/quickblox';
1
17
  import { RemoteDialogDTO } from '../../dto/dialog/RemoteDialogDTO';
2
18
  import {
3
19
  INCORRECT_REMOTE_DATASOURCE_DATA_EXCEPTION_CODE,
@@ -59,6 +75,11 @@ import { FileDTOMapper } from './Mapper/FileDTOMapper';
59
75
  import { DialogEventInfo } from '../../../Domain/entity/DialogEventInfo';
60
76
  import { IRemoteDataSource } from './IRemoteDataSource';
61
77
  import { QBConfig } from '../../../QBconfig';
78
+ import {
79
+ QBUIKitChatDialog,
80
+ QBUIKitChatNewMessage,
81
+ QBUIKitSystemMessage,
82
+ } from '../../../CommonTypes/CommonTypes';
62
83
 
63
84
  export type PaginatedDTOResult = {
64
85
  PaginationResult: Pagination;
@@ -335,18 +356,18 @@ export class RemoteDataSource implements IRemoteDataSource {
335
356
 
336
357
  public initEventsHandlers() {
337
358
  console.log('CALL--initEventsHandlers--CALL');
338
- QB.chat.onSystemMessageListener = (message) => {
359
+ QB.chat.onSystemMessageListener = (message: QBUIKitSystemMessage) => {
339
360
  console.log(`EVENT: receive system message: ${JSON.stringify(message)}`);
340
361
  const resultMessage = new RemoteMessageDTO();
341
362
 
342
363
  resultMessage.sender_id = message.userId;
343
364
  resultMessage.message = message.body || 'system message';
344
365
  resultMessage.notification_type =
345
- message.extension.notification_type || NotificationTypes.UPDATE_DIALOG;
366
+ message.extension?.notification_type || NotificationTypes.UPDATE_DIALOG;
346
367
  resultMessage.dialogId = message?.extension?.dialog_id || '';
347
368
 
348
369
  this.subscriptionOnSystemMessages[
349
- resultMessage.notification_type
370
+ resultMessage.notification_type!
350
371
  ].informSubscribers(resultMessage, EventMessageType.SystemMessage);
351
372
  };
352
373
 
@@ -821,7 +842,7 @@ export class RemoteDataSource implements IRemoteDataSource {
821
842
  }
822
843
 
823
844
  async updateDialog(dto: RemoteDialogDTO): Promise<RemoteDialogDTO> {
824
- const qbEntity: QBChatDialog =
845
+ const qbEntity: QBUIKitChatDialog =
825
846
  await this.getCurrentDialogDTOMapper().fromDTO(dto);
826
847
 
827
848
  let data = {};
@@ -847,7 +868,10 @@ export class RemoteDataSource implements IRemoteDataSource {
847
868
  };
848
869
  }
849
870
 
850
- const qbDialogs: QBChatDialog = await QBUpdateDialog(qbEntity._id, data);
871
+ const qbDialogs: QBUIKitChatDialog = await QBUpdateDialog(
872
+ qbEntity._id,
873
+ data,
874
+ );
851
875
 
852
876
  if (qbDialogs === null || qbDialogs === undefined) {
853
877
  return Promise.reject(
@@ -1185,7 +1209,7 @@ export class RemoteDataSource implements IRemoteDataSource {
1185
1209
  //
1186
1210
  const messageText = dto.message;
1187
1211
 
1188
- const qbEntity: QBChatNewMessage = {
1212
+ const qbEntity: QBUIKitChatNewMessage = {
1189
1213
  type: dto.dialog_type === DialogType.private ? 'chat' : 'groupchat',
1190
1214
  body: messageText || '',
1191
1215
  notification_type: dto.notification_type,
@@ -1259,10 +1283,7 @@ export class RemoteDataSource implements IRemoteDataSource {
1259
1283
  let qbMessages: QBSystemMessage | QBChatMessage['_id'] | undefined;
1260
1284
 
1261
1285
  if (dto.notification_type && dto.notification_type.length > 0) {
1262
- const systemMessage: QBSystemMessage = {
1263
- body: null,
1264
- id: '',
1265
- userId: this.authInformation?.userId || 0,
1286
+ const systemMessage: { extension: QBSystemMessage['extension'] } = {
1266
1287
  extension: {
1267
1288
  notification_type: dto.notification_type,
1268
1289
  dialog_id: dto.dialogId,
@@ -1,5 +1,5 @@
1
1
  export interface LastMessageEntity {
2
2
  text: string;
3
- dateSent: string;
3
+ dateSent: number;
4
4
  userId: number;
5
5
  }
@@ -407,6 +407,14 @@ export default function useDialogViewModel(
407
407
 
408
408
  return newState;
409
409
  });
410
+ if (dialog?.type === DialogType.private) {
411
+ const updDialog = { ...dialog };
412
+
413
+ updDialog.lastMessage.dateSent = messageEntity.date_sent;
414
+ updDialog.lastMessage.text = messageEntity.message;
415
+ updDialog.lastMessage.userId = messageEntity.sender_id;
416
+ setDialog(updDialog);
417
+ }
410
418
  });
411
419
  //
412
420
  })
@@ -430,7 +430,7 @@ const DialogInfo: React.FC<HeaderDialogsProps> = ({
430
430
  className="dialog-info-action-wrapper-button"
431
431
  onClick={() => onShowAllMemberClick(true)}
432
432
  variant="outlined"
433
- disabled={dialog.ownerId !== currentUserId}
433
+ disabled={disableAction}
434
434
  >
435
435
  See all members
436
436
  </Button>