Skip to content

Commit 9524b35

Browse files
v0.3.1-beta.2
1 parent 9b19261 commit 9524b35

File tree

21 files changed

+188
-282
lines changed

21 files changed

+188
-282
lines changed

global.d.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -173,32 +173,32 @@ type Dictionary<T> = Record<string, T>;
173173
// }
174174

175175
// TODO: add export to SDK
176-
type ChatConnectParams =
177-
| {
178-
/** Connect to the chat by user id */
179-
userId: QBUser['id'];
180-
/** The user's password or session token */
181-
password: string;
182-
}
183-
| {
184-
/** Connect to the chat by user jid */
185-
jid: string;
186-
/** The user's password or session token */
187-
password: string;
188-
}
189-
| {
190-
/** Connect to the chat by user's email */
191-
email: string;
192-
/** The user's password or session token */
193-
password: string;
194-
};
195-
196-
type QBCustomField =
197-
| string
198-
| string[]
199-
| number
200-
| number[]
201-
| boolean
202-
| boolean[]
203-
| null
204-
| undefined;
176+
// type ChatConnectParams =
177+
// | {
178+
// /** Connect to the chat by user id */
179+
// userId: QBUser['id'];
180+
// /** The user's password or session token */
181+
// password: string;
182+
// }
183+
// | {
184+
// /** Connect to the chat by user jid */
185+
// jid: string;
186+
// /** The user's password or session token */
187+
// password: string;
188+
// }
189+
// | {
190+
// /** Connect to the chat by user's email */
191+
// email: string;
192+
// /** The user's password or session token */
193+
// password: string;
194+
// };
195+
//
196+
// type QBCustomField =
197+
// | string
198+
// | string[]
199+
// | number
200+
// | number[]
201+
// | boolean
202+
// | boolean[]
203+
// | null
204+
// | undefined;

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quickblox-react-ui-kit",
3-
"version": "0.3.1-beta.1",
3+
"version": "0.3.1-beta.2",
44
"main": "dist/index-ui.js",
55
"license": "MIT",
66
"dependencies": {
@@ -12,7 +12,7 @@
1212
"qb-ai-core": "^0.1.3",
1313
"qb-ai-rephrase": "^0.1.2",
1414
"qb-ai-translate": "^0.1.2",
15-
"quickblox": "^2.16.2",
15+
"quickblox": "^2.16.3",
1616
"react": "^18.2.0",
1717
"react-dom": "^18.2.0",
1818
"react-router-dom": "^6.11.1",

src/CommonTypes/CommonTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
QBChatDialog,
66
QBChatNewMessage,
77
QBConfig,
8+
QBCustomField,
89
} from 'quickblox';
910
import { Tone } from '../Presentation/Views/Dialog/AIWidgets/Tone';
1011

