@nam088/zca-js 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3396 @@
1
+ import * as tough_cookie from 'tough-cookie';
2
+ import tough_cookie__default, { CookieJar, SerializedCookie } from 'tough-cookie';
3
+ import { Agent } from 'http';
4
+ import EventEmitter from 'events';
5
+ import cryptojs from 'crypto-js';
6
+
7
+ declare class ZaloApiError extends Error {
8
+ code: number | null;
9
+ constructor(message: string, code?: number);
10
+ }
11
+
12
+ declare class ZaloApiMissingImageMetadataGetter extends ZaloApiError {
13
+ constructor();
14
+ }
15
+
16
+ declare class ZaloApiLoginQRAborted extends ZaloApiError {
17
+ constructor(message?: string);
18
+ }
19
+
20
+ declare class ZaloApiLoginQRDeclined extends ZaloApiError {
21
+ constructor(message?: string);
22
+ }
23
+
24
+ type AttachmentSource = string | {
25
+ data: Buffer;
26
+ filename: `${string}.${string}`;
27
+ metadata: {
28
+ totalSize: number;
29
+ width?: number;
30
+ height?: number;
31
+ };
32
+ };
33
+
34
+ type AutoReplyItem = {
35
+ id: number;
36
+ weight: number;
37
+ enable: boolean;
38
+ modifiedTime: number;
39
+ startTime: number;
40
+ endTime: number;
41
+ content: string;
42
+ scope: AutoReplyScope;
43
+ uids: string[] | null;
44
+ ownerId: number;
45
+ recurrence: string[];
46
+ createdTime: number;
47
+ };
48
+ declare enum AutoReplyScope {
49
+ Everyone = 0,
50
+ Stranger = 1,
51
+ SpecificFriends = 2,
52
+ FriendsExcept = 3
53
+ }
54
+
55
+ declare enum BoardType {
56
+ Note = 1,
57
+ PinnedMessage = 2,
58
+ Poll = 3
59
+ }
60
+ type PollDetail = {
61
+ creator: string;
62
+ question: string;
63
+ options: PollOptions[];
64
+ joined: boolean;
65
+ closed: boolean;
66
+ poll_id: number;
67
+ allow_multi_choices: boolean;
68
+ allow_add_new_option: boolean;
69
+ is_anonymous: boolean;
70
+ poll_type: number;
71
+ created_time: number;
72
+ updated_time: number;
73
+ expired_time: number;
74
+ is_hide_vote_preview: boolean;
75
+ num_vote: number;
76
+ };
77
+ type PollOptions = {
78
+ content: string;
79
+ votes: number;
80
+ voted: boolean;
81
+ voters: string[];
82
+ option_id: number;
83
+ };
84
+ type NoteDetail = {
85
+ id: string;
86
+ type: number;
87
+ color: number;
88
+ emoji: string;
89
+ startTime: number;
90
+ duration: number;
91
+ params: {
92
+ title: string;
93
+ extra?: string;
94
+ };
95
+ creatorId: string;
96
+ editorId: string;
97
+ createTime: number;
98
+ editTime: number;
99
+ repeat: number;
100
+ };
101
+ type PinnedMessageDetail = {
102
+ id: string;
103
+ type: number;
104
+ color: number;
105
+ emoji: string;
106
+ startTime: number;
107
+ duration: number;
108
+ params: Record<string, unknown>;
109
+ creatorId: string;
110
+ editorId: string;
111
+ createTime: number;
112
+ editTime: number;
113
+ repeat: number;
114
+ };
115
+
116
+ type CatalogItem = {
117
+ id: string;
118
+ name: string;
119
+ version: number;
120
+ ownerId: string;
121
+ isDefault: boolean;
122
+ /**
123
+ * Relative path used to build the catalog URL.
124
+ *
125
+ * Example: `https://catalog.zalo.me/${path}`
126
+ */
127
+ path: string;
128
+ catalogPhoto: string | null;
129
+ totalProduct: number;
130
+ created_time: number;
131
+ };
132
+
133
+ declare enum ThreadType {
134
+ User = 0,
135
+ Group = 1
136
+ }
137
+ declare enum DestType {
138
+ Group = 1,
139
+ User = 3,
140
+ Page = 5
141
+ }
142
+ declare enum Gender {
143
+ Male = 0,
144
+ Female = 1
145
+ }
146
+ /**
147
+ * @note Bank codes list after Mitm on Mobile and Bank's supported by Zalo
148
+ * @documents https://developers.zalo.me/docs/zalo-notification-service/phu-luc/danh-sach-bin-code - docs missing bin code and short_name bank
149
+ */
150
+ declare enum BinBankCard {
151
+ /**
152
+ * NH TMCP An Bình
153
+ */
154
+ ABBank = 970425,
155
+ /**
156
+ * NH TMCP Á Châu
157
+ */
158
+ ACB = 970416,
159
+ /**
160
+ * NH Nông nghiệp và Phát triển Nông thôn Việt Nam
161
+ */
162
+ Agribank = 970405,
163
+ /**
164
+ * NH TMCP Đầu tư và Phát triển Việt Nam
165
+ */
166
+ BIDV = 970418,
167
+ /**
168
+ * NH TMCP Bản Việt
169
+ */
170
+ BVBank = 970454,
171
+ /**
172
+ * NH TMCP Bắc Á
173
+ */
174
+ BacA_Bank = 970409,
175
+ /**
176
+ * NH TMCP Bảo Việt
177
+ */
178
+ BaoViet_Bank = 970438,
179
+ /**
180
+ * NH số CAKE by VPBank - TMCP Việt Nam Thịnh Vượng
181
+ */
182
+ CAKE = 546034,
183
+ /**
184
+ * NH Thương mại TNHH MTV Xây dựng Việt Nam
185
+ */
186
+ CB_Bank = 970444,
187
+ /**
188
+ * NH TNHH MTV CIMB Việt Nam
189
+ */
190
+ CIMB_Bank = 422589,
191
+ /**
192
+ * NH Hợp tác xã Việt Nam
193
+ */
194
+ Coop_Bank = 970446,
195
+ /**
196
+ * NH TNHH MTV Phát triển Singapore - CN TP. Hồ Chí Minh
197
+ */
198
+ DBS_Bank = 796500,
199
+ /**
200
+ * NH TMCP Đông Á
201
+ */
202
+ DongA_Bank = 970406,
203
+ /**
204
+ * NH TMCP Xuất Nhập khẩu Việt Nam
205
+ */
206
+ Eximbank = 970431,
207
+ /**
208
+ * NH TMCP Dầu khí Toàn cầu
209
+ */
210
+ GPBank = 970408,
211
+ /**
212
+ * NH TMCP Phát triển TP. Hồ Chí Minh
213
+ */
214
+ HDBank = 970437,
215
+ /**
216
+ * NH TNHH MTV HSBC (Việt Nam)
217
+ */
218
+ HSBC = 458761,
219
+ /**
220
+ * NH TNHH MTV Hong Leong Việt Nam
221
+ */
222
+ HongLeong_Bank = 970442,
223
+ /**
224
+ * NH Công nghiệp Hàn Quốc - CN TP. Hồ Chí Minh
225
+ */
226
+ IBK_HCM = 970456,
227
+ /**
228
+ * NH Công nghiệp Hàn Quốc - CN Hà Nội
229
+ */
230
+ IBK_HN = 970455,
231
+ /**
232
+ * NH TNHH Indovina
233
+ */
234
+ Indovina_Bank = 970434,
235
+ /**
236
+ * NH Đại chúng TNHH Kasikornbank - CN TP. Hồ Chí Minh
237
+ */
238
+ KBank = 668888,
239
+ /**
240
+ * NH TMCP Kiên Long
241
+ */
242
+ KienlongBank = 970452,
243
+ /**
244
+ * NH Kookmin - CN TP. Hồ Chí Minh
245
+ */
246
+ Kookmin_Bank_HCM = 970463,
247
+ /**
248
+ * NH Kookmin - CN Hà Nội
249
+ */
250
+ Kookmin_Bank_HN = 970462,
251
+ /**
252
+ * NH TMCP Lộc Phát Việt Nam
253
+ */
254
+ LPBank = 970449,
255
+ /**
256
+ * NH TMCP Quân đội
257
+ */
258
+ MB_Bank = 970422,
259
+ /**
260
+ * NH TMCP Hàng Hải
261
+ */
262
+ MSB = 970426,
263
+ /**
264
+ * NH TMCP Quốc Dân
265
+ */
266
+ NCB = 970419,
267
+ /**
268
+ * NH TMCP Nam Á
269
+ */
270
+ Nam_A_Bank = 970428,
271
+ /**
272
+ * NH Nonghyup - CN Hà Nội
273
+ */
274
+ NongHyup_Bank = 801011,
275
+ /**
276
+ * NH TMCP Phương Đông
277
+ */
278
+ OCB = 970448,
279
+ /**
280
+ * NH Thương mại TNHH MTV Đại Dương
281
+ */
282
+ Ocean_Bank = 970414,
283
+ /**
284
+ * NH TMCP Thịnh vượng và Phát triển
285
+ */
286
+ PGBank = 970430,
287
+ /**
288
+ * NH TMCP Đại Chúng Việt Nam
289
+ */
290
+ PVcomBank = 970412,
291
+ /**
292
+ * NH TNHH MTV Public Việt Nam
293
+ */
294
+ Public_Bank_Vietnam = 970439,
295
+ /**
296
+ * NH TMCP Sài Gòn
297
+ */
298
+ SCB = 970429,
299
+ /**
300
+ * NH TMCP Sài Gòn - Hà Nội
301
+ */
302
+ SHB = 970443,
303
+ /**
304
+ * NH TMCP Sài Gòn Thương Tín
305
+ */
306
+ Sacombank = 970403,
307
+ /**
308
+ * NH TMCP Sài Gòn Công Thương
309
+ */
310
+ Saigon_Bank = 970400,
311
+ /**
312
+ * NH TMCP Đông Nam Á
313
+ */
314
+ SeABank = 970440,
315
+ /**
316
+ * NH TNHH MTV Shinhan Việt Nam
317
+ */
318
+ Shinhan_Bank = 970424,
319
+ /**
320
+ * NH TNHH MTV Standard Chartered Bank Việt Nam
321
+ */
322
+ Standard_Chartered_Vietnam = 970410,
323
+ /**
324
+ * NH số TNEX
325
+ */
326
+ TNEX = 9704261,
327
+ /**
328
+ * NH TMCP Tiên Phong
329
+ */
330
+ TPBank = 970423,
331
+ /**
332
+ * NH TMCP Kỹ thương Việt Nam
333
+ */
334
+ Techcombank = 970407,
335
+ /**
336
+ * NH số Timo by Bản Việt Bank
337
+ */
338
+ Timo = 963388,
339
+ /**
340
+ * NH số UBank by VPBank
341
+ */
342
+ UBank = 546035,
343
+ /**
344
+ * NH United Overseas Bank Việt Nam
345
+ */
346
+ United_Overseas_Bank_Vietnam = 970458,
347
+ /**
348
+ * NH TMCP Quốc tế Việt Nam
349
+ */
350
+ VIB = 970441,
351
+ /**
352
+ * NH TMCP Việt Nam Thịnh Vượng
353
+ */
354
+ VPBank = 970432,
355
+ /**
356
+ * NH Liên doanh Việt - Nga
357
+ */
358
+ VRB = 970421,
359
+ /**
360
+ * NH TMCP Việt Á
361
+ */
362
+ VietABank = 970427,
363
+ /**
364
+ * NH TMCP Việt Nam Thương Tín
365
+ */
366
+ VietBank = 970433,
367
+ /**
368
+ * NH TMCP Ngoại Thương Việt Nam
369
+ */
370
+ Vietcombank = 970436,
371
+ /**
372
+ * NH TMCP Công thương Việt Nam
373
+ */
374
+ VietinBank = 970415,
375
+ /**
376
+ * NH TNHH MTV Woori Việt Nam
377
+ */
378
+ Woori_Bank = 970457
379
+ }
380
+
381
+ type TDeliveredMessage = {
382
+ msgId: string;
383
+ seen: number;
384
+ deliveredUids: string[];
385
+ seenUids: string[];
386
+ realMsgId: string;
387
+ mSTs: number;
388
+ };
389
+ type TGroupDeliveredMessage = TDeliveredMessage & {
390
+ groupId: string;
391
+ };
392
+ declare class UserDeliveredMessage {
393
+ type: ThreadType.User;
394
+ data: TDeliveredMessage;
395
+ threadId: string;
396
+ isSelf: false;
397
+ constructor(data: TDeliveredMessage);
398
+ }
399
+ declare class GroupDeliveredMessage {
400
+ type: ThreadType.Group;
401
+ data: TGroupDeliveredMessage;
402
+ threadId: string;
403
+ isSelf: boolean;
404
+ constructor(uid: string, data: TGroupDeliveredMessage);
405
+ }
406
+ type DeliveredMessage = UserDeliveredMessage | GroupDeliveredMessage;
407
+
408
+ declare enum FriendEventType {
409
+ ADD = 0,
410
+ REMOVE = 1,
411
+ REQUEST = 2,
412
+ UNDO_REQUEST = 3,
413
+ REJECT_REQUEST = 4,
414
+ SEEN_FRIEND_REQUEST = 5,
415
+ BLOCK = 6,
416
+ UNBLOCK = 7,
417
+ BLOCK_CALL = 8,
418
+ UNBLOCK_CALL = 9,
419
+ PIN_UNPIN = 10,
420
+ PIN_CREATE = 11,
421
+ UNKNOWN = 12
422
+ }
423
+ type TFriendEventBase = string;
424
+ type TFriendEventRejectUndo = {
425
+ toUid: string;
426
+ fromUid: string;
427
+ };
428
+ type TFriendEventRequest = {
429
+ toUid: string;
430
+ fromUid: string;
431
+ src: number;
432
+ message: string;
433
+ };
434
+ type TFriendEventSeenRequest = string[];
435
+ type TFriendEventPinCreateTopicParams = {
436
+ senderUid: string;
437
+ senderName: string;
438
+ client_msg_id: string;
439
+ global_msg_id: string;
440
+ msg_type: number;
441
+ title: string;
442
+ };
443
+ type TFriendEventPinTopic = {
444
+ topicId: string;
445
+ topicType: number;
446
+ };
447
+ type TFriendEventPinCreateTopic = {
448
+ type: number;
449
+ color: number;
450
+ emoji: string;
451
+ startTime: number;
452
+ duration: number;
453
+ params: TFriendEventPinCreateTopicParams;
454
+ id: string;
455
+ creatorId: string;
456
+ createTime: number;
457
+ editorId: string;
458
+ editTime: number;
459
+ repeat: number;
460
+ action: number;
461
+ };
462
+ type TFriendEventPinCreate = {
463
+ oldTopic?: TFriendEventPinTopic;
464
+ topic: TFriendEventPinCreateTopic;
465
+ actorId: string;
466
+ oldVersion: number;
467
+ version: number;
468
+ conversationId: string;
469
+ };
470
+ type TFriendEventPinUnpin = {
471
+ topic: TFriendEventPinTopic;
472
+ actorId: string;
473
+ oldVersion: number;
474
+ version: number;
475
+ conversationId: string;
476
+ };
477
+ type TFriendEvent = TFriendEventBase | TFriendEventRequest | TFriendEventRejectUndo | TFriendEventSeenRequest | TFriendEventPinUnpin | TFriendEventPinCreate;
478
+ type FriendEvent = {
479
+ type: FriendEventType.ADD | FriendEventType.REMOVE | FriendEventType.BLOCK | FriendEventType.UNBLOCK | FriendEventType.BLOCK_CALL | FriendEventType.UNBLOCK_CALL;
480
+ data: TFriendEventBase;
481
+ threadId: string;
482
+ isSelf: boolean;
483
+ } | {
484
+ type: FriendEventType.REJECT_REQUEST | FriendEventType.UNDO_REQUEST;
485
+ data: TFriendEventRejectUndo;
486
+ threadId: string;
487
+ isSelf: boolean;
488
+ } | {
489
+ type: FriendEventType.REQUEST;
490
+ data: TFriendEventRequest;
491
+ threadId: string;
492
+ isSelf: boolean;
493
+ } | {
494
+ type: FriendEventType.SEEN_FRIEND_REQUEST;
495
+ data: TFriendEventSeenRequest;
496
+ threadId: string;
497
+ isSelf: boolean;
498
+ } | {
499
+ type: FriendEventType.PIN_CREATE;
500
+ data: TFriendEventPinCreate;
501
+ threadId: string;
502
+ isSelf: boolean;
503
+ } | {
504
+ type: FriendEventType.PIN_UNPIN;
505
+ data: TFriendEventPinUnpin;
506
+ threadId: string;
507
+ isSelf: boolean;
508
+ } | {
509
+ type: FriendEventType.UNKNOWN;
510
+ data: string;
511
+ threadId: string;
512
+ isSelf: boolean;
513
+ };
514
+ declare function initializeFriendEvent(uid: string, data: TFriendEvent, type: FriendEventType): FriendEvent;
515
+
516
+ type GroupSetting = {
517
+ blockName: number;
518
+ signAdminMsg: number;
519
+ addMemberOnly: number;
520
+ setTopicOnly: number;
521
+ enableMsgHistory: number;
522
+ joinAppr: number;
523
+ lockCreatePost: number;
524
+ lockCreatePoll: number;
525
+ lockSendMsg: number;
526
+ lockViewMember: number;
527
+ bannFeature: number;
528
+ dirtyMedia: number;
529
+ banDuration: number;
530
+ };
531
+ declare enum GroupTopicType {
532
+ Note = 0,
533
+ Message = 2,
534
+ Poll = 3
535
+ }
536
+ type GroupTopicNoteParams = {
537
+ client_msg_id: string;
538
+ global_msg_id: string;
539
+ title: string;
540
+ };
541
+ type GroupTopicTextMessageParams = {
542
+ senderUid: string;
543
+ senderName: string;
544
+ client_msg_id: string;
545
+ global_msg_id: string;
546
+ msg_type: 1;
547
+ title: string;
548
+ };
549
+ type GroupTopicVoiceMessageParams = GroupTopicImageMessageParams & {
550
+ msg_type: 31;
551
+ };
552
+ type GroupTopicImageMessageParams = GroupTopicTextMessageParams & {
553
+ msg_type: 32;
554
+ thumb: string;
555
+ };
556
+ type GroupTopicVideoMessageParams = GroupTopicTextMessageParams & {
557
+ msg_type: 44;
558
+ thumb: string;
559
+ };
560
+ type GroupTopicFileMessageParams = GroupTopicTextMessageParams & {
561
+ msg_type: 46;
562
+ extra: {
563
+ fileSize: string;
564
+ checksum: string;
565
+ checksumSha: unknown;
566
+ fileExt: string;
567
+ fdata: string;
568
+ fType: number;
569
+ };
570
+ };
571
+ type GroupTopicGifMessageParams = GroupTopicTextMessageParams & {
572
+ msg_type: 49;
573
+ thumb: string;
574
+ };
575
+ type GroupTopicMessageParams = GroupTopicTextMessageParams | GroupTopicVoiceMessageParams | GroupTopicImageMessageParams | GroupTopicVideoMessageParams | GroupTopicFileMessageParams | GroupTopicGifMessageParams;
576
+ type GroupTopicPollParams = {
577
+ pollId: number;
578
+ title: string;
579
+ };
580
+ type GroupTopicOtherParams = {
581
+ [key: string]: unknown;
582
+ };
583
+ type GroupTopic = {
584
+ type: GroupTopicType;
585
+ color: number;
586
+ emoji: string;
587
+ startTime: number;
588
+ duration: number;
589
+ params: GroupTopicNoteParams | GroupTopicMessageParams | GroupTopicPollParams | GroupTopicOtherParams;
590
+ id: string;
591
+ creatorId: string;
592
+ createTime: number;
593
+ editorId: string;
594
+ editTime: number;
595
+ repeat: number;
596
+ action: number;
597
+ };
598
+ declare enum GroupType {
599
+ Group = 1,
600
+ Community = 2
601
+ }
602
+ type GroupCurrentMem = {
603
+ id: string;
604
+ dName: string;
605
+ zaloName: string;
606
+ avatar: string;
607
+ avatar_25: string;
608
+ accountStatus: number;
609
+ type: number;
610
+ };
611
+ type GroupInfo = {
612
+ groupId: string;
613
+ name: string;
614
+ desc: string;
615
+ type: GroupType;
616
+ creatorId: string;
617
+ version: string;
618
+ avt: string;
619
+ fullAvt: string;
620
+ memberIds: string[];
621
+ adminIds: string[];
622
+ currentMems: GroupCurrentMem[];
623
+ updateMems: unknown[];
624
+ admins: unknown[];
625
+ hasMoreMember: number;
626
+ subType: number;
627
+ totalMember: number;
628
+ maxMember: number;
629
+ setting: GroupSetting;
630
+ createdTime: number;
631
+ visibility: number;
632
+ globalId: string;
633
+ /**
634
+ * 1: True, 0: False
635
+ */
636
+ e2ee: number;
637
+ extraInfo: {
638
+ enable_media_store: number;
639
+ };
640
+ };
641
+
642
+ declare enum ReminderRepeatMode {
643
+ None = 0,
644
+ Daily = 1,
645
+ Weekly = 2,
646
+ Monthly = 3
647
+ }
648
+ type ReminderUser = {
649
+ creatorUid: string;
650
+ toUid: string;
651
+ emoji: string;
652
+ color: number;
653
+ reminderId: string;
654
+ createTime: number;
655
+ repeat: ReminderRepeatMode;
656
+ startTime: number;
657
+ editTime: number;
658
+ endTime: number;
659
+ params: {
660
+ title: string;
661
+ setTitle: boolean;
662
+ };
663
+ type: number;
664
+ };
665
+ type ReminderGroup = {
666
+ editorId: string;
667
+ emoji: string;
668
+ color: number;
669
+ groupId: string;
670
+ creatorId: string;
671
+ editTime: number;
672
+ eventType: number;
673
+ responseMem: {
674
+ rejectMember: number;
675
+ myResp: number;
676
+ acceptMember: number;
677
+ };
678
+ params: {
679
+ title: string;
680
+ setTitle?: boolean;
681
+ };
682
+ type: number;
683
+ duration: number;
684
+ repeatInfo: {
685
+ list_ts: unknown[];
686
+ } | null;
687
+ repeatData: unknown[];
688
+ createTime: number;
689
+ repeat: ReminderRepeatMode;
690
+ startTime: number;
691
+ id: string;
692
+ };
693
+
694
+ declare enum GroupEventType {
695
+ JOIN_REQUEST = "join_request",
696
+ JOIN = "join",
697
+ LEAVE = "leave",
698
+ REMOVE_MEMBER = "remove_member",
699
+ BLOCK_MEMBER = "block_member",
700
+ UPDATE_SETTING = "update_setting",
701
+ UPDATE = "update",
702
+ NEW_LINK = "new_link",
703
+ ADD_ADMIN = "add_admin",
704
+ REMOVE_ADMIN = "remove_admin",
705
+ NEW_PIN_TOPIC = "new_pin_topic",
706
+ UPDATE_PIN_TOPIC = "update_pin_topic",
707
+ REORDER_PIN_TOPIC = "reorder_pin_topic",
708
+ UPDATE_BOARD = "update_board",
709
+ REMOVE_BOARD = "remove_board",
710
+ UPDATE_TOPIC = "update_topic",
711
+ UNPIN_TOPIC = "unpin_topic",
712
+ REMOVE_TOPIC = "remove_topic",
713
+ ACCEPT_REMIND = "accept_remind",
714
+ REJECT_REMIND = "reject_remind",
715
+ REMIND_TOPIC = "remind_topic",
716
+ UPDATE_AVATAR = "update_avatar",
717
+ UNKNOWN = "unknown"
718
+ }
719
+ type GroupEventUpdateMember = {
720
+ id: string;
721
+ dName: string;
722
+ avatar: string;
723
+ type: number;
724
+ avatar_25: string;
725
+ };
726
+ type GroupEventGroupInfo = {
727
+ group_link?: string;
728
+ link_expired_time?: number;
729
+ [key: string]: unknown;
730
+ };
731
+ type GroupEventExtraData = {
732
+ featureId?: number;
733
+ field?: string;
734
+ [key: string]: unknown;
735
+ };
736
+ type TGroupEventBase = {
737
+ subType: number;
738
+ groupId: string;
739
+ creatorId: string;
740
+ groupName: string;
741
+ sourceId: string;
742
+ updateMembers: GroupEventUpdateMember[];
743
+ groupSetting: GroupSetting | null;
744
+ groupTopic: GroupTopic | null;
745
+ info: GroupEventGroupInfo | null;
746
+ extraData: GroupEventExtraData | null;
747
+ time: string;
748
+ avt: string | null;
749
+ fullAvt: string | null;
750
+ isAdd: number;
751
+ hideGroupInfo: number;
752
+ version: string;
753
+ groupType: number;
754
+ clientId?: number;
755
+ errorMap?: Record<string, unknown>;
756
+ e2ee?: number;
757
+ };
758
+ type TGroupEventJoinRequest = {
759
+ uids: string[];
760
+ totalPending: number;
761
+ groupId: string;
762
+ time: string;
763
+ };
764
+ type TGroupEventPinTopic = {
765
+ oldBoardVersion: number;
766
+ boardVersion: number;
767
+ topic: GroupTopic;
768
+ actorId: string;
769
+ groupId: string;
770
+ };
771
+ type TGroupEventReorderPinTopic = {
772
+ oldBoardVersion: number;
773
+ actorId: string;
774
+ topics: {
775
+ topicId: string;
776
+ topicType: number;
777
+ }[];
778
+ groupId: string;
779
+ boardVersion: number;
780
+ topic: null;
781
+ };
782
+ type TGroupEventBoard = {
783
+ sourceId: string;
784
+ groupName: string;
785
+ groupTopic: (GroupTopic | ReminderGroup) & {
786
+ params: string;
787
+ };
788
+ groupId: string;
789
+ creatorId: string;
790
+ subType?: number;
791
+ updateMembers?: GroupEventUpdateMember[];
792
+ groupSetting?: GroupSetting;
793
+ info?: GroupEventGroupInfo;
794
+ extraData?: GroupEventExtraData;
795
+ time?: string;
796
+ avt?: null;
797
+ fullAvt?: null;
798
+ isAdd?: number;
799
+ hideGroupInfo?: number;
800
+ version?: string;
801
+ groupType?: number;
802
+ };
803
+ type TGroupEventRemindRespond = {
804
+ topicId: string;
805
+ updateMembers: string[];
806
+ groupId: string;
807
+ time: string;
808
+ };
809
+ type TGroupEventRemindTopic = {
810
+ msg: string;
811
+ editorId: string;
812
+ color: string;
813
+ emoji: string;
814
+ creatorId: string;
815
+ editTime: number;
816
+ type: number;
817
+ duration: number;
818
+ group_id: string;
819
+ createTime: number;
820
+ repeat: number;
821
+ startTime: number;
822
+ time: number;
823
+ remindType: number;
824
+ };
825
+ type TGroupEvent = TGroupEventBase | TGroupEventJoinRequest | TGroupEventPinTopic | TGroupEventReorderPinTopic | TGroupEventBoard | TGroupEventRemindRespond | TGroupEventRemindTopic;
826
+ type GroupEvent = {
827
+ type: GroupEventType.JOIN_REQUEST;
828
+ data: TGroupEventJoinRequest;
829
+ act: string;
830
+ threadId: string;
831
+ isSelf: boolean;
832
+ } | {
833
+ type: GroupEventType.NEW_PIN_TOPIC | GroupEventType.UNPIN_TOPIC | GroupEventType.UPDATE_PIN_TOPIC;
834
+ data: TGroupEventPinTopic;
835
+ act: string;
836
+ threadId: string;
837
+ isSelf: boolean;
838
+ } | {
839
+ type: GroupEventType.REORDER_PIN_TOPIC;
840
+ data: TGroupEventReorderPinTopic;
841
+ act: string;
842
+ threadId: string;
843
+ isSelf: boolean;
844
+ } | {
845
+ type: GroupEventType.UPDATE_BOARD | GroupEventType.REMOVE_BOARD;
846
+ data: TGroupEventBoard;
847
+ act: string;
848
+ threadId: string;
849
+ isSelf: boolean;
850
+ } | {
851
+ type: GroupEventType.ACCEPT_REMIND | GroupEventType.REJECT_REMIND;
852
+ data: TGroupEventRemindRespond;
853
+ act: string;
854
+ threadId: string;
855
+ isSelf: boolean;
856
+ } | {
857
+ type: GroupEventType.REMIND_TOPIC;
858
+ data: TGroupEventRemindTopic;
859
+ act: string;
860
+ threadId: string;
861
+ isSelf: boolean;
862
+ } | {
863
+ type: Exclude<GroupEventType, GroupEventType.JOIN_REQUEST | GroupEventType.NEW_PIN_TOPIC | GroupEventType.UNPIN_TOPIC | GroupEventType.UPDATE_PIN_TOPIC | GroupEventType.REORDER_PIN_TOPIC | GroupEventType.UPDATE_BOARD | GroupEventType.REMOVE_BOARD | GroupEventType.ACCEPT_REMIND | GroupEventType.REJECT_REMIND | GroupEventType.REMIND_TOPIC>;
864
+ data: TGroupEventBase;
865
+ act: string;
866
+ threadId: string;
867
+ isSelf: boolean;
868
+ };
869
+ declare function initializeGroupEvent(uid: string, data: TGroupEvent, type: GroupEventType, act: string): GroupEvent;
870
+
871
+ type TAttachmentContent = {
872
+ title: string;
873
+ description: string;
874
+ href: string;
875
+ thumb: string;
876
+ childnumber: number;
877
+ action: string;
878
+ params: string;
879
+ type: string;
880
+ };
881
+ type TOtherContent = {
882
+ [key: string]: unknown;
883
+ };
884
+ type TMessage = {
885
+ actionId: string;
886
+ msgId: string;
887
+ cliMsgId: string;
888
+ msgType: string;
889
+ uidFrom: string;
890
+ idTo: string;
891
+ dName: string;
892
+ ts: string;
893
+ status: number;
894
+ content: string | TAttachmentContent | TOtherContent;
895
+ notify: string;
896
+ ttl: number;
897
+ userId: string;
898
+ uin: string;
899
+ topOut: string;
900
+ topOutTimeOut: string;
901
+ topOutImprTimeOut: string;
902
+ propertyExt: {
903
+ color: number;
904
+ size: number;
905
+ type: number;
906
+ subType: number;
907
+ ext: string;
908
+ } | undefined;
909
+ paramsExt: {
910
+ countUnread: number;
911
+ containType: number;
912
+ platformType: number;
913
+ };
914
+ cmd: number;
915
+ st: number;
916
+ at: number;
917
+ realMsgId: string;
918
+ quote: TQuote | undefined;
919
+ };
920
+ type TGroupMessage = TMessage & {
921
+ mentions: TMention[] | undefined;
922
+ };
923
+ type TQuote = {
924
+ ownerId: string;
925
+ cliMsgId: number;
926
+ globalMsgId: number;
927
+ cliMsgType: number;
928
+ ts: number;
929
+ msg: string;
930
+ attach: string;
931
+ fromD: string;
932
+ ttl: number;
933
+ };
934
+ type TMention = {
935
+ uid: string;
936
+ pos: number;
937
+ len: number;
938
+ type: 0 | 1;
939
+ };
940
+ declare class UserMessage {
941
+ type: ThreadType.User;
942
+ data: TMessage;
943
+ threadId: string;
944
+ /**
945
+ * true if the message is sent by the logged in account
946
+ */
947
+ isSelf: boolean;
948
+ constructor(uid: string, data: TMessage);
949
+ }
950
+ declare class GroupMessage {
951
+ type: ThreadType.Group;
952
+ data: TGroupMessage;
953
+ threadId: string;
954
+ /**
955
+ * true if the message is sent by the logged in account
956
+ */
957
+ isSelf: boolean;
958
+ constructor(uid: string, data: TGroupMessage);
959
+ }
960
+ type Message = UserMessage | GroupMessage;
961
+
962
+ type ProductCatalogItem = {
963
+ price: string;
964
+ description: string;
965
+ /**
966
+ * Relative path used to build the product URL.
967
+ *
968
+ * Example: https://catalog.zalo.me/${path}
969
+ */
970
+ path: string;
971
+ product_id: string;
972
+ product_name: string;
973
+ currency_unit: string;
974
+ product_photos: string[];
975
+ create_time: number;
976
+ catalog_id: string;
977
+ owner_id: string;
978
+ };
979
+
980
+ type QuickMessage = {
981
+ id: number;
982
+ keyword: string;
983
+ type: number;
984
+ createdTime: number;
985
+ lastModified: number;
986
+ message: {
987
+ title: string;
988
+ params: string | null;
989
+ };
990
+ media: {
991
+ items: {
992
+ type: number;
993
+ photoId: number;
994
+ title: string;
995
+ width: number;
996
+ height: number;
997
+ previewThumb: string;
998
+ rawUrl: string;
999
+ thumbUrl: string;
1000
+ normalUrl: string;
1001
+ hdUrl: string;
1002
+ }[];
1003
+ } | null;
1004
+ };
1005
+
1006
+ declare enum Reactions {
1007
+ HEART = "/-heart",
1008
+ LIKE = "/-strong",
1009
+ HAHA = ":>",
1010
+ WOW = ":o",
1011
+ CRY = ":-((",
1012
+ ANGRY = ":-h",
1013
+ KISS = ":-*",
1014
+ TEARS_OF_JOY = ":')",
1015
+ SHIT = "/-shit",
1016
+ ROSE = "/-rose",
1017
+ BROKEN_HEART = "/-break",
1018
+ DISLIKE = "/-weak",
1019
+ LOVE = ";xx",
1020
+ CONFUSED = ";-/",
1021
+ WINK = ";-)",
1022
+ FADE = "/-fade",
1023
+ SUN = "/-li",
1024
+ BIRTHDAY = "/-bd",
1025
+ BOMB = "/-bome",
1026
+ OK = "/-ok",
1027
+ PEACE = "/-v",
1028
+ THANKS = "/-thanks",
1029
+ PUNCH = "/-punch",
1030
+ SHARE = "/-share",
1031
+ PRAY = "_()_",
1032
+ NO = "/-no",
1033
+ BAD = "/-bad",
1034
+ LOVE_YOU = "/-loveu",
1035
+ SAD = "--b",
1036
+ VERY_SAD = ":((",
1037
+ COOL = "x-)",
1038
+ NERD = "8-)",
1039
+ BIG_SMILE = ";-d",
1040
+ SUNGLASSES = "b-)",
1041
+ NEUTRAL = ":--|",
1042
+ SAD_FACE = "p-(",
1043
+ BYE = ":-bye",
1044
+ SLEEPY = "|-)",
1045
+ WIPE = ":wipe",
1046
+ DIG = ":-dig",
1047
+ ANGUISH = "&-(",
1048
+ HANDCLAP = ":handclap",
1049
+ ANGRY_FACE = ">-|",
1050
+ F_CHAIR = ":-f",
1051
+ L_CHAIR = ":-l",
1052
+ R_CHAIR = ":-r",
1053
+ SILENT = ";-x",
1054
+ SURPRISE = ":-o",
1055
+ EMBARRASSED = ";-s",
1056
+ AFRAID = ";-a",
1057
+ SAD2 = ":-<",
1058
+ BIG_LAUGH = ":))",
1059
+ RICH = "$-)",
1060
+ BEER = "/-beer",
1061
+ NONE = ""
1062
+ }
1063
+ type TReaction = {
1064
+ actionId: string;
1065
+ msgId: string;
1066
+ cliMsgId: string;
1067
+ msgType: string;
1068
+ uidFrom: string;
1069
+ idTo: string;
1070
+ dName?: string;
1071
+ content: {
1072
+ rMsg: {
1073
+ gMsgID: string;
1074
+ cMsgID: string;
1075
+ msgType: number;
1076
+ }[];
1077
+ rIcon: Reactions;
1078
+ rType: number;
1079
+ source: number;
1080
+ };
1081
+ ts: string;
1082
+ ttl: number;
1083
+ };
1084
+ declare class Reaction {
1085
+ data: TReaction;
1086
+ threadId: string;
1087
+ isSelf: boolean;
1088
+ isGroup: boolean;
1089
+ constructor(uid: string, data: TReaction, isGroup: boolean);
1090
+ }
1091
+
1092
+ type TUserSeenMessage = {
1093
+ idTo: string;
1094
+ msgId: string;
1095
+ realMsgId: string;
1096
+ };
1097
+ type TGroupSeenMessage = {
1098
+ msgId: string;
1099
+ groupId: string;
1100
+ seenUids: string[];
1101
+ };
1102
+ declare class UserSeenMessage {
1103
+ type: ThreadType.User;
1104
+ data: TUserSeenMessage;
1105
+ threadId: string;
1106
+ isSelf: false;
1107
+ constructor(data: TUserSeenMessage);
1108
+ }
1109
+ declare class GroupSeenMessage {
1110
+ type: ThreadType.Group;
1111
+ data: TGroupSeenMessage;
1112
+ threadId: string;
1113
+ isSelf: boolean;
1114
+ constructor(uid: string, data: TGroupSeenMessage);
1115
+ }
1116
+ type SeenMessage = UserSeenMessage | GroupSeenMessage;
1117
+
1118
+ type TTyping = {
1119
+ uid: string;
1120
+ ts: string;
1121
+ isPC: 0 | 1;
1122
+ };
1123
+ type TGroupTyping = TTyping & {
1124
+ gid: string;
1125
+ };
1126
+ declare class UserTyping {
1127
+ type: ThreadType.User;
1128
+ data: TTyping;
1129
+ threadId: string;
1130
+ isSelf: false;
1131
+ constructor(data: TTyping);
1132
+ }
1133
+ declare class GroupTyping {
1134
+ type: ThreadType.Group;
1135
+ data: TGroupTyping;
1136
+ threadId: string;
1137
+ isSelf: false;
1138
+ constructor(data: TGroupTyping);
1139
+ }
1140
+ type Typing = UserTyping | GroupTyping;
1141
+
1142
+ type TUndoContent = {
1143
+ globalMsgId: number;
1144
+ cliMsgId: number;
1145
+ deleteMsg: number;
1146
+ srcId: number;
1147
+ destId: number;
1148
+ };
1149
+ type TUndo = {
1150
+ actionId: string;
1151
+ msgId: string;
1152
+ cliMsgId: string;
1153
+ msgType: string;
1154
+ uidFrom: string;
1155
+ idTo: string;
1156
+ dName: string;
1157
+ ts: string;
1158
+ status: number;
1159
+ content: TUndoContent;
1160
+ notify: string;
1161
+ ttl: number;
1162
+ userId: string;
1163
+ uin: string;
1164
+ cmd: number;
1165
+ st: number;
1166
+ at: number;
1167
+ realMsgId: string;
1168
+ };
1169
+ declare class Undo {
1170
+ data: TUndo;
1171
+ threadId: string;
1172
+ isSelf: boolean;
1173
+ isGroup: boolean;
1174
+ constructor(uid: string, data: TUndo, isGroup: boolean);
1175
+ }
1176
+
1177
+ type ZBusinessPackage = {
1178
+ label?: Record<string, string> | null;
1179
+ pkgId: number;
1180
+ };
1181
+ declare enum BusinessCategory {
1182
+ Other = 0,
1183
+ RealEstate = 1,
1184
+ TechnologyAndDevices = 2,
1185
+ TravelAndHospitality = 3,
1186
+ EducationAndTraining = 4,
1187
+ ShoppingAndRetail = 5,
1188
+ CosmeticsAndBeauty = 6,
1189
+ RestaurantAndCafe = 7,
1190
+ AutoAndMotorbike = 8,
1191
+ FashionAndApparel = 9,
1192
+ FoodAndBeverage = 10,
1193
+ MediaAndEntertainment = 11,
1194
+ InternalCommunications = 12,
1195
+ Transportation = 13,
1196
+ Telecommunications = 14
1197
+ }
1198
+ declare const BusinessCategoryName: Record<BusinessCategory, string>;
1199
+
1200
+ type User = {
1201
+ userId: string;
1202
+ username: string;
1203
+ displayName: string;
1204
+ zaloName: string;
1205
+ avatar: string;
1206
+ bgavatar: string;
1207
+ cover: string;
1208
+ gender: Gender;
1209
+ dob: number;
1210
+ sdob: string;
1211
+ status: string;
1212
+ phoneNumber: string;
1213
+ isFr: number;
1214
+ isBlocked: number;
1215
+ lastActionTime: number;
1216
+ lastUpdateTime: number;
1217
+ isActive: number;
1218
+ key: number;
1219
+ type: number;
1220
+ isActivePC: number;
1221
+ isActiveWeb: number;
1222
+ isValid: number;
1223
+ userKey: string;
1224
+ accountStatus: number;
1225
+ oaInfo: unknown;
1226
+ user_mode: number;
1227
+ globalId: string;
1228
+ bizPkg: ZBusinessPackage;
1229
+ createdTs: number;
1230
+ oa_status: unknown;
1231
+ };
1232
+ type UserSetting = {
1233
+ add_friend_via_contact: number;
1234
+ display_on_recommend_friend: number;
1235
+ add_friend_via_group: number;
1236
+ add_friend_via_qr: number;
1237
+ quick_message_status: number;
1238
+ show_online_status: boolean;
1239
+ accept_stranger_call: number;
1240
+ archived_chat_status: number;
1241
+ receive_message: number;
1242
+ add_friend_via_phone: number;
1243
+ display_seen_status: number;
1244
+ view_birthday: number;
1245
+ setting_2FA_status: number;
1246
+ };
1247
+
1248
+ type LabelData = {
1249
+ id: number;
1250
+ text: string;
1251
+ textKey: string;
1252
+ conversations: string[];
1253
+ color: string;
1254
+ offset: number;
1255
+ emoji: string;
1256
+ createTime: number;
1257
+ };
1258
+
1259
+ type UploadEventData$1 = {
1260
+ fileUrl: string;
1261
+ fileId: string;
1262
+ };
1263
+ type UploadCallback = (data: UploadEventData$1) => unknown;
1264
+ type ShareFileSettings = {
1265
+ big_file_domain_list: string[];
1266
+ max_size_share_file_v2: number;
1267
+ max_size_share_file_v3: number;
1268
+ file_upload_show_icon_1GB: boolean;
1269
+ restricted_ext: string;
1270
+ next_file_time: number;
1271
+ max_file: number;
1272
+ max_size_photo: number;
1273
+ max_size_share_file: number;
1274
+ max_size_resize_photo: number;
1275
+ max_size_gif: number;
1276
+ max_size_original_photo: number;
1277
+ chunk_size_file: number;
1278
+ restricted_ext_file: string[];
1279
+ };
1280
+ type SocketSettings = {
1281
+ rotate_error_codes: number[];
1282
+ retries: {
1283
+ [key: string]: {
1284
+ max?: number;
1285
+ times: number[] | number;
1286
+ };
1287
+ };
1288
+ debug: {
1289
+ enable: boolean;
1290
+ };
1291
+ ping_interval: number;
1292
+ reset_endpoint: number;
1293
+ queue_ctrl_actionid_map: {
1294
+ "611_0": string;
1295
+ "610_1": string;
1296
+ "610_0": string;
1297
+ "603_0": string;
1298
+ "611_1": string;
1299
+ };
1300
+ close_and_retry_codes: number[];
1301
+ max_msg_size: number;
1302
+ enable_ctrl_socket: boolean;
1303
+ reconnect_after_fallback: boolean;
1304
+ enable_chat_socket: boolean;
1305
+ submit_wss_log: boolean;
1306
+ disable_lp: boolean;
1307
+ offline_monitor: {
1308
+ enable: boolean;
1309
+ };
1310
+ };
1311
+ type LoginInfo = {
1312
+ [key: string]: any;
1313
+ haspcclient: number;
1314
+ public_ip: string;
1315
+ language: string;
1316
+ send2me_id: string;
1317
+ zpw_service_map_v3: {
1318
+ other_contact: string[];
1319
+ chat_e2e: string[];
1320
+ workspace: string[];
1321
+ catalog: string[];
1322
+ boards: string[];
1323
+ downloadStickerUrl: string[];
1324
+ sp_contact: string[];
1325
+ zcloud_up_file: string[];
1326
+ media_store_send2me: string[];
1327
+ push_act: string[];
1328
+ aext: string[];
1329
+ zfamily: string[];
1330
+ group_poll: string[];
1331
+ group_cloud_message: string[];
1332
+ media_store: string[];
1333
+ file: string[];
1334
+ auto_reply: string[];
1335
+ sync_action: string[];
1336
+ friendLan: string[];
1337
+ friend: string[];
1338
+ alias: string[];
1339
+ zimsg: string[];
1340
+ group_board: string[];
1341
+ conversation: string[];
1342
+ group: string[];
1343
+ fallback_LP: string[];
1344
+ friend_board: string[];
1345
+ up_file: string[];
1346
+ zavi: string[];
1347
+ reaction: string[];
1348
+ voice_call: string[];
1349
+ profile: string[];
1350
+ sticker: string[];
1351
+ label: string[];
1352
+ consent: string[];
1353
+ zcloud: string[];
1354
+ chat: string[];
1355
+ todoUrl: string[];
1356
+ recent_search: string[];
1357
+ group_e2e: string[];
1358
+ quick_message: string[];
1359
+ };
1360
+ };
1361
+ type ExtraVer = {
1362
+ phonebook: number;
1363
+ conv_label: string;
1364
+ friend: string;
1365
+ ver_sticker_giphy_suggest: number;
1366
+ ver_giphy_cate: number;
1367
+ alias: string;
1368
+ ver_sticker_cate_list: number;
1369
+ block_friend: string;
1370
+ };
1371
+ type ZPWServiceMap = LoginInfo["zpw_service_map_v3"];
1372
+ type AppContextBase = {
1373
+ uid: string;
1374
+ imei: string;
1375
+ cookie: CookieJar;
1376
+ userAgent: string;
1377
+ language: string;
1378
+ secretKey: string | null;
1379
+ zpwServiceMap: ZPWServiceMap;
1380
+ settings: {
1381
+ [key: string]: any;
1382
+ features: {
1383
+ [key: string]: any;
1384
+ sharefile: ShareFileSettings;
1385
+ socket: SocketSettings;
1386
+ };
1387
+ keepalive: {
1388
+ alway_keepalive: number;
1389
+ keepalive_duration: number;
1390
+ time_deactive: number;
1391
+ };
1392
+ };
1393
+ loginInfo: LoginInfo;
1394
+ extraVer: ExtraVer;
1395
+ };
1396
+ type ImageMetadataGetterResponse = {
1397
+ width: number;
1398
+ height: number;
1399
+ size: number;
1400
+ } | null;
1401
+ type ImageMetadataGetter = (filePath: string) => Promise<ImageMetadataGetterResponse>;
1402
+ type Options = {
1403
+ selfListen: boolean;
1404
+ checkUpdate: boolean;
1405
+ logging: boolean;
1406
+ apiType: number;
1407
+ apiVersion: number;
1408
+ agent?: Agent;
1409
+ /**
1410
+ * Optional fetch implementation for polyfills in non-standard environments.
1411
+ * If using proxy, `node-fetch` is highly recommended.
1412
+ */
1413
+ polyfill: typeof fetch;
1414
+ imageMetadataGetter?: ImageMetadataGetter;
1415
+ };
1416
+ declare class CallbacksMap extends Map<string, UploadCallback> {
1417
+ /**
1418
+ * @param ttl Time to live in milliseconds. Default is 5 minutes.
1419
+ */
1420
+ set(key: string, value: UploadCallback, ttl?: number): this;
1421
+ }
1422
+ type AppContextExtended = {
1423
+ uploadCallbacks: CallbacksMap;
1424
+ options: Options;
1425
+ readonly API_TYPE: number;
1426
+ readonly API_VERSION: number;
1427
+ };
1428
+ type ContextBase = Partial<AppContextBase> & AppContextExtended;
1429
+ type ContextSession = AppContextBase & AppContextExtended & {
1430
+ secretKey: string;
1431
+ };
1432
+
1433
+ declare enum LoginQRCallbackEventType {
1434
+ QRCodeGenerated = 0,
1435
+ QRCodeExpired = 1,
1436
+ QRCodeScanned = 2,
1437
+ QRCodeDeclined = 3,
1438
+ GotLoginInfo = 4
1439
+ }
1440
+ type LoginQRCallbackEvent = {
1441
+ type: LoginQRCallbackEventType.QRCodeGenerated;
1442
+ data: {
1443
+ code: string;
1444
+ image: string;
1445
+ options: {
1446
+ enabledCheckOCR: boolean;
1447
+ enabledMultiLayer: boolean;
1448
+ };
1449
+ };
1450
+ actions: {
1451
+ saveToFile: (qrPath?: string) => Promise<unknown>;
1452
+ retry: () => unknown;
1453
+ abort: () => unknown;
1454
+ };
1455
+ } | {
1456
+ type: LoginQRCallbackEventType.QRCodeExpired;
1457
+ data: null;
1458
+ actions: {
1459
+ retry: () => unknown;
1460
+ abort: () => unknown;
1461
+ };
1462
+ } | {
1463
+ type: LoginQRCallbackEventType.QRCodeScanned;
1464
+ data: {
1465
+ avatar: string;
1466
+ display_name: string;
1467
+ };
1468
+ actions: {
1469
+ retry: () => unknown;
1470
+ abort: () => unknown;
1471
+ };
1472
+ } | {
1473
+ type: LoginQRCallbackEventType.QRCodeDeclined;
1474
+ data: {
1475
+ code: string;
1476
+ };
1477
+ actions: {
1478
+ retry: () => unknown;
1479
+ abort: () => unknown;
1480
+ };
1481
+ } | {
1482
+ type: LoginQRCallbackEventType.GotLoginInfo;
1483
+ data: {
1484
+ cookie: SerializedCookie[];
1485
+ imei: string;
1486
+ userAgent: string;
1487
+ };
1488
+ actions: null;
1489
+ };
1490
+ type LoginQRCallback = (event: LoginQRCallbackEvent) => unknown;
1491
+
1492
+ type UploadEventData = {
1493
+ fileUrl: string;
1494
+ fileId: string;
1495
+ };
1496
+ type WsPayload<T = Record<string, unknown>> = {
1497
+ version: number;
1498
+ cmd: number;
1499
+ subCmd: number;
1500
+ data: T;
1501
+ };
1502
+ type OnMessageCallback = (message: Message) => unknown;
1503
+ type OnClosedCallback = (code: CloseReason, reason: string) => unknown;
1504
+ type OnErrorCallback = (error: unknown) => unknown;
1505
+ declare enum CloseReason {
1506
+ ManualClosure = 1000,
1507
+ AbnormalClosure = 1006,
1508
+ DuplicateConnection = 3000,
1509
+ KickConnection = 3003
1510
+ }
1511
+ interface ListenerEvents {
1512
+ connected: [];
1513
+ disconnected: [code: CloseReason, reason: string];
1514
+ closed: [code: CloseReason, reason: string];
1515
+ error: [error: unknown];
1516
+ typing: [typing: Typing];
1517
+ message: [message: Message];
1518
+ old_messages: [messages: Message[], type: ThreadType];
1519
+ seen_messages: [messages: SeenMessage[]];
1520
+ delivered_messages: [messages: DeliveredMessage[]];
1521
+ reaction: [reaction: Reaction];
1522
+ old_reactions: [reactions: Reaction[], isGroup: boolean];
1523
+ upload_attachment: [data: UploadEventData];
1524
+ undo: [data: Undo];
1525
+ friend_event: [data: FriendEvent];
1526
+ group_event: [data: GroupEvent];
1527
+ cipher_key: [key: string];
1528
+ }
1529
+ declare class Listener extends EventEmitter<ListenerEvents> {
1530
+ private ctx;
1531
+ private urls;
1532
+ private wsURL;
1533
+ private cookie;
1534
+ private userAgent;
1535
+ private ws;
1536
+ private retryCount;
1537
+ private rotateCount;
1538
+ private onConnectedCallback;
1539
+ private onClosedCallback;
1540
+ private onErrorCallback;
1541
+ private onMessageCallback;
1542
+ private cipherKey?;
1543
+ private selfListen;
1544
+ private pingInterval?;
1545
+ private id;
1546
+ constructor(ctx: ContextSession, urls: string[]);
1547
+ /**
1548
+ * @deprecated Use `on` method instead
1549
+ */
1550
+ onConnected(cb: () => unknown): void;
1551
+ /**
1552
+ * @deprecated Use `on` method instead
1553
+ */
1554
+ onClosed(cb: OnClosedCallback): void;
1555
+ /**
1556
+ * @deprecated Use `on` method instead
1557
+ */
1558
+ onError(cb: OnErrorCallback): void;
1559
+ /**
1560
+ * @deprecated Use `on` method instead
1561
+ */
1562
+ onMessage(cb: OnMessageCallback): void;
1563
+ private canRetry;
1564
+ private shouldRotate;
1565
+ private rotateEndpoint;
1566
+ start({ retryOnClose }?: {
1567
+ retryOnClose?: boolean;
1568
+ }): void;
1569
+ stop(): void;
1570
+ sendWs(payload: WsPayload, requireId?: boolean): void;
1571
+ /**
1572
+ * Request old messages
1573
+ *
1574
+ * @param lastMsgId
1575
+ */
1576
+ requestOldMessages(threadType: ThreadType, lastMsgId?: string | null): void;
1577
+ /**
1578
+ * Request old messages
1579
+ *
1580
+ * @param lastMsgId
1581
+ */
1582
+ requestOldReactions(threadType: ThreadType, lastMsgId?: string | null): void;
1583
+ private reset;
1584
+ }
1585
+
1586
+ type AcceptFriendRequestResponse = "";
1587
+ declare const acceptFriendRequestFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
1588
+
1589
+ type AddGroupBlockedMemberResponse = "";
1590
+ declare const addGroupBlockedMemberFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<"">;
1591
+
1592
+ type AddGroupDeputyResponse = "";
1593
+ declare const addGroupDeputyFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<"">;
1594
+
1595
+ type AddPollOptionsOption = {
1596
+ voted: boolean;
1597
+ content: string;
1598
+ };
1599
+ type AddPollOptionsPayload = {
1600
+ pollId: number;
1601
+ options: AddPollOptionsOption[];
1602
+ votedOptionIds: number[];
1603
+ };
1604
+ type AddPollOptionsResponse = {
1605
+ options: PollOptions[];
1606
+ };
1607
+ declare const addPollOptionsFactory: (ctx: ContextBase, api: API) => (payload: AddPollOptionsPayload) => Promise<AddPollOptionsResponse>;
1608
+
1609
+ type AddQuickMessagePayload = {
1610
+ keyword: string;
1611
+ title: string;
1612
+ media?: AttachmentSource;
1613
+ };
1614
+ type AddQuickMessageResponse = {
1615
+ item: QuickMessage;
1616
+ version: number;
1617
+ };
1618
+ declare const addQuickMessageFactory: (ctx: ContextBase, api: API) => (addPayload: AddQuickMessagePayload) => Promise<AddQuickMessageResponse>;
1619
+
1620
+ type AddReactionResponse = {
1621
+ msgIds: number[];
1622
+ };
1623
+ type CustomReaction = {
1624
+ rType: number;
1625
+ source: number;
1626
+ icon: string;
1627
+ };
1628
+ type AddReactionDestination = {
1629
+ data: {
1630
+ msgId: string;
1631
+ cliMsgId: string;
1632
+ };
1633
+ threadId: string;
1634
+ type: ThreadType;
1635
+ };
1636
+ declare const addReactionFactory: (ctx: ContextBase, api: API) => (icon: Reactions | CustomReaction, dest: AddReactionDestination) => Promise<AddReactionResponse>;
1637
+
1638
+ type AddUnreadMarkResponse = {
1639
+ data: {
1640
+ updateId: number;
1641
+ };
1642
+ status: number;
1643
+ };
1644
+ declare const addUnreadMarkFactory: (ctx: ContextBase, api: API) => (threadId: string, type?: ThreadType) => Promise<AddUnreadMarkResponse>;
1645
+
1646
+ type AddUserToGroupResponse = {
1647
+ errorMembers: string[];
1648
+ error_data: Record<string, string[]>;
1649
+ };
1650
+ declare const addUserToGroupFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<AddUserToGroupResponse>;
1651
+
1652
+ type BlockUserResponse = "";
1653
+ declare const blockUserFactory: (ctx: ContextBase, api: API) => (userId: string) => Promise<"">;
1654
+
1655
+ type BlockViewFeedResponse = "";
1656
+ declare const blockViewFeedFactory: (ctx: ContextBase, api: API) => (isBlockFeed: boolean, userId: string) => Promise<"">;
1657
+
1658
+ type ChangeAccountAvatarResponse = "";
1659
+ declare const changeAccountAvatarFactory: (ctx: ContextBase, api: API) => (avatarSource: AttachmentSource) => Promise<"">;
1660
+
1661
+ type ChangeFriendAliasResponse = "";
1662
+ declare const changeFriendAliasFactory: (ctx: ContextBase, api: API) => (alias: string, friendId: string) => Promise<"">;
1663
+
1664
+ type ChangeGroupAvatarResponse = "";
1665
+ declare const changeGroupAvatarFactory: (ctx: ContextBase, api: API) => (avatarSource: AttachmentSource, groupId: string) => Promise<"">;
1666
+
1667
+ type ChangeGroupNameResponse = {
1668
+ status: number;
1669
+ };
1670
+ declare const changeGroupNameFactory: (ctx: ContextBase, api: API) => (name: string, groupId: string) => Promise<ChangeGroupNameResponse>;
1671
+
1672
+ type ChangeGroupOwnerResponse = {
1673
+ time: number;
1674
+ };
1675
+ declare const changeGroupOwnerFactory: (ctx: ContextBase, api: API) => (memberId: string, groupId: string) => Promise<ChangeGroupOwnerResponse>;
1676
+
1677
+ type CreateAutoReplyPayload = {
1678
+ content: string;
1679
+ isEnable: boolean;
1680
+ startTime: number;
1681
+ endTime: number;
1682
+ scope: AutoReplyScope;
1683
+ uids?: string | string[];
1684
+ };
1685
+ type CreateAutoReplyResponse = {
1686
+ item: AutoReplyItem;
1687
+ version: number;
1688
+ };
1689
+ declare const createAutoReplyFactory: (ctx: ContextBase, api: API) => (payload: CreateAutoReplyPayload) => Promise<CreateAutoReplyResponse>;
1690
+
1691
+ type CreateCatalogResponse = {
1692
+ item: CatalogItem;
1693
+ version_ls_catalog: number;
1694
+ version_catalog: number;
1695
+ };
1696
+ declare const createCatalogFactory: (ctx: ContextBase, api: API) => (catalogName: string) => Promise<CreateCatalogResponse>;
1697
+
1698
+ type CreateGroupResponse = {
1699
+ groupType: number;
1700
+ sucessMembers: string[];
1701
+ groupId: string;
1702
+ errorMembers: string[];
1703
+ error_data: Record<string, unknown>;
1704
+ };
1705
+ type CreateGroupOptions = {
1706
+ /**
1707
+ * Group name
1708
+ */
1709
+ name?: string;
1710
+ /**
1711
+ * List of member IDs to add to the group
1712
+ */
1713
+ members: string[];
1714
+ /**
1715
+ * Avatar source, can be a file path or an Attachment object
1716
+ */
1717
+ avatarSource?: AttachmentSource;
1718
+ /**
1719
+ * Path to the avatar image file
1720
+ * @deprecated Use `avatarSource` instead
1721
+ */
1722
+ avatarPath?: string;
1723
+ };
1724
+ declare const createGroupFactory: (ctx: ContextBase, api: API) => (options: CreateGroupOptions) => Promise<CreateGroupResponse>;
1725
+
1726
+ type CreateNoteOptions = {
1727
+ title: string;
1728
+ pinAct?: boolean;
1729
+ };
1730
+ type CreateNoteResponse = NoteDetail;
1731
+ declare const createNoteFactory: (ctx: ContextBase, api: API) => (options: CreateNoteOptions, groupId: string) => Promise<NoteDetail>;
1732
+
1733
+ /**
1734
+ * Options for creating a poll.
1735
+ */
1736
+ type CreatePollOptions = {
1737
+ /**
1738
+ * Question for the poll.
1739
+ */
1740
+ question: string;
1741
+ /**
1742
+ * List of options for the poll.
1743
+ */
1744
+ options: string[];
1745
+ /**
1746
+ * Poll expiration time in milliseconds (0 = no expiration).
1747
+ */
1748
+ expiredTime?: number;
1749
+ /**
1750
+ * Allows multiple choices in the poll.
1751
+ */
1752
+ allowMultiChoices?: boolean;
1753
+ /**
1754
+ * Allows members to add new options to the poll.
1755
+ */
1756
+ allowAddNewOption?: boolean;
1757
+ /**
1758
+ * Hides voting results until the user has voted.
1759
+ */
1760
+ hideVotePreview?: boolean;
1761
+ /**
1762
+ * Hides poll voters (anonymous poll).
1763
+ */
1764
+ isAnonymous?: boolean;
1765
+ };
1766
+ type CreatePollResponse = PollDetail;
1767
+ declare const createPollFactory: (ctx: ContextBase, api: API) => (options: CreatePollOptions, groupId: string) => Promise<PollDetail>;
1768
+
1769
+ type CreateProductCatalogPayload = {
1770
+ catalogId: string;
1771
+ productName: string;
1772
+ price: string;
1773
+ description: string;
1774
+ /**
1775
+ * Upto 5 media files are allowed, will be ignored if product_photos is provided
1776
+ */
1777
+ files?: AttachmentSource[];
1778
+ /**
1779
+ * List of product photo URLs, upto 5
1780
+ *
1781
+ * You can manually get the URL using `uploadProductPhoto` api
1782
+ */
1783
+ product_photos?: string[];
1784
+ };
1785
+ type CreateProductCatalogResponse = {
1786
+ item: ProductCatalogItem;
1787
+ version_ls_catalog: number;
1788
+ version_catalog: number;
1789
+ };
1790
+ declare const createProductCatalogFactory: (ctx: ContextBase, api: API) => (payload: CreateProductCatalogPayload) => Promise<CreateProductCatalogResponse>;
1791
+
1792
+ type CreateReminderOptions = {
1793
+ title: string;
1794
+ emoji?: string;
1795
+ startTime?: number;
1796
+ repeat?: ReminderRepeatMode;
1797
+ };
1798
+ type CreateReminderUser = ReminderUser;
1799
+ type CreateReminderGroup = Omit<ReminderGroup, "responseMem">;
1800
+ type CreateReminderResponse = CreateReminderUser | CreateReminderGroup;
1801
+ declare const createReminderFactory: (ctx: ContextBase, api: API) => (options: CreateReminderOptions, threadId: string, type?: ThreadType) => Promise<CreateReminderResponse>;
1802
+
1803
+ type DeleteAutoReplyResponse = {
1804
+ item: number;
1805
+ version: number;
1806
+ };
1807
+ declare const deleteAutoReplyFactory: (ctx: ContextBase, api: API) => (id: number) => Promise<DeleteAutoReplyResponse>;
1808
+
1809
+ type DeleteAvatarResponse = {
1810
+ delPhotoIds: string[];
1811
+ errMap: {
1812
+ [key: string]: {
1813
+ err: number;
1814
+ };
1815
+ };
1816
+ };
1817
+ declare const deleteAvatarFactory: (ctx: ContextBase, api: API) => (photoId: string | string[]) => Promise<DeleteAvatarResponse>;
1818
+
1819
+ type DeleteCatalogResponse = "";
1820
+ declare const deleteCatalogFactory: (ctx: ContextBase, api: API) => (catalogId: string) => Promise<"">;
1821
+
1822
+ type DeleteChatResponse = {
1823
+ status: number;
1824
+ };
1825
+ type DeleteChatLastMessage = {
1826
+ /**
1827
+ * Last message owner ID to delete backwards
1828
+ */
1829
+ ownerId: string;
1830
+ /**
1831
+ * Last message client ID to delete backwards
1832
+ */
1833
+ cliMsgId: string;
1834
+ /**
1835
+ * Last message global ID to delete backwards
1836
+ */
1837
+ globalMsgId: string;
1838
+ };
1839
+ declare const deleteChatFactory: (ctx: ContextBase, api: API) => (lastMessage: DeleteChatLastMessage, threadId: string, type?: ThreadType) => Promise<DeleteChatResponse>;
1840
+
1841
+ type DeleteGroupInviteBoxResponse = {
1842
+ delInvitaionIds: string[];
1843
+ errMap: {
1844
+ [groupId: string]: {
1845
+ err: number;
1846
+ };
1847
+ };
1848
+ };
1849
+ declare const deleteGroupInviteBoxFactory: (ctx: ContextBase, api: API) => (groupId: string | string[], blockFutureInvite?: boolean) => Promise<DeleteGroupInviteBoxResponse>;
1850
+
1851
+ type DeleteMessageResponse = {
1852
+ status: number;
1853
+ };
1854
+ type DeleteMessageDestination = {
1855
+ data: {
1856
+ cliMsgId: string;
1857
+ msgId: string;
1858
+ uidFrom: string;
1859
+ };
1860
+ threadId: string;
1861
+ type?: ThreadType;
1862
+ };
1863
+ declare const deleteMessageFactory: (ctx: ContextBase, api: API) => (dest: DeleteMessageDestination, onlyMe?: boolean) => Promise<DeleteMessageResponse>;
1864
+
1865
+ type DeleteProductCatalogPayload = {
1866
+ productIds: string | string[];
1867
+ catalogId: string;
1868
+ };
1869
+ type DeleteProductCatalogResponse = {
1870
+ item: number[];
1871
+ version_ls_catalog: number;
1872
+ version_catalog: number;
1873
+ };
1874
+ declare const deleteProductCatalogFactory: (ctx: ContextBase, api: API) => (payload: DeleteProductCatalogPayload) => Promise<DeleteProductCatalogResponse>;
1875
+
1876
+ type DisableGroupLinkResponse = "";
1877
+ declare const disableGroupLinkFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<"">;
1878
+
1879
+ type DisperseGroupResponse = "";
1880
+ declare const disperseGroupFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<"">;
1881
+
1882
+ type EditNoteOptions = {
1883
+ /**
1884
+ * New note title
1885
+ */
1886
+ title: string;
1887
+ /**
1888
+ * Topic ID to edit note from
1889
+ */
1890
+ topicId: string;
1891
+ /**
1892
+ * Should the note be pinned?
1893
+ */
1894
+ pinAct?: boolean;
1895
+ };
1896
+ type EditNoteResponse = NoteDetail;
1897
+ declare const editNoteFactory: (ctx: ContextBase, api: API) => (options: EditNoteOptions, groupId: string) => Promise<NoteDetail>;
1898
+
1899
+ type EditReminderOptions = {
1900
+ title: string;
1901
+ topicId: string;
1902
+ emoji?: string;
1903
+ startTime?: number;
1904
+ repeat?: ReminderRepeatMode;
1905
+ };
1906
+ type EditReminderUser = ReminderUser;
1907
+ type EditReminderGroup = Omit<ReminderGroup, "responseMem">;
1908
+ type EditReminderResponse = EditReminderUser | EditReminderGroup;
1909
+ declare const editReminderFactory: (ctx: ContextBase, api: API) => (options: EditReminderOptions, threadId: string, type?: ThreadType) => Promise<EditReminderResponse>;
1910
+
1911
+ type EnableGroupLinkResponse = {
1912
+ link: string;
1913
+ expiration_date: number;
1914
+ enabled: number;
1915
+ };
1916
+ declare const enableGroupLinkFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<EnableGroupLinkResponse>;
1917
+
1918
+ type FetchAccountInfoResponse = User;
1919
+ declare const fetchAccountInfoFactory: (ctx: ContextBase, api: API) => () => Promise<User>;
1920
+
1921
+ type FindUserResponse = {
1922
+ avatar: string;
1923
+ cover: string;
1924
+ status: string;
1925
+ gender: Gender;
1926
+ dob: number;
1927
+ sdob: string;
1928
+ globalId: string;
1929
+ bizPkg: ZBusinessPackage;
1930
+ uid: string;
1931
+ zalo_name: string;
1932
+ display_name: string;
1933
+ };
1934
+ declare const findUserFactory: (ctx: ContextBase, api: API) => (phoneNumber: string) => Promise<FindUserResponse>;
1935
+
1936
+ type ForwardMessagePayload = {
1937
+ message: string;
1938
+ ttl?: number;
1939
+ reference?: {
1940
+ id: string;
1941
+ ts: number;
1942
+ logSrcType: number;
1943
+ fwLvl: number;
1944
+ };
1945
+ };
1946
+ type ForwardMessageSuccess = {
1947
+ clientId: string;
1948
+ msgId: string;
1949
+ };
1950
+ type ForwardMessageFail = {
1951
+ clientId: string;
1952
+ error_code: string;
1953
+ };
1954
+ type ForwardMessageResponse = {
1955
+ success: ForwardMessageSuccess[];
1956
+ fail: ForwardMessageFail[];
1957
+ };
1958
+ declare const forwardMessageFactory: (ctx: ContextBase, api: API) => (payload: ForwardMessagePayload, threadIds: string[], type?: ThreadType) => Promise<ForwardMessageResponse>;
1959
+
1960
+ type GetAliasListResponse = {
1961
+ items: {
1962
+ userId: string;
1963
+ alias: string;
1964
+ }[];
1965
+ updateTime: string;
1966
+ };
1967
+ declare const getAliasListFactory: (ctx: ContextBase, api: API) => (count?: number, page?: number) => Promise<GetAliasListResponse>;
1968
+
1969
+ type GetAllFriendsResponse = User[];
1970
+ declare const getAllFriendsFactory: (ctx: ContextBase, api: API) => (count?: number, page?: number) => Promise<GetAllFriendsResponse>;
1971
+
1972
+ type GetAllGroupsResponse = {
1973
+ version: string;
1974
+ gridVerMap: {
1975
+ [groupId: string]: string;
1976
+ };
1977
+ };
1978
+ declare const getAllGroupsFactory: (ctx: ContextBase, api: API) => () => Promise<GetAllGroupsResponse>;
1979
+
1980
+ type GetArchivedChatListResponse = {
1981
+ items: unknown[];
1982
+ version: number;
1983
+ };
1984
+ declare const getArchivedChatListFactory: (ctx: ContextBase, api: API) => () => Promise<GetArchivedChatListResponse>;
1985
+
1986
+ type GetAutoDeleteChatResponse = {
1987
+ convers: {
1988
+ destId: string;
1989
+ isGroup: boolean;
1990
+ ttl: number;
1991
+ createdAt: number;
1992
+ }[];
1993
+ };
1994
+ declare const getAutoDeleteChatFactory: (ctx: ContextBase, api: API) => () => Promise<GetAutoDeleteChatResponse>;
1995
+
1996
+ type GetAutoReplyListResponse = {
1997
+ item: AutoReplyItem[];
1998
+ version: number;
1999
+ };
2000
+ declare const getAutoReplyListFactory: (ctx: ContextBase, api: API) => () => Promise<GetAutoReplyListResponse>;
2001
+
2002
+ type GetAvatarListResponse = {
2003
+ albumId: string;
2004
+ nextPhotoId: string;
2005
+ hasMore: number;
2006
+ photos: {
2007
+ photoId: string;
2008
+ thumbnail: string;
2009
+ url: string;
2010
+ bkUrl: string;
2011
+ }[];
2012
+ };
2013
+ declare const getAvatarListFactory: (ctx: ContextBase, api: API) => (count?: number, page?: number) => Promise<GetAvatarListResponse>;
2014
+
2015
+ type GetBizAccountResponse = {
2016
+ biz?: {
2017
+ desc: string | null;
2018
+ cate: BusinessCategory;
2019
+ addr: string;
2020
+ website: string;
2021
+ email: string;
2022
+ };
2023
+ setting_start_page?: {
2024
+ enable_biz_label: number;
2025
+ enable_cate: number;
2026
+ enable_add: number;
2027
+ cta_profile: number;
2028
+ /**
2029
+ * Relative path used to build the catalog URL.
2030
+ *
2031
+ * Example: https://catalog.zalo.me/${cta_catalog}
2032
+ */
2033
+ cta_catalog: string | null;
2034
+ } | null;
2035
+ pkgId: number;
2036
+ };
2037
+ declare const getBizAccountFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<GetBizAccountResponse>;
2038
+
2039
+ type GetCatalogListPayload = {
2040
+ /**
2041
+ * Number of items to retrieve (default: 20)
2042
+ */
2043
+ limit?: number;
2044
+ lastProductId?: number;
2045
+ /**
2046
+ * Page number (default: 0)
2047
+ */
2048
+ page?: number;
2049
+ };
2050
+ type GetCatalogListResponse = {
2051
+ items: CatalogItem[];
2052
+ version: number;
2053
+ has_more: number;
2054
+ };
2055
+ declare const getCatalogListFactory: (ctx: ContextBase, api: API) => (payload?: GetCatalogListPayload) => Promise<GetCatalogListResponse>;
2056
+
2057
+ declare const getContextFactory: (ctx: ContextBase, api: API) => () => ContextSession;
2058
+
2059
+ declare const getCookieFactory: (ctx: ContextBase, api: API) => () => tough_cookie.CookieJar;
2060
+
2061
+ type GetFriendBoardListResponse = {
2062
+ data: string[];
2063
+ version: number;
2064
+ };
2065
+ declare const getFriendBoardListFactory: (ctx: ContextBase, api: API) => (conversationId: string) => Promise<GetFriendBoardListResponse>;
2066
+
2067
+ type GetFriendOnlinesStatus = {
2068
+ userId: string;
2069
+ status: string;
2070
+ };
2071
+ type GetFriendOnlinesResponse = {
2072
+ predefine: string[];
2073
+ ownerStatus: string;
2074
+ onlines: GetFriendOnlinesStatus[];
2075
+ };
2076
+ declare const getFriendOnlinesFactory: (ctx: ContextBase, api: API) => () => Promise<GetFriendOnlinesResponse>;
2077
+
2078
+ type FriendRecommendationsCollapseMsgListConfig = {
2079
+ collapseId: number;
2080
+ collapseXItem: number;
2081
+ collapseYItem: number;
2082
+ };
2083
+ type FriendRecommendationsDataInfo = {
2084
+ userId: string;
2085
+ zaloName: string;
2086
+ displayName: string;
2087
+ avatar: string;
2088
+ phoneNumber: string;
2089
+ status: string;
2090
+ gender: Gender;
2091
+ dob: number;
2092
+ type: number;
2093
+ recommType: number;
2094
+ recommSrc: number;
2095
+ recommTime: number;
2096
+ recommInfo: {
2097
+ suggestWay: number;
2098
+ source: number;
2099
+ message: string;
2100
+ customText: string | null;
2101
+ };
2102
+ bizPkg: ZBusinessPackage;
2103
+ isSeenFriendReq: boolean;
2104
+ };
2105
+ type FriendRecommendationsRecommItem = {
2106
+ recommItemType: number;
2107
+ dataInfo: FriendRecommendationsDataInfo;
2108
+ };
2109
+ type GetFriendRecommendationsResponse = {
2110
+ expiredDuration: number;
2111
+ collapseMsgListConfig: FriendRecommendationsCollapseMsgListConfig;
2112
+ recommItems: FriendRecommendationsRecommItem[];
2113
+ };
2114
+ declare const getFriendRecommendationsFactory: (ctx: ContextBase, api: API) => () => Promise<GetFriendRecommendationsResponse>;
2115
+
2116
+ type GetFriendRequestStatusResponse = {
2117
+ addFriendPrivacy: number;
2118
+ isSeenFriendReq: boolean;
2119
+ is_friend: number;
2120
+ is_requested: number;
2121
+ is_requesting: number;
2122
+ };
2123
+ declare const getFriendRequestStatusFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<GetFriendRequestStatusResponse>;
2124
+
2125
+ type GetGroupBlockedMemberPayload = {
2126
+ /**
2127
+ * Page number (default: 1)
2128
+ */
2129
+ page?: number;
2130
+ /**
2131
+ * Number of items to retrieve (default: 50)
2132
+ */
2133
+ count?: number;
2134
+ };
2135
+ type GetGroupBlockedMemberResponse = {
2136
+ blocked_members: {
2137
+ id: string;
2138
+ dName: string;
2139
+ zaloName: string;
2140
+ avatar: string;
2141
+ avatar_25: string;
2142
+ accountStatus: number;
2143
+ type: number;
2144
+ }[];
2145
+ has_more: number;
2146
+ };
2147
+ declare const getGroupBlockedMemberFactory: (ctx: ContextBase, api: API) => (payload: GetGroupBlockedMemberPayload, groupId: string) => Promise<GetGroupBlockedMemberResponse>;
2148
+
2149
+ type GroupInfoResponse = {
2150
+ removedsGroup: string[];
2151
+ unchangedsGroup: string[];
2152
+ gridInfoMap: {
2153
+ [groupId: string]: GroupInfo & {
2154
+ memVerList: string[];
2155
+ pendingApprove: GroupInfoPendingApprove;
2156
+ };
2157
+ };
2158
+ };
2159
+ type GroupInfoPendingApprove = {
2160
+ time: number;
2161
+ uids: string[] | null;
2162
+ };
2163
+ declare const getGroupInfoFactory: (ctx: ContextBase, api: API) => (groupId: string | string[]) => Promise<GroupInfoResponse>;
2164
+
2165
+ type GetGroupInviteBoxInfoPayload = {
2166
+ groupId: string;
2167
+ mpage?: number;
2168
+ mcount?: number;
2169
+ };
2170
+ type GetGroupInviteBoxInfoResponse = {
2171
+ groupInfo: GroupInfo & {
2172
+ topic?: Omit<GroupTopic, "action">;
2173
+ };
2174
+ inviterInfo: {
2175
+ id: string;
2176
+ dName: string;
2177
+ zaloName: string;
2178
+ avatar: string;
2179
+ avatar_25: string;
2180
+ accountStatus: number;
2181
+ type: number;
2182
+ };
2183
+ grCreatorInfo: {
2184
+ id: string;
2185
+ dName: string;
2186
+ zaloName: string;
2187
+ avatar: string;
2188
+ avatar_25: string;
2189
+ accountStatus: number;
2190
+ type: number;
2191
+ };
2192
+ expiredTs: string;
2193
+ type: number;
2194
+ };
2195
+ declare const getGroupInviteBoxInfoFactory: (ctx: ContextBase, api: API) => (payload: GetGroupInviteBoxInfoPayload) => Promise<GetGroupInviteBoxInfoResponse>;
2196
+
2197
+ type GetGroupInviteBoxListPayload = {
2198
+ mpage?: number;
2199
+ page?: number;
2200
+ invPerPage?: number;
2201
+ mcount?: number;
2202
+ };
2203
+ type GetGroupInviteBoxListResponse = {
2204
+ invitations: {
2205
+ groupInfo: GroupInfo;
2206
+ inviterInfo: {
2207
+ id: string;
2208
+ dName: string;
2209
+ zaloName: string;
2210
+ avatar: string;
2211
+ avatar_25: string;
2212
+ accountStatus: number;
2213
+ type: number;
2214
+ };
2215
+ grCreatorInfo: {
2216
+ id: string;
2217
+ dName: string;
2218
+ zaloName: string;
2219
+ avatar: string;
2220
+ avatar_25: string;
2221
+ accountStatus: number;
2222
+ type: number;
2223
+ };
2224
+ /**
2225
+ * Expired timestamp max 7 days
2226
+ */
2227
+ expiredTs: string;
2228
+ type: number;
2229
+ }[];
2230
+ total: number;
2231
+ hasMore: boolean;
2232
+ };
2233
+ declare const getGroupInviteBoxListFactory: (ctx: ContextBase, api: API) => (payload?: GetGroupInviteBoxListPayload) => Promise<GetGroupInviteBoxListResponse>;
2234
+
2235
+ type GetGroupLinkDetailResponse = {
2236
+ link?: string;
2237
+ expiration_date?: number;
2238
+ /**
2239
+ * 1: enabled, 0: disabled
2240
+ */
2241
+ enabled: number;
2242
+ };
2243
+ declare const getGroupLinkDetailFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<GetGroupLinkDetailResponse>;
2244
+
2245
+ type GetGroupLinkInfoPayload = {
2246
+ link: string;
2247
+ /**
2248
+ * Default: 1
2249
+ */
2250
+ memberPage?: number;
2251
+ };
2252
+ type GetGroupLinkInfoResponse = {
2253
+ groupId: string;
2254
+ name: string;
2255
+ desc: string;
2256
+ type: number;
2257
+ creatorId: string;
2258
+ avt: string;
2259
+ fullAvt: string;
2260
+ adminIds: string[];
2261
+ currentMems: {
2262
+ id: string;
2263
+ dName: string;
2264
+ zaloName: string;
2265
+ avatar: string;
2266
+ avatar_25: string;
2267
+ accountStatus: number;
2268
+ type: number;
2269
+ }[];
2270
+ admins: unknown[];
2271
+ hasMoreMember: number;
2272
+ subType: number;
2273
+ totalMember: number;
2274
+ setting: GroupSetting;
2275
+ globalId: string;
2276
+ };
2277
+ declare const getGroupLinkInfoFactory: (ctx: ContextBase, api: API) => (payload: GetGroupLinkInfoPayload) => Promise<GetGroupLinkInfoResponse>;
2278
+
2279
+ type GroupMemberProfile = {
2280
+ displayName: string;
2281
+ zaloName: string;
2282
+ avatar: string;
2283
+ accountStatus: number;
2284
+ type: number;
2285
+ lastUpdateTime: number;
2286
+ globalId: string;
2287
+ id: string;
2288
+ };
2289
+ type GetGroupMembersInfoResponse = {
2290
+ profiles: {
2291
+ [memberId: string]: GroupMemberProfile;
2292
+ };
2293
+ unchangeds_profile: unknown[];
2294
+ };
2295
+ declare const getGroupMembersInfoFactory: (ctx: ContextBase, api: API) => (memberId: string | string[]) => Promise<GetGroupMembersInfoResponse>;
2296
+
2297
+ type GetHiddenConversationsResponse = {
2298
+ pin: string;
2299
+ threads: {
2300
+ /**
2301
+ * 1: true, 0: false
2302
+ */
2303
+ is_group: number;
2304
+ thread_id: string;
2305
+ }[];
2306
+ };
2307
+ declare const getHiddenConversationsFactory: (ctx: ContextBase, api: API) => () => Promise<GetHiddenConversationsResponse>;
2308
+
2309
+ type GetLabelsResponse = {
2310
+ labelData: LabelData[];
2311
+ version: number;
2312
+ lastUpdateTime: number;
2313
+ };
2314
+ declare const getLabelsFactory: (ctx: ContextBase, api: API) => () => Promise<GetLabelsResponse>;
2315
+
2316
+ type ListBoardOptions = {
2317
+ /**
2318
+ * Page number (default: 1)
2319
+ */
2320
+ page?: number;
2321
+ /**
2322
+ * Number of items to retrieve (default: 20)
2323
+ */
2324
+ count?: number;
2325
+ };
2326
+ type BoardItem = {
2327
+ boardType: BoardType;
2328
+ data: PollDetail | NoteDetail | PinnedMessageDetail;
2329
+ };
2330
+ type GetListBoardResponse = {
2331
+ items: BoardItem[];
2332
+ count: number;
2333
+ };
2334
+ declare const getListBoardFactory: (ctx: ContextBase, api: API) => (options: ListBoardOptions, groupId: string) => Promise<GetListBoardResponse>;
2335
+
2336
+ type ListReminderOptions = {
2337
+ /**
2338
+ * Page number (default: 1)
2339
+ */
2340
+ page?: number;
2341
+ /**
2342
+ * Number of items to retrieve (default: 20)
2343
+ */
2344
+ count?: number;
2345
+ };
2346
+ type ReminderListUser = ReminderUser;
2347
+ type ReminderListGroup = ReminderGroup & {
2348
+ groupId: string;
2349
+ eventType: number;
2350
+ responseMem: {
2351
+ rejectMember: number;
2352
+ myResp: number;
2353
+ acceptMember: number;
2354
+ };
2355
+ repeatInfo: {
2356
+ list_ts: unknown[];
2357
+ };
2358
+ repeatData: unknown[];
2359
+ };
2360
+ type GetListReminderResponse = (ReminderListUser & ReminderListGroup)[];
2361
+ declare const getListReminderFactory: (ctx: ContextBase, api: API) => (options: ListReminderOptions, threadId: string, type?: ThreadType) => Promise<GetListReminderResponse>;
2362
+
2363
+ type MuteEntriesInfo = {
2364
+ id: string;
2365
+ duration: number;
2366
+ startTime: number;
2367
+ systemTime: number;
2368
+ currentTime: number;
2369
+ muteMode: number;
2370
+ };
2371
+ type GetMuteResponse = {
2372
+ chatEntries: MuteEntriesInfo[];
2373
+ groupChatEntries: MuteEntriesInfo[];
2374
+ };
2375
+ declare const getMuteFactory: (ctx: ContextBase, api: API) => () => Promise<GetMuteResponse>;
2376
+
2377
+ declare const getOwnIdFactory: (ctx: ContextBase, api: API) => () => string;
2378
+
2379
+ type GetPendingGroupMembersUserInfo = {
2380
+ uid: string;
2381
+ dpn: string;
2382
+ avatar: string;
2383
+ user_submit: null;
2384
+ };
2385
+ type GetPendingGroupMembersResponse = {
2386
+ time: number;
2387
+ users: GetPendingGroupMembersUserInfo[];
2388
+ };
2389
+ declare const getPendingGroupMembersFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<GetPendingGroupMembersResponse>;
2390
+
2391
+ type GetPinConversationsResponse = {
2392
+ conversations: string[];
2393
+ version: number;
2394
+ };
2395
+ declare const getPinConversationsFactory: (ctx: ContextBase, api: API) => () => Promise<GetPinConversationsResponse>;
2396
+
2397
+ type PollDetailResponse = PollDetail;
2398
+ declare const getPollDetailFactory: (ctx: ContextBase, api: API) => (pollId: number) => Promise<PollDetail>;
2399
+
2400
+ type GetProductCatalogListPayload = {
2401
+ catalogId: string;
2402
+ /**
2403
+ * Number of items to retrieve (default: 100)
2404
+ */
2405
+ limit?: number;
2406
+ versionCatalog?: number;
2407
+ lastProductId?: string;
2408
+ /**
2409
+ * Page number (default: 0)
2410
+ */
2411
+ page?: number;
2412
+ };
2413
+ type GetProductCatalogListResponse = {
2414
+ items: ProductCatalogItem[];
2415
+ version: number;
2416
+ has_more: number;
2417
+ };
2418
+ declare const getProductCatalogListFactory: (ctx: ContextBase, api: API) => (payload: GetProductCatalogListPayload) => Promise<GetProductCatalogListResponse>;
2419
+
2420
+ type GetQRResponse = {
2421
+ [userId: string]: string;
2422
+ };
2423
+ declare const getQRFactory: (ctx: ContextBase, api: API) => (userId: string | string[]) => Promise<GetQRResponse>;
2424
+
2425
+ type GetQuickMessageListResponse = {
2426
+ cursor: number;
2427
+ version: number;
2428
+ items: QuickMessage[];
2429
+ };
2430
+ declare const getQuickMessageListFactory: (ctx: ContextBase, api: API) => () => Promise<GetQuickMessageListResponse>;
2431
+
2432
+ type GetRelatedFriendGroupResponse = {
2433
+ groupRelateds: {
2434
+ [friendId: string]: string[];
2435
+ };
2436
+ };
2437
+ declare const getRelatedFriendGroupFactory: (ctx: ContextBase, api: API) => (friendId: string | string[]) => Promise<GetRelatedFriendGroupResponse>;
2438
+
2439
+ type GetReminderResponse = ReminderGroup;
2440
+ declare const getReminderFactory: (ctx: ContextBase, api: API) => (reminderId: string) => Promise<ReminderGroup>;
2441
+
2442
+ type GetReminderResponsesResponse = {
2443
+ rejectMember: string[];
2444
+ acceptMember: string[];
2445
+ };
2446
+ declare const getReminderResponsesFactory: (ctx: ContextBase, api: API) => (reminderId: string) => Promise<GetReminderResponsesResponse>;
2447
+
2448
+ type SentFriendRequestInfo = {
2449
+ userId: string;
2450
+ zaloName: string;
2451
+ displayName: string;
2452
+ avatar: string;
2453
+ globalId: string;
2454
+ bizPkg: ZBusinessPackage;
2455
+ fReqInfo: {
2456
+ message: string;
2457
+ src: number;
2458
+ time: number;
2459
+ };
2460
+ };
2461
+ type GetSentFriendRequestResponse = {
2462
+ [userId: string]: SentFriendRequestInfo;
2463
+ };
2464
+ declare const getSentFriendRequestFactory: (ctx: ContextBase, api: API) => () => Promise<GetSentFriendRequestResponse>;
2465
+
2466
+ type GetSettingsResponse = UserSetting;
2467
+ declare const getSettingsFactory: (ctx: ContextBase, api: API) => () => Promise<UserSetting>;
2468
+
2469
+ declare const getStickersFactory: (ctx: ContextBase, api: API) => (keyword: string) => Promise<number[]>;
2470
+
2471
+ type StickerDetail = {
2472
+ id: number;
2473
+ cateId: number;
2474
+ type: number;
2475
+ text: string;
2476
+ uri: string;
2477
+ fkey: number;
2478
+ status: number;
2479
+ stickerUrl: string;
2480
+ stickerSpriteUrl: string;
2481
+ stickerWebpUrl: unknown;
2482
+ totalFrames: number;
2483
+ duration: number;
2484
+ effectId: number;
2485
+ checksum: string;
2486
+ ext: number;
2487
+ source: number;
2488
+ fss: unknown;
2489
+ fssInfo: unknown;
2490
+ version: number;
2491
+ extInfo: unknown;
2492
+ };
2493
+ type StickerDetailResponse = StickerDetail[];
2494
+ declare const getStickersDetailFactory: (ctx: ContextBase, api: API) => (stickerIds: number | number[]) => Promise<StickerDetailResponse>;
2495
+
2496
+ type UnreadMark = {
2497
+ id: number;
2498
+ cliMsgId: number;
2499
+ fromUid: number;
2500
+ ts: number;
2501
+ };
2502
+ type GetUnreadMarkResponse = {
2503
+ data: {
2504
+ convsGroup: UnreadMark[];
2505
+ convsUser: UnreadMark[];
2506
+ };
2507
+ status: number;
2508
+ };
2509
+ declare const getUnreadMarkFactory: (ctx: ContextBase, api: API) => () => Promise<GetUnreadMarkResponse>;
2510
+
2511
+ type ProfileInfo = User;
2512
+ type UserInfoResponse = {
2513
+ unchanged_profiles: Record<string, unknown>;
2514
+ phonebook_version: number;
2515
+ changed_profiles: Record<string, ProfileInfo>;
2516
+ };
2517
+ declare const getUserInfoFactory: (ctx: ContextBase, api: API) => (userId: string | string[]) => Promise<UserInfoResponse>;
2518
+
2519
+ type InviteUserToGroupsResponse = {
2520
+ grid_message_map: {
2521
+ [groupId: string]: {
2522
+ error_code: number;
2523
+ error_message: string;
2524
+ data: string | null;
2525
+ };
2526
+ };
2527
+ };
2528
+ declare const inviteUserToGroupsFactory: (ctx: ContextBase, api: API) => (userId: string, groupId: string | string[]) => Promise<InviteUserToGroupsResponse>;
2529
+
2530
+ type JoinGroupInviteBoxResponse = "";
2531
+ declare const joinGroupInviteBoxFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<"">;
2532
+
2533
+ type JoinGroupLinkResponse = "";
2534
+ declare const joinGroupLinkFactory: (ctx: ContextBase, api: API) => (link: string) => Promise<"">;
2535
+
2536
+ type KeepAliveResponse = {
2537
+ config_vesion: number;
2538
+ };
2539
+ declare const keepAliveFactory: (ctx: ContextBase, api: API) => () => Promise<KeepAliveResponse>;
2540
+
2541
+ type LastOnlineResponse = {
2542
+ settings: {
2543
+ show_online_status: boolean;
2544
+ };
2545
+ lastOnline: number;
2546
+ };
2547
+ declare const lastOnlineFactory: (ctx: ContextBase, api: API) => (uid: string) => Promise<LastOnlineResponse>;
2548
+
2549
+ type LeaveGroupResponse = {
2550
+ memberError: unknown[];
2551
+ };
2552
+ declare const leaveGroupFactory: (ctx: ContextBase, api: API) => (groupId: string, silent?: boolean) => Promise<LeaveGroupResponse>;
2553
+
2554
+ type LockPollResponse = "";
2555
+ declare const lockPollFactory: (ctx: ContextBase, api: API) => (pollId: number) => Promise<"">;
2556
+
2557
+ type ParseLinkErrorMaps = Record<string, number>;
2558
+ type ParseLinkResponse = {
2559
+ data: {
2560
+ thumb: string;
2561
+ title: string;
2562
+ desc: string;
2563
+ src: string;
2564
+ href: string;
2565
+ media: {
2566
+ type: number;
2567
+ count: number;
2568
+ mediaTitle: string;
2569
+ artist: string;
2570
+ streamUrl: string;
2571
+ stream_icon: string;
2572
+ };
2573
+ stream_icon: string;
2574
+ };
2575
+ error_maps: ParseLinkErrorMaps;
2576
+ };
2577
+ declare const parseLinkFactory: (ctx: ContextBase, api: API) => (link: string) => Promise<ParseLinkResponse>;
2578
+
2579
+ type RejectFriendRequestResponse = "";
2580
+ declare const rejectFriendRequestFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2581
+
2582
+ type RemoveFriendResponse = "";
2583
+ declare const removeFriendFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2584
+
2585
+ type RemoveFriendAliasResponse = "";
2586
+ declare const removeFriendAliasFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2587
+
2588
+ type RemoveGroupBlockedMemberResponse = "";
2589
+ declare const removeGroupBlockedMemberFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<"">;
2590
+
2591
+ type RemoveGroupDeputyResponse = "";
2592
+ declare const removeGroupDeputyFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<"">;
2593
+
2594
+ type RemoveQuickMessageResponse = {
2595
+ itemIds: number[];
2596
+ version: number;
2597
+ };
2598
+ declare const removeQuickMessageFactory: (ctx: ContextBase, api: API) => (itemIds: number | number[]) => Promise<RemoveQuickMessageResponse>;
2599
+
2600
+ type RemoveReminderResponse = "" | number;
2601
+ declare const removeReminderFactory: (ctx: ContextBase, api: API) => (reminderId: string, threadId: string, type?: ThreadType) => Promise<RemoveReminderResponse>;
2602
+
2603
+ type RemoveUnreadMarkResponse = {
2604
+ data: {
2605
+ updateId: number;
2606
+ };
2607
+ status: number;
2608
+ };
2609
+ declare const removeUnreadMarkFactory: (ctx: ContextBase, api: API) => (threadId: string, type?: ThreadType) => Promise<RemoveUnreadMarkResponse>;
2610
+
2611
+ type RemoveUserFromGroupResponse = {
2612
+ errorMembers: string[];
2613
+ };
2614
+ declare const removeUserFromGroupFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<RemoveUserFromGroupResponse>;
2615
+
2616
+ type ResetHiddenConversPinResponse = "";
2617
+ declare const resetHiddenConversPinFactory: (ctx: ContextBase, api: API) => () => Promise<"">;
2618
+
2619
+ type ReuseAvatarResponse = null;
2620
+ declare const reuseAvatarFactory: (ctx: ContextBase, api: API) => (photoId: string) => Promise<null>;
2621
+
2622
+ type ReviewPendingMemberRequestPayload = {
2623
+ members: string | string[];
2624
+ isApprove: boolean;
2625
+ };
2626
+ declare enum ReviewPendingMemberRequestStatus {
2627
+ SUCCESS = 0,
2628
+ NOT_IN_PENDING_LIST = 170,
2629
+ ALREADY_IN_GROUP = 178,
2630
+ INSUFFICIENT_PERMISSION = 166
2631
+ }
2632
+ type ReviewPendingMemberRequestResponse = {
2633
+ [memberId: string]: ReviewPendingMemberRequestStatus;
2634
+ };
2635
+ declare const reviewPendingMemberRequestFactory: (ctx: ContextBase, api: API) => (payload: ReviewPendingMemberRequestPayload, groupId: string) => Promise<ReviewPendingMemberRequestResponse>;
2636
+
2637
+ type SendBankCardPayload = {
2638
+ binBank: BinBankCard;
2639
+ numAccBank: string;
2640
+ nameAccBank?: string;
2641
+ };
2642
+ type SendBankCardResponse = "";
2643
+ declare const sendBankCardFactory: (ctx: ContextBase, api: API) => (payload: SendBankCardPayload, threadId: string, type?: ThreadType) => Promise<"">;
2644
+
2645
+ type SendCardOptions = {
2646
+ userId: string;
2647
+ phoneNumber?: string;
2648
+ ttl?: number;
2649
+ };
2650
+ type SendCardResponse = {
2651
+ msgId: number;
2652
+ };
2653
+ declare const sendCardFactory: (ctx: ContextBase, api: API) => (options: SendCardOptions, threadId: string, type?: ThreadType) => Promise<SendCardResponse>;
2654
+
2655
+ type SendDeliveredEventResponse = "" | {
2656
+ status: number;
2657
+ };
2658
+ type SendDeliveredEventMessageParams = {
2659
+ msgId: string;
2660
+ cliMsgId: string;
2661
+ uidFrom: string;
2662
+ idTo: string;
2663
+ msgType: string;
2664
+ st: number;
2665
+ at: number;
2666
+ cmd: number;
2667
+ ts: string | number;
2668
+ };
2669
+ declare const sendDeliveredEventFactory: (ctx: ContextBase, api: API) => (isSeen: boolean, messages: SendDeliveredEventMessageParams | SendDeliveredEventMessageParams[], type?: ThreadType) => Promise<SendDeliveredEventResponse>;
2670
+
2671
+ type SendFriendRequestResponse = "";
2672
+ declare const sendFriendRequestFactory: (ctx: ContextBase, api: API) => (msg: string, userId: string) => Promise<"">;
2673
+
2674
+ type SendLinkOptions = {
2675
+ msg?: string;
2676
+ link: string;
2677
+ ttl?: number;
2678
+ };
2679
+ type SendLinkResponse = {
2680
+ msgId: string;
2681
+ };
2682
+ declare const sendLinkFactory: (ctx: ContextBase, api: API) => (options: SendLinkOptions, threadId: string, type?: ThreadType) => Promise<SendLinkResponse>;
2683
+
2684
+ type SendMessageResult = {
2685
+ msgId: number;
2686
+ };
2687
+ type SendMessageResponse = {
2688
+ message: SendMessageResult | null;
2689
+ attachment: SendMessageResult[];
2690
+ };
2691
+ type SendMessageQuote = {
2692
+ content: TMessage["content"];
2693
+ msgType: TMessage["msgType"];
2694
+ propertyExt: TMessage["propertyExt"];
2695
+ uidFrom: TMessage["uidFrom"];
2696
+ msgId: TMessage["msgId"];
2697
+ cliMsgId: TMessage["cliMsgId"];
2698
+ ts: TMessage["ts"];
2699
+ ttl: TMessage["ttl"];
2700
+ };
2701
+ declare enum TextStyle {
2702
+ Bold = "b",
2703
+ Italic = "i",
2704
+ Underline = "u",
2705
+ StrikeThrough = "s",
2706
+ Red = "c_db342e",
2707
+ Orange = "c_f27806",
2708
+ Yellow = "c_f7b503",
2709
+ Green = "c_15a85f",
2710
+ Small = "f_13",
2711
+ Big = "f_18",
2712
+ UnorderedList = "lst_1",
2713
+ OrderedList = "lst_2",
2714
+ Indent = "ind_$"
2715
+ }
2716
+ type Style = {
2717
+ start: number;
2718
+ len: number;
2719
+ st: Exclude<TextStyle, TextStyle.Indent>;
2720
+ } | {
2721
+ start: number;
2722
+ len: number;
2723
+ st: TextStyle.Indent;
2724
+ /**
2725
+ * Number of spaces used for indentation.
2726
+ */
2727
+ indentSize?: number;
2728
+ };
2729
+ declare enum Urgency {
2730
+ Default = 0,
2731
+ Important = 1,
2732
+ Urgent = 2
2733
+ }
2734
+ type Mention = {
2735
+ /**
2736
+ * mention position
2737
+ */
2738
+ pos: number;
2739
+ /**
2740
+ * id of the mentioned user
2741
+ */
2742
+ uid: string;
2743
+ /**
2744
+ * length of the mention
2745
+ */
2746
+ len: number;
2747
+ };
2748
+ type MessageContent = {
2749
+ /**
2750
+ * Text content of the message
2751
+ */
2752
+ msg: string;
2753
+ /**
2754
+ * Text styles
2755
+ */
2756
+ styles?: Style[];
2757
+ /**
2758
+ * Urgency of the message
2759
+ */
2760
+ urgency?: Urgency;
2761
+ /**
2762
+ * Quoted message (optional)
2763
+ */
2764
+ quote?: SendMessageQuote;
2765
+ /**
2766
+ * Mentions in the message (optional)
2767
+ */
2768
+ mentions?: Mention[];
2769
+ /**
2770
+ * Attachments in the message (optional)
2771
+ */
2772
+ attachments?: AttachmentSource | AttachmentSource[];
2773
+ /**
2774
+ * Time to live in milliseconds
2775
+ */
2776
+ ttl?: number;
2777
+ };
2778
+ declare const sendMessageFactory: (ctx: ContextBase, api: API) => (message: MessageContent | string, threadId: string, type?: ThreadType) => Promise<{
2779
+ message: SendMessageResult | null;
2780
+ attachment: SendMessageResult[];
2781
+ }>;
2782
+
2783
+ declare enum ReportReason {
2784
+ Sensitive = 1,
2785
+ Annoy = 2,
2786
+ Fraud = 3,
2787
+ Other = 0
2788
+ }
2789
+ type SendReportOptions = {
2790
+ reason: ReportReason.Other;
2791
+ content: string;
2792
+ } | {
2793
+ reason: Exclude<ReportReason, ReportReason.Other>;
2794
+ };
2795
+ type SendReportResponse = {
2796
+ reportId: string;
2797
+ };
2798
+ declare const sendReportFactory: (ctx: ContextBase, api: API) => (options: SendReportOptions, threadId: string, type?: ThreadType) => Promise<SendReportResponse>;
2799
+
2800
+ type SendSeenEventResponse = {
2801
+ status: number;
2802
+ };
2803
+ type SendSeenEventMessageParams = {
2804
+ msgId: string;
2805
+ cliMsgId: string;
2806
+ uidFrom: string;
2807
+ idTo: string;
2808
+ msgType: string;
2809
+ st: number;
2810
+ at: number;
2811
+ cmd: number;
2812
+ ts: string | number;
2813
+ };
2814
+ declare const sendSeenEventFactory: (ctx: ContextBase, api: API) => (messages: SendSeenEventMessageParams | SendSeenEventMessageParams[], type?: ThreadType) => Promise<SendSeenEventResponse>;
2815
+
2816
+ type SendStickerPayload = {
2817
+ id: number;
2818
+ cateId: number;
2819
+ type: number;
2820
+ };
2821
+ type SendStickerResponse = {
2822
+ msgId: number;
2823
+ };
2824
+ declare const sendStickerFactory: (ctx: ContextBase, api: API) => (sticker: SendStickerPayload, threadId: string, type?: ThreadType) => Promise<SendStickerResponse>;
2825
+
2826
+ type SendTypingEventResponse = {
2827
+ status: number;
2828
+ };
2829
+ declare const sendTypingEventFactory: (ctx: ContextBase, api: API) => (threadId: string, type?: ThreadType, destType?: DestType) => Promise<SendTypingEventResponse>;
2830
+
2831
+ type SendVideoOptions = {
2832
+ /**
2833
+ * Optional message to send along with the video
2834
+ */
2835
+ msg?: string;
2836
+ /**
2837
+ * URL of the video
2838
+ */
2839
+ videoUrl: string;
2840
+ /**
2841
+ * URL of the thumbnail
2842
+ */
2843
+ thumbnailUrl: string;
2844
+ /**
2845
+ * Video duration in milliseconds || Eg: video duration: 5.5s => 5.5 * 1000 = 5500
2846
+ */
2847
+ duration?: number;
2848
+ /**
2849
+ * Width of the video
2850
+ */
2851
+ width?: number;
2852
+ /**
2853
+ * Height of the video
2854
+ */
2855
+ height?: number;
2856
+ /**
2857
+ * Time to live in milliseconds (default: 0)
2858
+ */
2859
+ ttl?: number;
2860
+ };
2861
+ type SendVideoResponse = {
2862
+ msgId: number;
2863
+ };
2864
+ declare const sendVideoFactory: (ctx: ContextBase, api: API) => (options: SendVideoOptions, threadId: string, type?: ThreadType) => Promise<SendVideoResponse>;
2865
+
2866
+ type SendVoiceOptions = {
2867
+ voiceUrl: string;
2868
+ /**
2869
+ * Time to live in milliseconds (default: 0)
2870
+ */
2871
+ ttl?: number;
2872
+ };
2873
+ type SendVoiceResponse = {
2874
+ msgId: string;
2875
+ };
2876
+ declare const sendVoiceFactory: (ctx: ContextBase, api: API) => (options: SendVoiceOptions, threadId: string, type?: ThreadType) => Promise<SendVoiceResponse>;
2877
+
2878
+ type SetHiddenConversationsResponse = "";
2879
+ declare const setHiddenConversationsFactory: (ctx: ContextBase, api: API) => (hidden: boolean, threadId: string | string[], type?: ThreadType) => Promise<"">;
2880
+
2881
+ type SetMuteParams = {
2882
+ /**
2883
+ * Mute duration in seconds or predefined durations
2884
+ */
2885
+ duration?: MuteDuration | number;
2886
+ action?: MuteAction;
2887
+ };
2888
+ type SetMuteResponse = "";
2889
+ declare enum MuteDuration {
2890
+ ONE_HOUR = 3600,
2891
+ FOUR_HOURS = 14400,
2892
+ FOREVER = -1,
2893
+ UNTIL_8AM = "until8AM"
2894
+ }
2895
+ declare enum MuteAction {
2896
+ MUTE = 1,
2897
+ UNMUTE = 3
2898
+ }
2899
+ declare const setMuteFactory: (ctx: ContextBase, api: API) => (params: SetMuteParams | undefined, threadID: string, type?: ThreadType) => Promise<"">;
2900
+
2901
+ type SetPinnedConversationsResponse = "";
2902
+ declare const setPinnedConversationsFactory: (ctx: ContextBase, api: API) => (pinned: boolean, threadId: string | string[], type?: ThreadType) => Promise<"">;
2903
+
2904
+ type SharePollResponse = "";
2905
+ declare const sharePollFactory: (ctx: ContextBase, api: API) => (pollId: number) => Promise<"">;
2906
+
2907
+ type UnBlockUserResponse = "";
2908
+ declare const unblockUserFactory: (ctx: ContextBase, api: API) => (userId: string) => Promise<"">;
2909
+
2910
+ type UndoPayload = {
2911
+ msgId: string | number;
2912
+ cliMsgId: string | number;
2913
+ };
2914
+ type UndoResponse = {
2915
+ status: number;
2916
+ };
2917
+ declare const undoFactory: (ctx: ContextBase, api: API) => (payload: UndoPayload, threadId: string, type?: ThreadType) => Promise<UndoResponse>;
2918
+
2919
+ type UndoFriendRequestResponse = "";
2920
+ declare const undoFriendRequestFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2921
+
2922
+ type UpdateActiveStatusResponse = {
2923
+ status: boolean;
2924
+ };
2925
+ declare const updateActiveStatusFactory: (ctx: ContextBase, api: API) => (active: boolean) => Promise<UpdateActiveStatusResponse>;
2926
+
2927
+ declare enum ChatTTL {
2928
+ NO_DELETE = 0,
2929
+ ONE_DAY = 86400000,
2930
+ SEVEN_DAYS = 604800000,
2931
+ FOURTEEN_DAYS = 1209600000
2932
+ }
2933
+ type UpdateAutoDeleteChatResponse = "";
2934
+ declare const updateAutoDeleteChatFactory: (ctx: ContextBase, api: API) => (ttl: ChatTTL, threadId: string, type?: ThreadType) => Promise<"">;
2935
+
2936
+ type UpdateAutoReplyPayload = {
2937
+ id: number;
2938
+ content: string;
2939
+ isEnable: boolean;
2940
+ startTime: number;
2941
+ endTime: number;
2942
+ scope: AutoReplyScope;
2943
+ uids?: string | string[];
2944
+ };
2945
+ type UpdateAutoReplyResponse = {
2946
+ item: AutoReplyItem;
2947
+ version: number;
2948
+ };
2949
+ declare const updateAutoReplyFactory: (ctx: ContextBase, api: API) => (payload: UpdateAutoReplyPayload) => Promise<UpdateAutoReplyResponse>;
2950
+
2951
+ type UpdateCatalogPayload = {
2952
+ catalogId: string;
2953
+ catalogName: string;
2954
+ };
2955
+ type UpdateCatalogResponse = {
2956
+ item: CatalogItem;
2957
+ version_ls_catalog: number;
2958
+ version_catalog: number;
2959
+ };
2960
+ declare const updateCatalogFactory: (ctx: ContextBase, api: API) => (payload: UpdateCatalogPayload) => Promise<UpdateCatalogResponse>;
2961
+
2962
+ type UpdateGroupSettingsOptions = {
2963
+ /**
2964
+ * Disallow group members to change the group name and avatar
2965
+ */
2966
+ blockName?: boolean;
2967
+ /**
2968
+ * Highlight messages from owner/admins
2969
+ */
2970
+ signAdminMsg?: boolean;
2971
+ /**
2972
+ * Don't pin messages, notes, and polls to the top of a conversation
2973
+ */
2974
+ setTopicOnly?: boolean;
2975
+ /**
2976
+ * Allow new members to read most recent messages
2977
+ */
2978
+ enableMsgHistory?: boolean;
2979
+ /**
2980
+ * Membership approval
2981
+ */
2982
+ joinAppr?: boolean;
2983
+ /**
2984
+ * Disallow group members to create notes & reminders
2985
+ */
2986
+ lockCreatePost?: boolean;
2987
+ /**
2988
+ * Disallow group members to create polls
2989
+ */
2990
+ lockCreatePoll?: boolean;
2991
+ /**
2992
+ * Disallow group members to send messages
2993
+ */
2994
+ lockSendMsg?: boolean;
2995
+ /**
2996
+ * Disallow group members to view full member list (community only)
2997
+ */
2998
+ lockViewMember?: boolean;
2999
+ };
3000
+ type UpdateGroupSettingsResponse = "";
3001
+ declare const updateGroupSettingsFactory: (ctx: ContextBase, api: API) => (options: UpdateGroupSettingsOptions, groupId: string) => Promise<"">;
3002
+
3003
+ type UpdateHiddenConversPinResponse = "";
3004
+ declare const updateHiddenConversPinFactory: (ctx: ContextBase, api: API) => (pin: string) => Promise<"">;
3005
+
3006
+ type UpdateLabelsPayload = {
3007
+ labelData: LabelData[];
3008
+ version: number;
3009
+ };
3010
+ type UpdateLabelsResponse = {
3011
+ labelData: LabelData[];
3012
+ version: number;
3013
+ lastUpdateTime: number;
3014
+ };
3015
+ declare const updateLabelsFactory: (ctx: ContextBase, api: API) => (payload: UpdateLabelsPayload) => Promise<{
3016
+ labelData: any;
3017
+ version: number;
3018
+ lastUpdateTime: number;
3019
+ }>;
3020
+
3021
+ declare enum UpdateLangAvailableLanguages {
3022
+ VI = "VI",
3023
+ EN = "EN"
3024
+ }
3025
+ type UpdateLangResponse = "";
3026
+ declare const updateLangFactory: (ctx: ContextBase, api: API) => (language?: UpdateLangAvailableLanguages) => Promise<"">;
3027
+
3028
+ type UpdateProductCatalogPayload = {
3029
+ catalogId: string;
3030
+ productId: string;
3031
+ productName: string;
3032
+ price: string;
3033
+ description: string;
3034
+ createTime: number;
3035
+ /**
3036
+ * Upto 5 media files are allowed, will be ignored if product_photos is provided
3037
+ */
3038
+ files?: AttachmentSource[];
3039
+ /**
3040
+ * List of product photo URLs, upto 5
3041
+ *
3042
+ * You can manually get the URL using `uploadProductPhoto` api
3043
+ */
3044
+ product_photos?: string[];
3045
+ };
3046
+ type UpdateProductCatalogResponse = {
3047
+ item: ProductCatalogItem;
3048
+ version_ls_catalog: number;
3049
+ version_catalog: number;
3050
+ };
3051
+ declare const updateProductCatalogFactory: (ctx: ContextBase, api: API) => (payload: UpdateProductCatalogPayload) => Promise<UpdateProductCatalogResponse>;
3052
+
3053
+ type UpdateProfilePayload = {
3054
+ profile: {
3055
+ name: string;
3056
+ /**
3057
+ * Date of birth in the format YYYY-MM-DD
3058
+ */
3059
+ dob: `${string}-${string}-${string}`;
3060
+ gender: Gender;
3061
+ };
3062
+ biz?: Partial<{
3063
+ cate: BusinessCategory;
3064
+ description: string;
3065
+ address: string;
3066
+ website: string;
3067
+ email: string;
3068
+ }>;
3069
+ };
3070
+ type UpdateProfileResponse = "";
3071
+ declare const updateProfileFactory: (ctx: ContextBase, api: API) => (payload: UpdateProfilePayload) => Promise<"">;
3072
+
3073
+ type UpdateQuickMessagePayload = {
3074
+ keyword: string;
3075
+ title: string;
3076
+ media?: AttachmentSource;
3077
+ };
3078
+ type UpdateQuickMessageResponse = {
3079
+ item: QuickMessage;
3080
+ version: number;
3081
+ };
3082
+ declare const updateQuickMessageFactory: (ctx: ContextBase, api: API) => (updatePayload: UpdateQuickMessagePayload, itemId: number) => Promise<UpdateQuickMessageResponse>;
3083
+
3084
+ type UpdateSettingsResponse = "";
3085
+ declare enum UpdateSettingsType {
3086
+ ViewBirthday = "view_birthday",
3087
+ ShowOnlineStatus = "show_online_status",
3088
+ DisplaySeenStatus = "display_seen_status",
3089
+ ReceiveMessage = "receive_message",
3090
+ AcceptCall = "accept_stranger_call",
3091
+ AddFriendViaPhone = "add_friend_via_phone",
3092
+ AddFriendViaQR = "add_friend_via_qr",
3093
+ AddFriendViaGroup = "add_friend_via_group",
3094
+ AddFriendViaContact = "add_friend_via_contact",
3095
+ DisplayOnRecommendFriend = "display_on_recommend_friend",
3096
+ ArchivedChat = "archivedChatStatus",
3097
+ QuickMessage = "quickMessageStatus"
3098
+ }
3099
+ declare const updateSettingsFactory: (ctx: ContextBase, api: API) => (type: UpdateSettingsType, value: number) => Promise<"">;
3100
+
3101
+ type UploadAttachmentImageResponse = {
3102
+ normalUrl: string;
3103
+ photoId: string;
3104
+ finished: number | boolean;
3105
+ hdUrl: string;
3106
+ thumbUrl: string;
3107
+ clientFileId: number;
3108
+ chunkId: number;
3109
+ fileType: "image";
3110
+ width: number;
3111
+ height: number;
3112
+ totalSize: number;
3113
+ hdSize: number;
3114
+ };
3115
+ type UploadAttachmentVideoResponse = {
3116
+ finished: number | boolean;
3117
+ clientFileId: number;
3118
+ chunkId: number;
3119
+ fileType: "video";
3120
+ fileUrl: string;
3121
+ fileId: string;
3122
+ checksum: string;
3123
+ totalSize: number;
3124
+ fileName: string;
3125
+ };
3126
+ type UploadAttachmentFileResponse = {
3127
+ finished: number | boolean;
3128
+ clientFileId: number;
3129
+ chunkId: number;
3130
+ fileType: "others";
3131
+ fileUrl: string;
3132
+ fileId: string;
3133
+ checksum: string;
3134
+ totalSize: number;
3135
+ fileName: string;
3136
+ };
3137
+ type ImageData = {
3138
+ fileName: string;
3139
+ totalSize: number | undefined;
3140
+ width: number | undefined;
3141
+ height: number | undefined;
3142
+ };
3143
+ type FileData = {
3144
+ fileName: string;
3145
+ totalSize: number;
3146
+ };
3147
+ type UploadAttachmentType = UploadAttachmentImageResponse | UploadAttachmentVideoResponse | UploadAttachmentFileResponse;
3148
+ type UploadAttachmentResponse = UploadAttachmentType[];
3149
+ declare const uploadAttachmentFactory: (ctx: ContextBase, api: API) => (sources: AttachmentSource | AttachmentSource[], threadId: string, type?: ThreadType) => Promise<UploadAttachmentType[]>;
3150
+
3151
+ type UploadProductPhotoPayload = {
3152
+ file: AttachmentSource;
3153
+ };
3154
+ type UploadProductPhotoResponse = {
3155
+ normalUrl: string;
3156
+ photoId: string;
3157
+ finished: number;
3158
+ hdUrl: string;
3159
+ thumbUrl: string;
3160
+ clientFileId: number;
3161
+ chunkId: number;
3162
+ };
3163
+ declare const uploadProductPhotoFactory: (ctx: ContextBase, api: API) => (payload: UploadProductPhotoPayload) => Promise<UploadProductPhotoResponse>;
3164
+
3165
+ type VotePollResponse = {
3166
+ options: PollOptions[];
3167
+ };
3168
+ declare const votePollFactory: (ctx: ContextBase, api: API) => (pollId: number, optionId: number | number[]) => Promise<VotePollResponse>;
3169
+
3170
+ /**
3171
+ *
3172
+ * @param baseURL
3173
+ * @param params
3174
+ * @param apiVersion automatically add zalo api version to url params
3175
+ * @returns
3176
+ *
3177
+ */
3178
+ declare function makeURL(ctx: ContextBase, baseURL: string, params?: Record<string, string | number>, apiVersion?: boolean): string;
3179
+ declare function encodeAES(secretKey: string, data: cryptojs.lib.WordArray | string, t?: number): string | null;
3180
+ declare function request(ctx: ContextBase, url: string, options?: RequestInit, raw?: boolean): Promise<Response>;
3181
+ declare const logger: (ctx: {
3182
+ options: {
3183
+ logging?: boolean;
3184
+ };
3185
+ }) => {
3186
+ verbose: (...args: unknown[]) => void;
3187
+ info: (...args: unknown[]) => void;
3188
+ warn: (...args: unknown[]) => void;
3189
+ error: (...args: unknown[]) => void;
3190
+ success: (...args: unknown[]) => void;
3191
+ timestamp: (...args: unknown[]) => void;
3192
+ };
3193
+ type ZaloResponse<T> = {
3194
+ data: T | null;
3195
+ error: {
3196
+ message: string;
3197
+ code?: number;
3198
+ } | null;
3199
+ };
3200
+ declare function resolveResponse<T = unknown>(ctx: ContextSession, res: Response, cb?: (result: ZaloResponse<unknown>) => T, isEncrypted?: boolean): Promise<T>;
3201
+ type FactoryUtils<T> = {
3202
+ makeURL: (baseURL: string, params?: Record<string, string | number>, apiVersion?: boolean) => ReturnType<typeof makeURL>;
3203
+ encodeAES: (data: cryptojs.lib.WordArray | string, t?: number) => ReturnType<typeof encodeAES>;
3204
+ request: (url: string, options?: RequestInit, raw?: boolean) => ReturnType<typeof request>;
3205
+ logger: ReturnType<typeof logger>;
3206
+ resolve: (res: Response, cb?: (result: ZaloResponse<unknown>) => T, isEncrypted?: boolean) => ReturnType<typeof resolveResponse<T>>;
3207
+ };
3208
+
3209
+ type CustomAPIProps<T, K> = {
3210
+ ctx: ContextSession;
3211
+ utils: FactoryUtils<T>;
3212
+ props: K;
3213
+ };
3214
+ type CustomAPICallback<T, K> = (props: CustomAPIProps<T, K>) => T | Promise<T>;
3215
+ declare const customFactory: (ctx: ContextBase, api: API) => <T, K = any>(name: string, callback: CustomAPICallback<T, K>) => void;
3216
+
3217
+ declare class API {
3218
+ zpwServiceMap: ZPWServiceMap;
3219
+ listener: Listener;
3220
+ acceptFriendRequest: ReturnType<typeof acceptFriendRequestFactory>;
3221
+ addGroupBlockedMember: ReturnType<typeof addGroupBlockedMemberFactory>;
3222
+ addGroupDeputy: ReturnType<typeof addGroupDeputyFactory>;
3223
+ addPollOptions: ReturnType<typeof addPollOptionsFactory>;
3224
+ addQuickMessage: ReturnType<typeof addQuickMessageFactory>;
3225
+ addReaction: ReturnType<typeof addReactionFactory>;
3226
+ addUnreadMark: ReturnType<typeof addUnreadMarkFactory>;
3227
+ addUserToGroup: ReturnType<typeof addUserToGroupFactory>;
3228
+ blockUser: ReturnType<typeof blockUserFactory>;
3229
+ blockViewFeed: ReturnType<typeof blockViewFeedFactory>;
3230
+ changeAccountAvatar: ReturnType<typeof changeAccountAvatarFactory>;
3231
+ changeFriendAlias: ReturnType<typeof changeFriendAliasFactory>;
3232
+ changeGroupAvatar: ReturnType<typeof changeGroupAvatarFactory>;
3233
+ changeGroupName: ReturnType<typeof changeGroupNameFactory>;
3234
+ changeGroupOwner: ReturnType<typeof changeGroupOwnerFactory>;
3235
+ createAutoReply: ReturnType<typeof createAutoReplyFactory>;
3236
+ createCatalog: ReturnType<typeof createCatalogFactory>;
3237
+ createGroup: ReturnType<typeof createGroupFactory>;
3238
+ createNote: ReturnType<typeof createNoteFactory>;
3239
+ createPoll: ReturnType<typeof createPollFactory>;
3240
+ createProductCatalog: ReturnType<typeof createProductCatalogFactory>;
3241
+ createReminder: ReturnType<typeof createReminderFactory>;
3242
+ deleteAutoReply: ReturnType<typeof deleteAutoReplyFactory>;
3243
+ deleteAvatar: ReturnType<typeof deleteAvatarFactory>;
3244
+ deleteCatalog: ReturnType<typeof deleteCatalogFactory>;
3245
+ deleteChat: ReturnType<typeof deleteChatFactory>;
3246
+ deleteGroupInviteBox: ReturnType<typeof deleteGroupInviteBoxFactory>;
3247
+ deleteMessage: ReturnType<typeof deleteMessageFactory>;
3248
+ deleteProductCatalog: ReturnType<typeof deleteProductCatalogFactory>;
3249
+ disableGroupLink: ReturnType<typeof disableGroupLinkFactory>;
3250
+ disperseGroup: ReturnType<typeof disperseGroupFactory>;
3251
+ editNote: ReturnType<typeof editNoteFactory>;
3252
+ editReminder: ReturnType<typeof editReminderFactory>;
3253
+ enableGroupLink: ReturnType<typeof enableGroupLinkFactory>;
3254
+ fetchAccountInfo: ReturnType<typeof fetchAccountInfoFactory>;
3255
+ findUser: ReturnType<typeof findUserFactory>;
3256
+ forwardMessage: ReturnType<typeof forwardMessageFactory>;
3257
+ getAliasList: ReturnType<typeof getAliasListFactory>;
3258
+ getAllFriends: ReturnType<typeof getAllFriendsFactory>;
3259
+ getAllGroups: ReturnType<typeof getAllGroupsFactory>;
3260
+ getArchivedChatList: ReturnType<typeof getArchivedChatListFactory>;
3261
+ getAutoDeleteChat: ReturnType<typeof getAutoDeleteChatFactory>;
3262
+ getAutoReplyList: ReturnType<typeof getAutoReplyListFactory>;
3263
+ getAvatarList: ReturnType<typeof getAvatarListFactory>;
3264
+ getBizAccount: ReturnType<typeof getBizAccountFactory>;
3265
+ getCatalogList: ReturnType<typeof getCatalogListFactory>;
3266
+ getContext: ReturnType<typeof getContextFactory>;
3267
+ getCookie: ReturnType<typeof getCookieFactory>;
3268
+ getFriendBoardList: ReturnType<typeof getFriendBoardListFactory>;
3269
+ getFriendOnlines: ReturnType<typeof getFriendOnlinesFactory>;
3270
+ getFriendRecommendations: ReturnType<typeof getFriendRecommendationsFactory>;
3271
+ getFriendRequestStatus: ReturnType<typeof getFriendRequestStatusFactory>;
3272
+ getGroupBlockedMember: ReturnType<typeof getGroupBlockedMemberFactory>;
3273
+ getGroupInfo: ReturnType<typeof getGroupInfoFactory>;
3274
+ getGroupInviteBoxInfo: ReturnType<typeof getGroupInviteBoxInfoFactory>;
3275
+ getGroupInviteBoxList: ReturnType<typeof getGroupInviteBoxListFactory>;
3276
+ getGroupLinkDetail: ReturnType<typeof getGroupLinkDetailFactory>;
3277
+ getGroupLinkInfo: ReturnType<typeof getGroupLinkInfoFactory>;
3278
+ getGroupMembersInfo: ReturnType<typeof getGroupMembersInfoFactory>;
3279
+ getHiddenConversations: ReturnType<typeof getHiddenConversationsFactory>;
3280
+ getLabels: ReturnType<typeof getLabelsFactory>;
3281
+ getListBoard: ReturnType<typeof getListBoardFactory>;
3282
+ getListReminder: ReturnType<typeof getListReminderFactory>;
3283
+ getMute: ReturnType<typeof getMuteFactory>;
3284
+ getOwnId: ReturnType<typeof getOwnIdFactory>;
3285
+ getPendingGroupMembers: ReturnType<typeof getPendingGroupMembersFactory>;
3286
+ getPinConversations: ReturnType<typeof getPinConversationsFactory>;
3287
+ getPollDetail: ReturnType<typeof getPollDetailFactory>;
3288
+ getProductCatalogList: ReturnType<typeof getProductCatalogListFactory>;
3289
+ getQR: ReturnType<typeof getQRFactory>;
3290
+ getQuickMessageList: ReturnType<typeof getQuickMessageListFactory>;
3291
+ getRelatedFriendGroup: ReturnType<typeof getRelatedFriendGroupFactory>;
3292
+ getReminder: ReturnType<typeof getReminderFactory>;
3293
+ getReminderResponses: ReturnType<typeof getReminderResponsesFactory>;
3294
+ getSentFriendRequest: ReturnType<typeof getSentFriendRequestFactory>;
3295
+ getSettings: ReturnType<typeof getSettingsFactory>;
3296
+ getStickers: ReturnType<typeof getStickersFactory>;
3297
+ getStickersDetail: ReturnType<typeof getStickersDetailFactory>;
3298
+ getUnreadMark: ReturnType<typeof getUnreadMarkFactory>;
3299
+ getUserInfo: ReturnType<typeof getUserInfoFactory>;
3300
+ inviteUserToGroups: ReturnType<typeof inviteUserToGroupsFactory>;
3301
+ joinGroupInviteBox: ReturnType<typeof joinGroupInviteBoxFactory>;
3302
+ joinGroupLink: ReturnType<typeof joinGroupLinkFactory>;
3303
+ keepAlive: ReturnType<typeof keepAliveFactory>;
3304
+ lastOnline: ReturnType<typeof lastOnlineFactory>;
3305
+ leaveGroup: ReturnType<typeof leaveGroupFactory>;
3306
+ lockPoll: ReturnType<typeof lockPollFactory>;
3307
+ parseLink: ReturnType<typeof parseLinkFactory>;
3308
+ rejectFriendRequest: ReturnType<typeof rejectFriendRequestFactory>;
3309
+ removeFriend: ReturnType<typeof removeFriendFactory>;
3310
+ removeFriendAlias: ReturnType<typeof removeFriendAliasFactory>;
3311
+ removeGroupBlockedMember: ReturnType<typeof removeGroupBlockedMemberFactory>;
3312
+ removeGroupDeputy: ReturnType<typeof removeGroupDeputyFactory>;
3313
+ removeQuickMessage: ReturnType<typeof removeQuickMessageFactory>;
3314
+ removeReminder: ReturnType<typeof removeReminderFactory>;
3315
+ removeUnreadMark: ReturnType<typeof removeUnreadMarkFactory>;
3316
+ removeUserFromGroup: ReturnType<typeof removeUserFromGroupFactory>;
3317
+ resetHiddenConversPin: ReturnType<typeof resetHiddenConversPinFactory>;
3318
+ reuseAvatar: ReturnType<typeof reuseAvatarFactory>;
3319
+ reviewPendingMemberRequest: ReturnType<typeof reviewPendingMemberRequestFactory>;
3320
+ sendBankCard: ReturnType<typeof sendBankCardFactory>;
3321
+ sendCard: ReturnType<typeof sendCardFactory>;
3322
+ sendDeliveredEvent: ReturnType<typeof sendDeliveredEventFactory>;
3323
+ sendFriendRequest: ReturnType<typeof sendFriendRequestFactory>;
3324
+ sendLink: ReturnType<typeof sendLinkFactory>;
3325
+ sendMessage: ReturnType<typeof sendMessageFactory>;
3326
+ sendReport: ReturnType<typeof sendReportFactory>;
3327
+ sendSeenEvent: ReturnType<typeof sendSeenEventFactory>;
3328
+ sendSticker: ReturnType<typeof sendStickerFactory>;
3329
+ sendTypingEvent: ReturnType<typeof sendTypingEventFactory>;
3330
+ sendVideo: ReturnType<typeof sendVideoFactory>;
3331
+ sendVoice: ReturnType<typeof sendVoiceFactory>;
3332
+ setHiddenConversations: ReturnType<typeof setHiddenConversationsFactory>;
3333
+ setMute: ReturnType<typeof setMuteFactory>;
3334
+ setPinnedConversations: ReturnType<typeof setPinnedConversationsFactory>;
3335
+ sharePoll: ReturnType<typeof sharePollFactory>;
3336
+ unblockUser: ReturnType<typeof unblockUserFactory>;
3337
+ undo: ReturnType<typeof undoFactory>;
3338
+ undoFriendRequest: ReturnType<typeof undoFriendRequestFactory>;
3339
+ updateActiveStatus: ReturnType<typeof updateActiveStatusFactory>;
3340
+ updateAutoDeleteChat: ReturnType<typeof updateAutoDeleteChatFactory>;
3341
+ updateAutoReply: ReturnType<typeof updateAutoReplyFactory>;
3342
+ updateCatalog: ReturnType<typeof updateCatalogFactory>;
3343
+ updateGroupSettings: ReturnType<typeof updateGroupSettingsFactory>;
3344
+ updateHiddenConversPin: ReturnType<typeof updateHiddenConversPinFactory>;
3345
+ updateLabels: ReturnType<typeof updateLabelsFactory>;
3346
+ updateLang: ReturnType<typeof updateLangFactory>;
3347
+ updateProductCatalog: ReturnType<typeof updateProductCatalogFactory>;
3348
+ updateProfile: ReturnType<typeof updateProfileFactory>;
3349
+ updateQuickMessage: ReturnType<typeof updateQuickMessageFactory>;
3350
+ updateSettings: ReturnType<typeof updateSettingsFactory>;
3351
+ uploadAttachment: ReturnType<typeof uploadAttachmentFactory>;
3352
+ uploadProductPhoto: ReturnType<typeof uploadProductPhotoFactory>;
3353
+ votePoll: ReturnType<typeof votePollFactory>;
3354
+ custom: ReturnType<typeof customFactory>;
3355
+ constructor(ctx: ContextSession, zpwServiceMap: ZPWServiceMap, wsUrls: string[]);
3356
+ }
3357
+
3358
+ type Cookie = {
3359
+ domain: string;
3360
+ expirationDate: number;
3361
+ hostOnly: boolean;
3362
+ httpOnly: boolean;
3363
+ name: string;
3364
+ path: string;
3365
+ sameSite: string;
3366
+ secure: boolean;
3367
+ session: boolean;
3368
+ storeId: string;
3369
+ value: string;
3370
+ };
3371
+ type Credentials = {
3372
+ imei: string;
3373
+ cookie: Cookie[] | tough_cookie__default.SerializedCookie[] | {
3374
+ url: string;
3375
+ cookies: Cookie[];
3376
+ };
3377
+ userAgent: string;
3378
+ language?: string;
3379
+ };
3380
+ declare class Zalo {
3381
+ private options;
3382
+ private enableEncryptParam;
3383
+ constructor(options?: Partial<Options>);
3384
+ private parseCookies;
3385
+ private validateParams;
3386
+ login(credentials: Credentials): Promise<API>;
3387
+ private loginCookie;
3388
+ loginQR(options?: {
3389
+ userAgent?: string;
3390
+ language?: string;
3391
+ qrPath?: string;
3392
+ }, callback?: LoginQRCallback): Promise<API>;
3393
+ }
3394
+
3395
+ export { API, AutoReplyScope, BinBankCard, BoardType, BusinessCategory, BusinessCategoryName, ChatTTL, CloseReason, DestType, FriendEventType, Gender, GroupDeliveredMessage, GroupEventType, GroupMessage, GroupSeenMessage, GroupTopicType, GroupType, GroupTyping, LoginQRCallbackEventType, MuteAction, MuteDuration, Reaction, Reactions, ReminderRepeatMode, ReportReason, ReviewPendingMemberRequestStatus, TextStyle, ThreadType, Undo, UpdateLangAvailableLanguages, UpdateSettingsType, Urgency, UserDeliveredMessage, UserMessage, UserSeenMessage, UserTyping, Zalo, ZaloApiError, ZaloApiLoginQRAborted, ZaloApiLoginQRDeclined, ZaloApiMissingImageMetadataGetter, initializeFriendEvent, initializeGroupEvent };
3396
+ export type { AcceptFriendRequestResponse, AddGroupBlockedMemberResponse, AddGroupDeputyResponse, AddPollOptionsOption, AddPollOptionsPayload, AddPollOptionsResponse, AddQuickMessagePayload, AddQuickMessageResponse, AddReactionDestination, AddReactionResponse, AddUnreadMarkResponse, AddUserToGroupResponse, AppContextBase, AppContextExtended, AttachmentSource, AutoReplyItem, BlockUserResponse, BlockViewFeedResponse, BoardItem, CatalogItem, ChangeAccountAvatarResponse, ChangeFriendAliasResponse, ChangeGroupAvatarResponse, ChangeGroupNameResponse, ChangeGroupOwnerResponse, ContextBase, ContextSession, Cookie, CreateAutoReplyPayload, CreateAutoReplyResponse, CreateCatalogResponse, CreateGroupOptions, CreateGroupResponse, CreateNoteOptions, CreateNoteResponse, CreatePollOptions, CreatePollResponse, CreateProductCatalogPayload, CreateProductCatalogResponse, CreateReminderGroup, CreateReminderOptions, CreateReminderResponse, CreateReminderUser, Credentials, CustomAPICallback, CustomAPIProps, CustomReaction, DeleteAutoReplyResponse, DeleteAvatarResponse, DeleteCatalogResponse, DeleteChatLastMessage, DeleteChatResponse, DeleteGroupInviteBoxResponse, DeleteMessageDestination, DeleteMessageResponse, DeleteProductCatalogPayload, DeleteProductCatalogResponse, DeliveredMessage, DisableGroupLinkResponse, DisperseGroupResponse, EditNoteOptions, EditNoteResponse, EditReminderGroup, EditReminderOptions, EditReminderResponse, EditReminderUser, EnableGroupLinkResponse, FetchAccountInfoResponse, FileData, FindUserResponse, ForwardMessageFail, ForwardMessagePayload, ForwardMessageResponse, ForwardMessageSuccess, FriendEvent, FriendRecommendationsCollapseMsgListConfig, FriendRecommendationsDataInfo, FriendRecommendationsRecommItem, GetAliasListResponse, GetAllFriendsResponse, GetAllGroupsResponse, GetArchivedChatListResponse, GetAutoDeleteChatResponse, GetAutoReplyListResponse, GetAvatarListResponse, GetBizAccountResponse, GetCatalogListPayload, GetCatalogListResponse, GetFriendBoardListResponse, GetFriendOnlinesResponse, GetFriendOnlinesStatus, GetFriendRecommendationsResponse, GetFriendRequestStatusResponse, GetGroupBlockedMemberPayload, GetGroupBlockedMemberResponse, GetGroupInviteBoxInfoPayload, GetGroupInviteBoxInfoResponse, GetGroupInviteBoxListPayload, GetGroupInviteBoxListResponse, GetGroupLinkDetailResponse, GetGroupLinkInfoPayload, GetGroupLinkInfoResponse, GetGroupMembersInfoResponse, GetHiddenConversationsResponse, GetLabelsResponse, GetListBoardResponse, GetListReminderResponse, GetMuteResponse, GetPendingGroupMembersResponse, GetPendingGroupMembersUserInfo, GetPinConversationsResponse, GetProductCatalogListPayload, GetProductCatalogListResponse, GetQRResponse, GetQuickMessageListResponse, GetRelatedFriendGroupResponse, GetReminderResponse, GetReminderResponsesResponse, GetSentFriendRequestResponse, GetSettingsResponse, GetUnreadMarkResponse, GroupCurrentMem, GroupEvent, GroupEventExtraData, GroupEventGroupInfo, GroupEventUpdateMember, GroupInfo, GroupInfoPendingApprove, GroupInfoResponse, GroupMemberProfile, GroupSetting, GroupTopic, GroupTopicFileMessageParams, GroupTopicGifMessageParams, GroupTopicImageMessageParams, GroupTopicMessageParams, GroupTopicNoteParams, GroupTopicOtherParams, GroupTopicPollParams, GroupTopicTextMessageParams, GroupTopicVideoMessageParams, GroupTopicVoiceMessageParams, ImageData, ImageMetadataGetter, ImageMetadataGetterResponse, InviteUserToGroupsResponse, JoinGroupInviteBoxResponse, JoinGroupLinkResponse, KeepAliveResponse, LabelData, LastOnlineResponse, LeaveGroupResponse, ListBoardOptions, ListReminderOptions, LockPollResponse, LoginQRCallback, LoginQRCallbackEvent, Mention, Message, MessageContent, MuteEntriesInfo, NoteDetail, Options, ParseLinkErrorMaps, ParseLinkResponse, PinnedMessageDetail, PollDetail, PollDetailResponse, PollOptions, ProductCatalogItem, ProfileInfo, QuickMessage, RejectFriendRequestResponse, ReminderGroup, ReminderListGroup, ReminderListUser, ReminderUser, RemoveFriendAliasResponse, RemoveFriendResponse, RemoveGroupBlockedMemberResponse, RemoveGroupDeputyResponse, RemoveQuickMessageResponse, RemoveReminderResponse, RemoveUnreadMarkResponse, RemoveUserFromGroupResponse, ResetHiddenConversPinResponse, ReuseAvatarResponse, ReviewPendingMemberRequestPayload, ReviewPendingMemberRequestResponse, SeenMessage, SendBankCardPayload, SendBankCardResponse, SendCardOptions, SendCardResponse, SendDeliveredEventMessageParams, SendDeliveredEventResponse, SendFriendRequestResponse, SendLinkOptions, SendLinkResponse, SendMessageQuote, SendMessageResponse, SendMessageResult, SendReportOptions, SendReportResponse, SendSeenEventMessageParams, SendSeenEventResponse, SendStickerPayload, SendStickerResponse, SendTypingEventResponse, SendVideoOptions, SendVideoResponse, SendVoiceOptions, SendVoiceResponse, SentFriendRequestInfo, SetHiddenConversationsResponse, SetMuteParams, SetMuteResponse, SetPinnedConversationsResponse, SharePollResponse, StickerDetail, StickerDetailResponse, Style, TAttachmentContent, TDeliveredMessage, TFriendEvent, TFriendEventBase, TFriendEventPinCreate, TFriendEventPinCreateTopic, TFriendEventPinCreateTopicParams, TFriendEventPinTopic, TFriendEventPinUnpin, TFriendEventRejectUndo, TFriendEventRequest, TFriendEventSeenRequest, TGroupDeliveredMessage, TGroupEvent, TGroupEventBase, TGroupEventBoard, TGroupEventJoinRequest, TGroupEventPinTopic, TGroupEventRemindRespond, TGroupEventRemindTopic, TGroupEventReorderPinTopic, TGroupMessage, TGroupSeenMessage, TGroupTyping, TMention, TMessage, TOtherContent, TQuote, TReaction, TTyping, TUndo, TUndoContent, TUserSeenMessage, Typing, UnBlockUserResponse, UndoFriendRequestResponse, UndoPayload, UndoResponse, UnreadMark, UpdateActiveStatusResponse, UpdateAutoDeleteChatResponse, UpdateAutoReplyPayload, UpdateAutoReplyResponse, UpdateCatalogPayload, UpdateCatalogResponse, UpdateGroupSettingsOptions, UpdateGroupSettingsResponse, UpdateHiddenConversPinResponse, UpdateLabelsPayload, UpdateLabelsResponse, UpdateLangResponse, UpdateProductCatalogPayload, UpdateProductCatalogResponse, UpdateProfilePayload, UpdateProfileResponse, UpdateQuickMessagePayload, UpdateQuickMessageResponse, UpdateSettingsResponse, UploadAttachmentFileResponse, UploadAttachmentImageResponse, UploadAttachmentResponse, UploadAttachmentType, UploadAttachmentVideoResponse, UploadProductPhotoPayload, UploadProductPhotoResponse, User, UserInfoResponse, UserSetting, VotePollResponse, ZBusinessPackage, ZPWServiceMap };