src/Data/Stubs.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,9 @@ export class Stubs {
105105
for (const item of dialogsEntities) {
106106
const dialogDTO: LocalDialogDTO =
107107
// eslint-disable-next-line no-await-in-loop
108-
await dialogsDTOtoEntityMapper.fromEntity<
109-
DialogEntity,
110-
RemoteDialogDTO
111-
>(item);
108+
await dialogsDTOtoEntityMapper.fromEntity<DialogEntity, LocalDialogDTO>(
109+
item,
110+
);
112111

113112
// eslint-disable-next-line @typescript-eslint/no-unused-vars,promise/catch-or-return,promise/always-return
114113
ds.saveDialog(dialogDTO)
@@ -537,7 +536,7 @@ export class Stubs {
537536
dto.id = '111';
538537
dto.lastMessageDateSent = 0;
539538
dto.lastMessageText = 'text test';
540-
dto.lastMessageUserId = '777';
539+
dto.lastMessageUserId = 777;
541540
dto.ownerId = '999';
542541
dto.type = dialogType;
543542
dto.unreadMessageCount = 555;
@@ -548,7 +547,7 @@ export class Stubs {
548547
dto.id = '111';
549548
dto.lastMessageDateSent = 0;
550549
dto.lastMessageText = 'text test';
551-
dto.lastMessageUserId = '777';
550+
dto.lastMessageUserId = 777;
552551
dto.ownerId = '999';
553552
dto.type = dialogType;
554553
dto.unreadMessageCount = 555;
@@ -560,7 +559,7 @@ export class Stubs {
560559
dto.id = '111';
561560
dto.lastMessageDateSent = 0;
562561
dto.lastMessageText = 'text test';
563-
dto.lastMessageUserId = '777';
562+
dto.lastMessageUserId = 777;
564563
dto.ownerId = '999';
565564
dto.type = dialogType;
566565
dto.unreadMessageCount = 555;
@@ -604,7 +603,7 @@ export class Stubs {
604603
participantsIds: [],
605604
lastMessageText: '',
606605
lastMessageDateSent: 0,
607-
lastMessageUserId: '',
606+
lastMessageUserId: 0,
608607
lastMessageId: '',
609608
unreadMessageCount: 0,
610609
updatedAt: '',
@@ -619,7 +618,7 @@ export class Stubs {
619618
participantsIds: [],
620619
lastMessageText: '',
621620
lastMessageDateSent: 0,
622-
lastMessageUserId: '',
621+
lastMessageUserId: 0,
623622
lastMessageId: '',
624623
unreadMessageCount: 0,
625624
updatedAt: '',
@@ -634,7 +633,7 @@ export class Stubs {
634633
participantsIds: [],
635634
lastMessageText: '',
636635
lastMessageDateSent: 0,
637-
lastMessageUserId: '',
636+
lastMessageUserId: 0,
638637
lastMessageId: '',
639638
unreadMessageCount: 0,
640639
updatedAt: '',
@@ -649,7 +648,7 @@ export class Stubs {
649648
participantsIds: [],
650649
lastMessageText: '',
651650
lastMessageDateSent: 0,
652-
lastMessageUserId: '',
651+
lastMessageUserId: 0,
653652
lastMessageId: '',
654653
unreadMessageCount: 0,
655654
updatedAt: '',
@@ -664,7 +663,7 @@ export class Stubs {
664663
participantsIds: [],
665664
lastMessageText: '',
666665
lastMessageDateSent: 0,
667-
lastMessageUserId: '',
666+
lastMessageUserId: 0,
668667
lastMessageId: '',
669668
unreadMessageCount: 0,
670669
updatedAt: '',
@@ -679,7 +678,7 @@ export class Stubs {
679678
participantsIds: [],
680679
lastMessageText: '',
681680
lastMessageDateSent: 0,
682-
lastMessageUserId: '',
681+
lastMessageUserId: 0,
683682
lastMessageId: '',
684683
unreadMessageCount: 0,
685684
updatedAt: '',
@@ -694,7 +693,7 @@ export class Stubs {
694693
participantsIds: [],
695694
lastMessageText: '',
696695
lastMessageDateSent: 0,
697-
lastMessageUserId: '',
696+
lastMessageUserId: 0,
698697
lastMessageId: '',
699698
unreadMessageCount: 0,
700699
updatedAt: '',
@@ -867,7 +866,7 @@ export class Stubs {
867866
login: string,
868867
created_at: string,
869868
updated_at: string,
870-
last_request_at: number,
869+
last_request_at: string,
871870
custom_data: string | null = null,
872871
user_tags: string | null = null,
873872
blob_id = '',
@@ -965,7 +964,7 @@ export class Stubs {
965964
'login_user11',
966965
'31.03.2023',
967966
'31.03.2023',
968-
0,
967+
'',
969968
);
970969

971970
const user12: UserEntity = Stubs.createUserEntityWithParams(
@@ -975,7 +974,7 @@ export class Stubs {
975974
'login_user12',
976975
'31.03.2023',
977976
'31.03.2023',
978-
0,
977+
'',
979978
);
980979

981980
const user13: UserEntity = Stubs.createUserEntityWithParams(
@@ -985,7 +984,7 @@ export class Stubs {
985984
'login_user13',
986985
'31.03.2023',
987986
'31.03.2023',
988-
0,
987+
'',
989988
);
990989

991990
users.push(user11);

src/Data/dto/dialog/RemoteDialogDTO.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class RemoteDialogDTO {
1717

1818
public lastMessageText: string;
1919

20-
public lastMessageUserId: string;
20+
public lastMessageUserId: number;
2121

2222
public lastMessageDateSent: number;
2323

@@ -43,7 +43,7 @@ export class RemoteDialogDTO {
4343

4444
this.lastMessageText = '';
4545

46-
this.lastMessageUserId = '';
46+
this.lastMessageUserId = 0;
4747

4848
this.lastMessageDateSent = 0;
4949

src/Data/dto/user/LocalUserDTO.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class LocalUserDTO {
1313

1414
public updated_at: string;
1515

16-
public last_request_at: number;
16+
public last_request_at: string;
1717

1818
public custom_data: string | null;
1919

@@ -29,7 +29,7 @@ export class LocalUserDTO {
2929
this.login = '';
3030
this.created_at = '';
3131
this.updated_at = '';
32-
this.last_request_at = 0;
32+
this.last_request_at = '';
3333
this.custom_data = '';
3434
this.user_tags = '';
3535
this.blob_id = '';

src/Data/dto/user/RemoteUserDTO.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class RemoteUserDTO {
1313

1414
public updated_at: string;
1515

16-
public last_request_at: number;
16+
public last_request_at: string;
1717

1818
public custom_data: string | null;
1919

@@ -29,7 +29,7 @@ export class RemoteUserDTO {
2929
this.login = '';
3030
this.created_at = '';
3131
this.updated_at = '';
32-
this.last_request_at = 0;
32+
this.last_request_at = '';
3333
this.custom_data = '';
3434
this.user_tags = '';
3535
this.blob_id = 0;

src/Data/mapper/DialogRemoteDTOMapper.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class DialogRemoteDTOMapper implements IMapper {
5050

5151
dialog.lastMessageText = dialogEntity.lastMessage.text;
5252

53-
dialog.lastMessageUserId = dialogEntity.lastMessage.userId.toString();
53+
dialog.lastMessageUserId = dialogEntity.lastMessage.userId;
5454

5555
dialog.lastMessageDateSent = dialogEntity.lastMessage.dateSent;
5656

@@ -89,7 +89,7 @@ export class DialogRemoteDTOMapper implements IMapper {
8989
{
9090
dateSent: dialog.lastMessageDateSent,
9191
text: dialog.lastMessageText ? dialog.lastMessageText : '',
92-
userId: parseInt(dialog.lastMessageUserId, 10),
92+
userId: dialog.lastMessageUserId,
9393
},
9494
dialog.ownerId,
9595
dialog.type,
@@ -105,7 +105,7 @@ export class DialogRemoteDTOMapper implements IMapper {
105105
{
106106
dateSent: dialog.lastMessageDateSent,
107107
text: dialog.lastMessageText ? dialog.lastMessageText : '',
108-
userId: parseInt(dialog.lastMessageUserId, 10),
108+
userId: dialog.lastMessageUserId,
109109
},
110110
dialog.ownerId,
111111
dialog.type,
@@ -122,7 +122,7 @@ export class DialogRemoteDTOMapper implements IMapper {
122122
{
123123
dateSent: dialog.lastMessageDateSent,
124124
text: dialog.lastMessageText ? dialog.lastMessageText : '',
125-
userId: parseInt(dialog.lastMessageUserId, 10),
125+
userId: dialog.lastMessageUserId,
126126
},
127127
dialog.ownerId,
128128
dialog.type,
@@ -555,16 +555,10 @@ export class DialogRemoteDTOMapper implements IMapper {
555555

556556
switch (dialogType) {
557557
case DialogType.private:
558-
dialogEntity =
559-
entity instanceof PrivateDialogEntity
560-
? (entity as unknown as PrivateDialogEntity)
561-
: null;
558+
dialogEntity = entity as PrivateDialogEntity;
562559
break;
563560
case DialogType.public:
564-
dialogEntity =
565-
entity instanceof PublicDialogEntity
566-
? (entity as unknown as PublicDialogEntity)
567-
: null;
561+
dialogEntity = entity as PublicDialogEntity;
568562
break;
569563
case DialogType.group:
570564
dialogEntity = entity as GroupDialogEntity;

src/Data/mapper/UserLocalDTOMapper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class UserLocalDTOMapper implements IMapper {
134134
return (
135135
last_request_at !== undefined &&
136136
last_request_at !== null &&
137-
last_request_at > 0
137+
last_request_at.length > 0
138138
);
139139
},
140140
login(v: unknown): v is UserEntity['login'] {
@@ -376,7 +376,7 @@ export class UserLocalDTOMapper implements IMapper {
376376
email: '',
377377
full_name: '',
378378
id: 0,
379-
last_request_at: 0,
379+
last_request_at: '',
380380
login: '',
381381
updated_at: '',
382382
user_tags: '',

0 commit comments

Comments
 (0)