@nam088/zca-js 1.0.0 → 3.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,3395 @@
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 ListReminderOptions = {
1587
+ /**
1588
+ * Page number (default: 1)
1589
+ */
1590
+ page?: number;
1591
+ /**
1592
+ * Number of items to retrieve (default: 20)
1593
+ */
1594
+ count?: number;
1595
+ };
1596
+ type ReminderListUser = ReminderUser;
1597
+ type ReminderListGroup = ReminderGroup & {
1598
+ groupId: string;
1599
+ eventType: number;
1600
+ responseMem: {
1601
+ rejectMember: number;
1602
+ myResp: number;
1603
+ acceptMember: number;
1604
+ };
1605
+ repeatInfo: {
1606
+ list_ts: unknown[];
1607
+ };
1608
+ repeatData: unknown[];
1609
+ };
1610
+ type GetListReminderResponse = (ReminderListUser & ReminderListGroup)[];
1611
+ declare const getListReminderFactory: (ctx: ContextBase, api: API) => (options: ListReminderOptions, threadId: string, type?: ThreadType) => Promise<GetListReminderResponse>;
1612
+
1613
+ type RemoveUserFromGroupResponse = {
1614
+ errorMembers: string[];
1615
+ };
1616
+ declare const removeUserFromGroupFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<RemoveUserFromGroupResponse>;
1617
+
1618
+ type CreateReminderOptions = {
1619
+ title: string;
1620
+ emoji?: string;
1621
+ startTime?: number;
1622
+ repeat?: ReminderRepeatMode;
1623
+ };
1624
+ type CreateReminderUser = ReminderUser;
1625
+ type CreateReminderGroup = Omit<ReminderGroup, "responseMem">;
1626
+ type CreateReminderResponse = CreateReminderUser | CreateReminderGroup;
1627
+ declare const createReminderFactory: (ctx: ContextBase, api: API) => (options: CreateReminderOptions, threadId: string, type?: ThreadType) => Promise<CreateReminderResponse>;
1628
+
1629
+ declare enum ReportReason {
1630
+ Sensitive = 1,
1631
+ Annoy = 2,
1632
+ Fraud = 3,
1633
+ Other = 0
1634
+ }
1635
+ type SendReportOptions = {
1636
+ reason: ReportReason.Other;
1637
+ content: string;
1638
+ } | {
1639
+ reason: Exclude<ReportReason, ReportReason.Other>;
1640
+ };
1641
+ type SendReportResponse = {
1642
+ reportId: string;
1643
+ };
1644
+ declare const sendReportFactory: (ctx: ContextBase, api: API) => (options: SendReportOptions, threadId: string, type?: ThreadType) => Promise<SendReportResponse>;
1645
+
1646
+ type GetGroupInviteBoxListPayload = {
1647
+ mpage?: number;
1648
+ page?: number;
1649
+ invPerPage?: number;
1650
+ mcount?: number;
1651
+ };
1652
+ type GetGroupInviteBoxListResponse = {
1653
+ invitations: {
1654
+ groupInfo: GroupInfo;
1655
+ inviterInfo: {
1656
+ id: string;
1657
+ dName: string;
1658
+ zaloName: string;
1659
+ avatar: string;
1660
+ avatar_25: string;
1661
+ accountStatus: number;
1662
+ type: number;
1663
+ };
1664
+ grCreatorInfo: {
1665
+ id: string;
1666
+ dName: string;
1667
+ zaloName: string;
1668
+ avatar: string;
1669
+ avatar_25: string;
1670
+ accountStatus: number;
1671
+ type: number;
1672
+ };
1673
+ /**
1674
+ * Expired timestamp max 7 days
1675
+ */
1676
+ expiredTs: string;
1677
+ type: number;
1678
+ }[];
1679
+ total: number;
1680
+ hasMore: boolean;
1681
+ };
1682
+ declare const getGroupInviteBoxListFactory: (ctx: ContextBase, api: API) => (payload?: GetGroupInviteBoxListPayload) => Promise<GetGroupInviteBoxListResponse>;
1683
+
1684
+ type SetMuteParams = {
1685
+ /**
1686
+ * Mute duration in seconds or predefined durations
1687
+ */
1688
+ duration?: MuteDuration | number;
1689
+ action?: MuteAction;
1690
+ };
1691
+ type SetMuteResponse = "";
1692
+ declare enum MuteDuration {
1693
+ ONE_HOUR = 3600,
1694
+ FOUR_HOURS = 14400,
1695
+ FOREVER = -1,
1696
+ UNTIL_8AM = "until8AM"
1697
+ }
1698
+ declare enum MuteAction {
1699
+ MUTE = 1,
1700
+ UNMUTE = 3
1701
+ }
1702
+ declare const setMuteFactory: (ctx: ContextBase, api: API) => (params: SetMuteParams | undefined, threadID: string, type?: ThreadType) => Promise<"">;
1703
+
1704
+ type ListBoardOptions = {
1705
+ /**
1706
+ * Page number (default: 1)
1707
+ */
1708
+ page?: number;
1709
+ /**
1710
+ * Number of items to retrieve (default: 20)
1711
+ */
1712
+ count?: number;
1713
+ };
1714
+ type BoardItem = {
1715
+ boardType: BoardType;
1716
+ data: PollDetail | NoteDetail | PinnedMessageDetail;
1717
+ };
1718
+ type GetListBoardResponse = {
1719
+ items: BoardItem[];
1720
+ count: number;
1721
+ };
1722
+ declare const getListBoardFactory: (ctx: ContextBase, api: API) => (options: ListBoardOptions, groupId: string) => Promise<GetListBoardResponse>;
1723
+
1724
+ type DeleteChatResponse = {
1725
+ status: number;
1726
+ };
1727
+ type DeleteChatLastMessage = {
1728
+ /**
1729
+ * Last message owner ID to delete backwards
1730
+ */
1731
+ ownerId: string;
1732
+ /**
1733
+ * Last message client ID to delete backwards
1734
+ */
1735
+ cliMsgId: string;
1736
+ /**
1737
+ * Last message global ID to delete backwards
1738
+ */
1739
+ globalMsgId: string;
1740
+ };
1741
+ declare const deleteChatFactory: (ctx: ContextBase, api: API) => (lastMessage: DeleteChatLastMessage, threadId: string, type?: ThreadType) => Promise<DeleteChatResponse>;
1742
+
1743
+ type ChangeGroupNameResponse = {
1744
+ status: number;
1745
+ };
1746
+ declare const changeGroupNameFactory: (ctx: ContextBase, api: API) => (name: string, groupId: string) => Promise<ChangeGroupNameResponse>;
1747
+
1748
+ type UpdateGroupSettingsOptions = {
1749
+ /**
1750
+ * Disallow group members to change the group name and avatar
1751
+ */
1752
+ blockName?: boolean;
1753
+ /**
1754
+ * Highlight messages from owner/admins
1755
+ */
1756
+ signAdminMsg?: boolean;
1757
+ /**
1758
+ * Don't pin messages, notes, and polls to the top of a conversation
1759
+ */
1760
+ setTopicOnly?: boolean;
1761
+ /**
1762
+ * Allow new members to read most recent messages
1763
+ */
1764
+ enableMsgHistory?: boolean;
1765
+ /**
1766
+ * Membership approval
1767
+ */
1768
+ joinAppr?: boolean;
1769
+ /**
1770
+ * Disallow group members to create notes & reminders
1771
+ */
1772
+ lockCreatePost?: boolean;
1773
+ /**
1774
+ * Disallow group members to create polls
1775
+ */
1776
+ lockCreatePoll?: boolean;
1777
+ /**
1778
+ * Disallow group members to send messages
1779
+ */
1780
+ lockSendMsg?: boolean;
1781
+ /**
1782
+ * Disallow group members to view full member list (community only)
1783
+ */
1784
+ lockViewMember?: boolean;
1785
+ };
1786
+ type UpdateGroupSettingsResponse = "";
1787
+ declare const updateGroupSettingsFactory: (ctx: ContextBase, api: API) => (options: UpdateGroupSettingsOptions, groupId: string) => Promise<"">;
1788
+
1789
+ type AddPollOptionsOption = {
1790
+ voted: boolean;
1791
+ content: string;
1792
+ };
1793
+ type AddPollOptionsPayload = {
1794
+ pollId: number;
1795
+ options: AddPollOptionsOption[];
1796
+ votedOptionIds: number[];
1797
+ };
1798
+ type AddPollOptionsResponse = {
1799
+ options: PollOptions[];
1800
+ };
1801
+ declare const addPollOptionsFactory: (ctx: ContextBase, api: API) => (payload: AddPollOptionsPayload) => Promise<AddPollOptionsResponse>;
1802
+
1803
+ type GetReminderResponsesResponse = {
1804
+ rejectMember: string[];
1805
+ acceptMember: string[];
1806
+ };
1807
+ declare const getReminderResponsesFactory: (ctx: ContextBase, api: API) => (reminderId: string) => Promise<GetReminderResponsesResponse>;
1808
+
1809
+ type MuteEntriesInfo = {
1810
+ id: string;
1811
+ duration: number;
1812
+ startTime: number;
1813
+ systemTime: number;
1814
+ currentTime: number;
1815
+ muteMode: number;
1816
+ };
1817
+ type GetMuteResponse = {
1818
+ chatEntries: MuteEntriesInfo[];
1819
+ groupChatEntries: MuteEntriesInfo[];
1820
+ };
1821
+ declare const getMuteFactory: (ctx: ContextBase, api: API) => () => Promise<GetMuteResponse>;
1822
+
1823
+ type ParseLinkErrorMaps = Record<string, number>;
1824
+ type ParseLinkResponse = {
1825
+ data: {
1826
+ thumb: string;
1827
+ title: string;
1828
+ desc: string;
1829
+ src: string;
1830
+ href: string;
1831
+ media: {
1832
+ type: number;
1833
+ count: number;
1834
+ mediaTitle: string;
1835
+ artist: string;
1836
+ streamUrl: string;
1837
+ stream_icon: string;
1838
+ };
1839
+ stream_icon: string;
1840
+ };
1841
+ error_maps: ParseLinkErrorMaps;
1842
+ };
1843
+ declare const parseLinkFactory: (ctx: ContextBase, api: API) => (link: string) => Promise<ParseLinkResponse>;
1844
+
1845
+ type ChangeGroupOwnerResponse = {
1846
+ time: number;
1847
+ };
1848
+ declare const changeGroupOwnerFactory: (ctx: ContextBase, api: API) => (memberId: string, groupId: string) => Promise<ChangeGroupOwnerResponse>;
1849
+
1850
+ type UploadAttachmentImageResponse = {
1851
+ normalUrl: string;
1852
+ photoId: string;
1853
+ finished: number | boolean;
1854
+ hdUrl: string;
1855
+ thumbUrl: string;
1856
+ clientFileId: number;
1857
+ chunkId: number;
1858
+ fileType: "image";
1859
+ width: number;
1860
+ height: number;
1861
+ totalSize: number;
1862
+ hdSize: number;
1863
+ };
1864
+ type UploadAttachmentVideoResponse = {
1865
+ finished: number | boolean;
1866
+ clientFileId: number;
1867
+ chunkId: number;
1868
+ fileType: "video";
1869
+ fileUrl: string;
1870
+ fileId: string;
1871
+ checksum: string;
1872
+ totalSize: number;
1873
+ fileName: string;
1874
+ };
1875
+ type UploadAttachmentFileResponse = {
1876
+ finished: number | boolean;
1877
+ clientFileId: number;
1878
+ chunkId: number;
1879
+ fileType: "others";
1880
+ fileUrl: string;
1881
+ fileId: string;
1882
+ checksum: string;
1883
+ totalSize: number;
1884
+ fileName: string;
1885
+ };
1886
+ type ImageData = {
1887
+ fileName: string;
1888
+ totalSize: number | undefined;
1889
+ width: number | undefined;
1890
+ height: number | undefined;
1891
+ };
1892
+ type FileData = {
1893
+ fileName: string;
1894
+ totalSize: number;
1895
+ };
1896
+ type UploadAttachmentType = UploadAttachmentImageResponse | UploadAttachmentVideoResponse | UploadAttachmentFileResponse;
1897
+ type UploadAttachmentResponse = UploadAttachmentType[];
1898
+ declare const uploadAttachmentFactory: (ctx: ContextBase, api: API) => (sources: AttachmentSource | AttachmentSource[], threadId: string, type?: ThreadType) => Promise<UploadAttachmentType[]>;
1899
+
1900
+ type GetProductCatalogListPayload = {
1901
+ catalogId: string;
1902
+ /**
1903
+ * Number of items to retrieve (default: 100)
1904
+ */
1905
+ limit?: number;
1906
+ versionCatalog?: number;
1907
+ lastProductId?: string;
1908
+ /**
1909
+ * Page number (default: 0)
1910
+ */
1911
+ page?: number;
1912
+ };
1913
+ type GetProductCatalogListResponse = {
1914
+ items: ProductCatalogItem[];
1915
+ version: number;
1916
+ has_more: number;
1917
+ };
1918
+ declare const getProductCatalogListFactory: (ctx: ContextBase, api: API) => (payload: GetProductCatalogListPayload) => Promise<GetProductCatalogListResponse>;
1919
+
1920
+ type DeleteCatalogResponse = "";
1921
+ declare const deleteCatalogFactory: (ctx: ContextBase, api: API) => (catalogId: string) => Promise<"">;
1922
+
1923
+ type LastOnlineResponse = {
1924
+ settings: {
1925
+ show_online_status: boolean;
1926
+ };
1927
+ lastOnline: number;
1928
+ };
1929
+ declare const lastOnlineFactory: (ctx: ContextBase, api: API) => (uid: string) => Promise<LastOnlineResponse>;
1930
+
1931
+ type GetGroupLinkInfoPayload = {
1932
+ link: string;
1933
+ /**
1934
+ * Default: 1
1935
+ */
1936
+ memberPage?: number;
1937
+ };
1938
+ type GetGroupLinkInfoResponse = {
1939
+ groupId: string;
1940
+ name: string;
1941
+ desc: string;
1942
+ type: number;
1943
+ creatorId: string;
1944
+ avt: string;
1945
+ fullAvt: string;
1946
+ adminIds: string[];
1947
+ currentMems: {
1948
+ id: string;
1949
+ dName: string;
1950
+ zaloName: string;
1951
+ avatar: string;
1952
+ avatar_25: string;
1953
+ accountStatus: number;
1954
+ type: number;
1955
+ }[];
1956
+ admins: unknown[];
1957
+ hasMoreMember: number;
1958
+ subType: number;
1959
+ totalMember: number;
1960
+ setting: GroupSetting;
1961
+ globalId: string;
1962
+ };
1963
+ declare const getGroupLinkInfoFactory: (ctx: ContextBase, api: API) => (payload: GetGroupLinkInfoPayload) => Promise<GetGroupLinkInfoResponse>;
1964
+
1965
+ type ForwardMessagePayload = {
1966
+ message: string;
1967
+ ttl?: number;
1968
+ reference?: {
1969
+ id: string;
1970
+ ts: number;
1971
+ logSrcType: number;
1972
+ fwLvl: number;
1973
+ };
1974
+ };
1975
+ type ForwardMessageSuccess = {
1976
+ clientId: string;
1977
+ msgId: string;
1978
+ };
1979
+ type ForwardMessageFail = {
1980
+ clientId: string;
1981
+ error_code: string;
1982
+ };
1983
+ type ForwardMessageResponse = {
1984
+ success: ForwardMessageSuccess[];
1985
+ fail: ForwardMessageFail[];
1986
+ };
1987
+ declare const forwardMessageFactory: (ctx: ContextBase, api: API) => (payload: ForwardMessagePayload, threadIds: string[], type?: ThreadType) => Promise<ForwardMessageResponse>;
1988
+
1989
+ declare const getCookieFactory: (ctx: ContextBase, api: API) => () => tough_cookie.CookieJar;
1990
+
1991
+ type UpdateAutoReplyPayload = {
1992
+ id: number;
1993
+ content: string;
1994
+ isEnable: boolean;
1995
+ startTime: number;
1996
+ endTime: number;
1997
+ scope: AutoReplyScope;
1998
+ uids?: string | string[];
1999
+ };
2000
+ type UpdateAutoReplyResponse = {
2001
+ item: AutoReplyItem;
2002
+ version: number;
2003
+ };
2004
+ declare const updateAutoReplyFactory: (ctx: ContextBase, api: API) => (payload: UpdateAutoReplyPayload) => Promise<UpdateAutoReplyResponse>;
2005
+
2006
+ type ChangeFriendAliasResponse = "";
2007
+ declare const changeFriendAliasFactory: (ctx: ContextBase, api: API) => (alias: string, friendId: string) => Promise<"">;
2008
+
2009
+ type FindUserResponse = {
2010
+ avatar: string;
2011
+ cover: string;
2012
+ status: string;
2013
+ gender: Gender;
2014
+ dob: number;
2015
+ sdob: string;
2016
+ globalId: string;
2017
+ bizPkg: ZBusinessPackage;
2018
+ uid: string;
2019
+ zalo_name: string;
2020
+ display_name: string;
2021
+ };
2022
+ declare const findUserFactory: (ctx: ContextBase, api: API) => (phoneNumber: string) => Promise<FindUserResponse>;
2023
+
2024
+ type EditReminderOptions = {
2025
+ title: string;
2026
+ topicId: string;
2027
+ emoji?: string;
2028
+ startTime?: number;
2029
+ repeat?: ReminderRepeatMode;
2030
+ };
2031
+ type EditReminderUser = ReminderUser;
2032
+ type EditReminderGroup = Omit<ReminderGroup, "responseMem">;
2033
+ type EditReminderResponse = EditReminderUser | EditReminderGroup;
2034
+ declare const editReminderFactory: (ctx: ContextBase, api: API) => (options: EditReminderOptions, threadId: string, type?: ThreadType) => Promise<EditReminderResponse>;
2035
+
2036
+ type ReuseAvatarResponse = null;
2037
+ declare const reuseAvatarFactory: (ctx: ContextBase, api: API) => (photoId: string) => Promise<null>;
2038
+
2039
+ type GetFriendOnlinesStatus = {
2040
+ userId: string;
2041
+ status: string;
2042
+ };
2043
+ type GetFriendOnlinesResponse = {
2044
+ predefine: string[];
2045
+ ownerStatus: string;
2046
+ onlines: GetFriendOnlinesStatus[];
2047
+ };
2048
+ declare const getFriendOnlinesFactory: (ctx: ContextBase, api: API) => () => Promise<GetFriendOnlinesResponse>;
2049
+
2050
+ type UploadProductPhotoPayload = {
2051
+ file: AttachmentSource;
2052
+ };
2053
+ type UploadProductPhotoResponse = {
2054
+ normalUrl: string;
2055
+ photoId: string;
2056
+ finished: number;
2057
+ hdUrl: string;
2058
+ thumbUrl: string;
2059
+ clientFileId: number;
2060
+ chunkId: number;
2061
+ };
2062
+ declare const uploadProductPhotoFactory: (ctx: ContextBase, api: API) => (payload: UploadProductPhotoPayload) => Promise<UploadProductPhotoResponse>;
2063
+
2064
+ type SendBankCardPayload = {
2065
+ binBank: BinBankCard;
2066
+ numAccBank: string;
2067
+ nameAccBank?: string;
2068
+ };
2069
+ type SendBankCardResponse = "";
2070
+ declare const sendBankCardFactory: (ctx: ContextBase, api: API) => (payload: SendBankCardPayload, threadId: string, type?: ThreadType) => Promise<"">;
2071
+
2072
+ type GroupInfoResponse = {
2073
+ removedsGroup: string[];
2074
+ unchangedsGroup: string[];
2075
+ gridInfoMap: {
2076
+ [groupId: string]: GroupInfo & {
2077
+ memVerList: string[];
2078
+ pendingApprove: GroupInfoPendingApprove;
2079
+ };
2080
+ };
2081
+ };
2082
+ type GroupInfoPendingApprove = {
2083
+ time: number;
2084
+ uids: string[] | null;
2085
+ };
2086
+ declare const getGroupInfoFactory: (ctx: ContextBase, api: API) => (groupId: string | string[]) => Promise<GroupInfoResponse>;
2087
+
2088
+ type DeleteMessageResponse = {
2089
+ status: number;
2090
+ };
2091
+ type DeleteMessageDestination = {
2092
+ data: {
2093
+ cliMsgId: string;
2094
+ msgId: string;
2095
+ uidFrom: string;
2096
+ };
2097
+ threadId: string;
2098
+ type?: ThreadType;
2099
+ };
2100
+ declare const deleteMessageFactory: (ctx: ContextBase, api: API) => (dest: DeleteMessageDestination, onlyMe?: boolean) => Promise<DeleteMessageResponse>;
2101
+
2102
+ type VotePollResponse = {
2103
+ options: PollOptions[];
2104
+ };
2105
+ declare const votePollFactory: (ctx: ContextBase, api: API) => (pollId: number, optionId: number | number[]) => Promise<VotePollResponse>;
2106
+
2107
+ type SendFriendRequestResponse = "";
2108
+ declare const sendFriendRequestFactory: (ctx: ContextBase, api: API) => (msg: string, userId: string) => Promise<"">;
2109
+
2110
+ type ResetHiddenConversPinResponse = "";
2111
+ declare const resetHiddenConversPinFactory: (ctx: ContextBase, api: API) => () => Promise<"">;
2112
+
2113
+ type AddUserToGroupResponse = {
2114
+ errorMembers: string[];
2115
+ error_data: Record<string, string[]>;
2116
+ };
2117
+ declare const addUserToGroupFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<AddUserToGroupResponse>;
2118
+
2119
+ type DeleteProductCatalogPayload = {
2120
+ productIds: string | string[];
2121
+ catalogId: string;
2122
+ };
2123
+ type DeleteProductCatalogResponse = {
2124
+ item: number[];
2125
+ version_ls_catalog: number;
2126
+ version_catalog: number;
2127
+ };
2128
+ declare const deleteProductCatalogFactory: (ctx: ContextBase, api: API) => (payload: DeleteProductCatalogPayload) => Promise<DeleteProductCatalogResponse>;
2129
+
2130
+ declare const getOwnIdFactory: (ctx: ContextBase, api: API) => () => string;
2131
+
2132
+ type UndoPayload = {
2133
+ msgId: string | number;
2134
+ cliMsgId: string | number;
2135
+ };
2136
+ type UndoResponse = {
2137
+ status: number;
2138
+ };
2139
+ declare const undoFactory: (ctx: ContextBase, api: API) => (payload: UndoPayload, threadId: string, type?: ThreadType) => Promise<UndoResponse>;
2140
+
2141
+ type JoinGroupInviteBoxResponse = "";
2142
+ declare const joinGroupInviteBoxFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<"">;
2143
+
2144
+ type DeleteAutoReplyResponse = {
2145
+ item: number;
2146
+ version: number;
2147
+ };
2148
+ declare const deleteAutoReplyFactory: (ctx: ContextBase, api: API) => (id: number) => Promise<DeleteAutoReplyResponse>;
2149
+
2150
+ type SetPinnedConversationsResponse = "";
2151
+ declare const setPinnedConversationsFactory: (ctx: ContextBase, api: API) => (pinned: boolean, threadId: string | string[], type?: ThreadType) => Promise<"">;
2152
+
2153
+ type UndoFriendRequestResponse = "";
2154
+ declare const undoFriendRequestFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2155
+
2156
+ type GetPendingGroupMembersUserInfo = {
2157
+ uid: string;
2158
+ dpn: string;
2159
+ avatar: string;
2160
+ user_submit: null;
2161
+ };
2162
+ type GetPendingGroupMembersResponse = {
2163
+ time: number;
2164
+ users: GetPendingGroupMembersUserInfo[];
2165
+ };
2166
+ declare const getPendingGroupMembersFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<GetPendingGroupMembersResponse>;
2167
+
2168
+ type RemoveGroupDeputyResponse = "";
2169
+ declare const removeGroupDeputyFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<"">;
2170
+
2171
+ type GetAllGroupsResponse = {
2172
+ version: string;
2173
+ gridVerMap: {
2174
+ [groupId: string]: string;
2175
+ };
2176
+ };
2177
+ declare const getAllGroupsFactory: (ctx: ContextBase, api: API) => () => Promise<GetAllGroupsResponse>;
2178
+
2179
+ type ChangeGroupAvatarResponse = "";
2180
+ declare const changeGroupAvatarFactory: (ctx: ContextBase, api: API) => (avatarSource: AttachmentSource, groupId: string) => Promise<"">;
2181
+
2182
+ type UpdateQuickMessagePayload = {
2183
+ keyword: string;
2184
+ title: string;
2185
+ media?: AttachmentSource;
2186
+ };
2187
+ type UpdateQuickMessageResponse = {
2188
+ item: QuickMessage;
2189
+ version: number;
2190
+ };
2191
+ declare const updateQuickMessageFactory: (ctx: ContextBase, api: API) => (updatePayload: UpdateQuickMessagePayload, itemId: number) => Promise<UpdateQuickMessageResponse>;
2192
+
2193
+ type ReviewPendingMemberRequestPayload = {
2194
+ members: string | string[];
2195
+ isApprove: boolean;
2196
+ };
2197
+ declare enum ReviewPendingMemberRequestStatus {
2198
+ SUCCESS = 0,
2199
+ NOT_IN_PENDING_LIST = 170,
2200
+ ALREADY_IN_GROUP = 178,
2201
+ INSUFFICIENT_PERMISSION = 166
2202
+ }
2203
+ type ReviewPendingMemberRequestResponse = {
2204
+ [memberId: string]: ReviewPendingMemberRequestStatus;
2205
+ };
2206
+ declare const reviewPendingMemberRequestFactory: (ctx: ContextBase, api: API) => (payload: ReviewPendingMemberRequestPayload, groupId: string) => Promise<ReviewPendingMemberRequestResponse>;
2207
+
2208
+ type AddGroupDeputyResponse = "";
2209
+ declare const addGroupDeputyFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<"">;
2210
+
2211
+ type RejectFriendRequestResponse = "";
2212
+ declare const rejectFriendRequestFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2213
+
2214
+ /**
2215
+ * Options for creating a poll.
2216
+ */
2217
+ type CreatePollOptions = {
2218
+ /**
2219
+ * Question for the poll.
2220
+ */
2221
+ question: string;
2222
+ /**
2223
+ * List of options for the poll.
2224
+ */
2225
+ options: string[];
2226
+ /**
2227
+ * Poll expiration time in milliseconds (0 = no expiration).
2228
+ */
2229
+ expiredTime?: number;
2230
+ /**
2231
+ * Allows multiple choices in the poll.
2232
+ */
2233
+ allowMultiChoices?: boolean;
2234
+ /**
2235
+ * Allows members to add new options to the poll.
2236
+ */
2237
+ allowAddNewOption?: boolean;
2238
+ /**
2239
+ * Hides voting results until the user has voted.
2240
+ */
2241
+ hideVotePreview?: boolean;
2242
+ /**
2243
+ * Hides poll voters (anonymous poll).
2244
+ */
2245
+ isAnonymous?: boolean;
2246
+ };
2247
+ type CreatePollResponse = PollDetail;
2248
+ declare const createPollFactory: (ctx: ContextBase, api: API) => (options: CreatePollOptions, groupId: string) => Promise<PollDetail>;
2249
+
2250
+ type SendLinkOptions = {
2251
+ msg?: string;
2252
+ link: string;
2253
+ ttl?: number;
2254
+ };
2255
+ type SendLinkResponse = {
2256
+ msgId: string;
2257
+ };
2258
+ declare const sendLinkFactory: (ctx: ContextBase, api: API) => (options: SendLinkOptions, threadId: string, type?: ThreadType) => Promise<SendLinkResponse>;
2259
+
2260
+ type CreateAutoReplyPayload = {
2261
+ content: string;
2262
+ isEnable: boolean;
2263
+ startTime: number;
2264
+ endTime: number;
2265
+ scope: AutoReplyScope;
2266
+ uids?: string | string[];
2267
+ };
2268
+ type CreateAutoReplyResponse = {
2269
+ item: AutoReplyItem;
2270
+ version: number;
2271
+ };
2272
+ declare const createAutoReplyFactory: (ctx: ContextBase, api: API) => (payload: CreateAutoReplyPayload) => Promise<CreateAutoReplyResponse>;
2273
+
2274
+ type SetHiddenConversationsResponse = "";
2275
+ declare const setHiddenConversationsFactory: (ctx: ContextBase, api: API) => (hidden: boolean, threadId: string | string[], type?: ThreadType) => Promise<"">;
2276
+
2277
+ declare const getContextFactory: (ctx: ContextBase, api: API) => () => ContextSession;
2278
+
2279
+ type JoinGroupLinkResponse = "";
2280
+ declare const joinGroupLinkFactory: (ctx: ContextBase, api: API) => (link: string) => Promise<"">;
2281
+
2282
+ type GetGroupBlockedMemberPayload = {
2283
+ /**
2284
+ * Page number (default: 1)
2285
+ */
2286
+ page?: number;
2287
+ /**
2288
+ * Number of items to retrieve (default: 50)
2289
+ */
2290
+ count?: number;
2291
+ };
2292
+ type GetGroupBlockedMemberResponse = {
2293
+ blocked_members: {
2294
+ id: string;
2295
+ dName: string;
2296
+ zaloName: string;
2297
+ avatar: string;
2298
+ avatar_25: string;
2299
+ accountStatus: number;
2300
+ type: number;
2301
+ }[];
2302
+ has_more: number;
2303
+ };
2304
+ declare const getGroupBlockedMemberFactory: (ctx: ContextBase, api: API) => (payload: GetGroupBlockedMemberPayload, groupId: string) => Promise<GetGroupBlockedMemberResponse>;
2305
+
2306
+ type UpdateSettingsResponse = "";
2307
+ declare enum UpdateSettingsType {
2308
+ ViewBirthday = "view_birthday",
2309
+ ShowOnlineStatus = "show_online_status",
2310
+ DisplaySeenStatus = "display_seen_status",
2311
+ ReceiveMessage = "receive_message",
2312
+ AcceptCall = "accept_stranger_call",
2313
+ AddFriendViaPhone = "add_friend_via_phone",
2314
+ AddFriendViaQR = "add_friend_via_qr",
2315
+ AddFriendViaGroup = "add_friend_via_group",
2316
+ AddFriendViaContact = "add_friend_via_contact",
2317
+ DisplayOnRecommendFriend = "display_on_recommend_friend",
2318
+ ArchivedChat = "archivedChatStatus",
2319
+ QuickMessage = "quickMessageStatus"
2320
+ }
2321
+ declare const updateSettingsFactory: (ctx: ContextBase, api: API) => (type: UpdateSettingsType, value: number) => Promise<"">;
2322
+
2323
+ type SendDeliveredEventResponse = "" | {
2324
+ status: number;
2325
+ };
2326
+ type SendDeliveredEventMessageParams = {
2327
+ msgId: string;
2328
+ cliMsgId: string;
2329
+ uidFrom: string;
2330
+ idTo: string;
2331
+ msgType: string;
2332
+ st: number;
2333
+ at: number;
2334
+ cmd: number;
2335
+ ts: string | number;
2336
+ };
2337
+ declare const sendDeliveredEventFactory: (ctx: ContextBase, api: API) => (isSeen: boolean, messages: SendDeliveredEventMessageParams | SendDeliveredEventMessageParams[], type?: ThreadType) => Promise<SendDeliveredEventResponse>;
2338
+
2339
+ type GetAvatarListResponse = {
2340
+ albumId: string;
2341
+ nextPhotoId: string;
2342
+ hasMore: number;
2343
+ photos: {
2344
+ photoId: string;
2345
+ thumbnail: string;
2346
+ url: string;
2347
+ bkUrl: string;
2348
+ }[];
2349
+ };
2350
+ declare const getAvatarListFactory: (ctx: ContextBase, api: API) => (count?: number, page?: number) => Promise<GetAvatarListResponse>;
2351
+
2352
+ type DisperseGroupResponse = "";
2353
+ declare const disperseGroupFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<"">;
2354
+
2355
+ type CreateNoteOptions = {
2356
+ title: string;
2357
+ pinAct?: boolean;
2358
+ };
2359
+ type CreateNoteResponse = NoteDetail;
2360
+ declare const createNoteFactory: (ctx: ContextBase, api: API) => (options: CreateNoteOptions, groupId: string) => Promise<NoteDetail>;
2361
+
2362
+ type UnBlockUserResponse = "";
2363
+ declare const unblockUserFactory: (ctx: ContextBase, api: API) => (userId: string) => Promise<"">;
2364
+
2365
+ type LockPollResponse = "";
2366
+ declare const lockPollFactory: (ctx: ContextBase, api: API) => (pollId: number) => Promise<"">;
2367
+
2368
+ type EditNoteOptions = {
2369
+ /**
2370
+ * New note title
2371
+ */
2372
+ title: string;
2373
+ /**
2374
+ * Topic ID to edit note from
2375
+ */
2376
+ topicId: string;
2377
+ /**
2378
+ * Should the note be pinned?
2379
+ */
2380
+ pinAct?: boolean;
2381
+ };
2382
+ type EditNoteResponse = NoteDetail;
2383
+ declare const editNoteFactory: (ctx: ContextBase, api: API) => (options: EditNoteOptions, groupId: string) => Promise<NoteDetail>;
2384
+
2385
+ type CreateProductCatalogPayload = {
2386
+ catalogId: string;
2387
+ productName: string;
2388
+ price: string;
2389
+ description: string;
2390
+ /**
2391
+ * Upto 5 media files are allowed, will be ignored if product_photos is provided
2392
+ */
2393
+ files?: AttachmentSource[];
2394
+ /**
2395
+ * List of product photo URLs, upto 5
2396
+ *
2397
+ * You can manually get the URL using `uploadProductPhoto` api
2398
+ */
2399
+ product_photos?: string[];
2400
+ };
2401
+ type CreateProductCatalogResponse = {
2402
+ item: ProductCatalogItem;
2403
+ version_ls_catalog: number;
2404
+ version_catalog: number;
2405
+ };
2406
+ declare const createProductCatalogFactory: (ctx: ContextBase, api: API) => (payload: CreateProductCatalogPayload) => Promise<CreateProductCatalogResponse>;
2407
+
2408
+ type ChangeAccountAvatarResponse = "";
2409
+ declare const changeAccountAvatarFactory: (ctx: ContextBase, api: API) => (avatarSource: AttachmentSource) => Promise<"">;
2410
+
2411
+ declare enum UpdateLangAvailableLanguages {
2412
+ VI = "VI",
2413
+ EN = "EN"
2414
+ }
2415
+ type UpdateLangResponse = "";
2416
+ declare const updateLangFactory: (ctx: ContextBase, api: API) => (language?: UpdateLangAvailableLanguages) => Promise<"">;
2417
+
2418
+ type GetArchivedChatListResponse = {
2419
+ items: unknown[];
2420
+ version: number;
2421
+ };
2422
+ declare const getArchivedChatListFactory: (ctx: ContextBase, api: API) => () => Promise<GetArchivedChatListResponse>;
2423
+
2424
+ type RemoveFriendAliasResponse = "";
2425
+ declare const removeFriendAliasFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2426
+
2427
+ type GetQRResponse = {
2428
+ [userId: string]: string;
2429
+ };
2430
+ declare const getQRFactory: (ctx: ContextBase, api: API) => (userId: string | string[]) => Promise<GetQRResponse>;
2431
+
2432
+ type SendStickerPayload = {
2433
+ id: number;
2434
+ cateId: number;
2435
+ type: number;
2436
+ };
2437
+ type SendStickerResponse = {
2438
+ msgId: number;
2439
+ };
2440
+ declare const sendStickerFactory: (ctx: ContextBase, api: API) => (sticker: SendStickerPayload, threadId: string, type?: ThreadType) => Promise<SendStickerResponse>;
2441
+
2442
+ type FriendRecommendationsCollapseMsgListConfig = {
2443
+ collapseId: number;
2444
+ collapseXItem: number;
2445
+ collapseYItem: number;
2446
+ };
2447
+ type FriendRecommendationsDataInfo = {
2448
+ userId: string;
2449
+ zaloName: string;
2450
+ displayName: string;
2451
+ avatar: string;
2452
+ phoneNumber: string;
2453
+ status: string;
2454
+ gender: Gender;
2455
+ dob: number;
2456
+ type: number;
2457
+ recommType: number;
2458
+ recommSrc: number;
2459
+ recommTime: number;
2460
+ recommInfo: {
2461
+ suggestWay: number;
2462
+ source: number;
2463
+ message: string;
2464
+ customText: string | null;
2465
+ };
2466
+ bizPkg: ZBusinessPackage;
2467
+ isSeenFriendReq: boolean;
2468
+ };
2469
+ type FriendRecommendationsRecommItem = {
2470
+ recommItemType: number;
2471
+ dataInfo: FriendRecommendationsDataInfo;
2472
+ };
2473
+ type GetFriendRecommendationsResponse = {
2474
+ expiredDuration: number;
2475
+ collapseMsgListConfig: FriendRecommendationsCollapseMsgListConfig;
2476
+ recommItems: FriendRecommendationsRecommItem[];
2477
+ };
2478
+ declare const getFriendRecommendationsFactory: (ctx: ContextBase, api: API) => () => Promise<GetFriendRecommendationsResponse>;
2479
+
2480
+ type UpdateLabelsPayload = {
2481
+ labelData: LabelData[];
2482
+ version: number;
2483
+ };
2484
+ type UpdateLabelsResponse = {
2485
+ labelData: LabelData[];
2486
+ version: number;
2487
+ lastUpdateTime: number;
2488
+ };
2489
+ declare const updateLabelsFactory: (ctx: ContextBase, api: API) => (payload: UpdateLabelsPayload) => Promise<{
2490
+ labelData: any;
2491
+ version: number;
2492
+ lastUpdateTime: number;
2493
+ }>;
2494
+
2495
+ type UpdateActiveStatusResponse = {
2496
+ status: boolean;
2497
+ };
2498
+ declare const updateActiveStatusFactory: (ctx: ContextBase, api: API) => (active: boolean) => Promise<UpdateActiveStatusResponse>;
2499
+
2500
+ type SendTypingEventResponse = {
2501
+ status: number;
2502
+ };
2503
+ declare const sendTypingEventFactory: (ctx: ContextBase, api: API) => (threadId: string, type?: ThreadType, destType?: DestType) => Promise<SendTypingEventResponse>;
2504
+
2505
+ type RemoveGroupBlockedMemberResponse = "";
2506
+ declare const removeGroupBlockedMemberFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<"">;
2507
+
2508
+ type GetAutoDeleteChatResponse = {
2509
+ convers: {
2510
+ destId: string;
2511
+ isGroup: boolean;
2512
+ ttl: number;
2513
+ createdAt: number;
2514
+ }[];
2515
+ };
2516
+ declare const getAutoDeleteChatFactory: (ctx: ContextBase, api: API) => () => Promise<GetAutoDeleteChatResponse>;
2517
+
2518
+ type GetAliasListResponse = {
2519
+ items: {
2520
+ userId: string;
2521
+ alias: string;
2522
+ }[];
2523
+ updateTime: string;
2524
+ };
2525
+ declare const getAliasListFactory: (ctx: ContextBase, api: API) => (count?: number, page?: number) => Promise<GetAliasListResponse>;
2526
+
2527
+ type GetLabelsResponse = {
2528
+ labelData: LabelData[];
2529
+ version: number;
2530
+ lastUpdateTime: number;
2531
+ };
2532
+ declare const getLabelsFactory: (ctx: ContextBase, api: API) => () => Promise<GetLabelsResponse>;
2533
+
2534
+ type AddQuickMessagePayload = {
2535
+ keyword: string;
2536
+ title: string;
2537
+ media?: AttachmentSource;
2538
+ };
2539
+ type AddQuickMessageResponse = {
2540
+ item: QuickMessage;
2541
+ version: number;
2542
+ };
2543
+ declare const addQuickMessageFactory: (ctx: ContextBase, api: API) => (addPayload: AddQuickMessagePayload) => Promise<AddQuickMessageResponse>;
2544
+
2545
+ type GetPinConversationsResponse = {
2546
+ conversations: string[];
2547
+ version: number;
2548
+ };
2549
+ declare const getPinConversationsFactory: (ctx: ContextBase, api: API) => () => Promise<GetPinConversationsResponse>;
2550
+
2551
+ type SendVoiceOptions = {
2552
+ voiceUrl: string;
2553
+ /**
2554
+ * Time to live in milliseconds (default: 0)
2555
+ */
2556
+ ttl?: number;
2557
+ };
2558
+ type SendVoiceResponse = {
2559
+ msgId: string;
2560
+ };
2561
+ declare const sendVoiceFactory: (ctx: ContextBase, api: API) => (options: SendVoiceOptions, threadId: string, type?: ThreadType) => Promise<SendVoiceResponse>;
2562
+
2563
+ type KeepAliveResponse = {
2564
+ config_vesion: number;
2565
+ };
2566
+ declare const keepAliveFactory: (ctx: ContextBase, api: API) => () => Promise<KeepAliveResponse>;
2567
+
2568
+ type SendSeenEventResponse = {
2569
+ status: number;
2570
+ };
2571
+ type SendSeenEventMessageParams = {
2572
+ msgId: string;
2573
+ cliMsgId: string;
2574
+ uidFrom: string;
2575
+ idTo: string;
2576
+ msgType: string;
2577
+ st: number;
2578
+ at: number;
2579
+ cmd: number;
2580
+ ts: string | number;
2581
+ };
2582
+ declare const sendSeenEventFactory: (ctx: ContextBase, api: API) => (messages: SendSeenEventMessageParams | SendSeenEventMessageParams[], type?: ThreadType) => Promise<SendSeenEventResponse>;
2583
+
2584
+ type LeaveGroupResponse = {
2585
+ memberError: unknown[];
2586
+ };
2587
+ declare const leaveGroupFactory: (ctx: ContextBase, api: API) => (groupId: string, silent?: boolean) => Promise<LeaveGroupResponse>;
2588
+
2589
+ type AcceptFriendRequestResponse = "";
2590
+ declare const acceptFriendRequestFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2591
+
2592
+ type GetReminderResponse = ReminderGroup;
2593
+ declare const getReminderFactory: (ctx: ContextBase, api: API) => (reminderId: string) => Promise<ReminderGroup>;
2594
+
2595
+ type UpdateCatalogPayload = {
2596
+ catalogId: string;
2597
+ catalogName: string;
2598
+ };
2599
+ type UpdateCatalogResponse = {
2600
+ item: CatalogItem;
2601
+ version_ls_catalog: number;
2602
+ version_catalog: number;
2603
+ };
2604
+ declare const updateCatalogFactory: (ctx: ContextBase, api: API) => (payload: UpdateCatalogPayload) => Promise<UpdateCatalogResponse>;
2605
+
2606
+ type CreateGroupResponse = {
2607
+ groupType: number;
2608
+ sucessMembers: string[];
2609
+ groupId: string;
2610
+ errorMembers: string[];
2611
+ error_data: Record<string, unknown>;
2612
+ };
2613
+ type CreateGroupOptions = {
2614
+ /**
2615
+ * Group name
2616
+ */
2617
+ name?: string;
2618
+ /**
2619
+ * List of member IDs to add to the group
2620
+ */
2621
+ members: string[];
2622
+ /**
2623
+ * Avatar source, can be a file path or an Attachment object
2624
+ */
2625
+ avatarSource?: AttachmentSource;
2626
+ /**
2627
+ * Path to the avatar image file
2628
+ * @deprecated Use `avatarSource` instead
2629
+ */
2630
+ avatarPath?: string;
2631
+ };
2632
+ declare const createGroupFactory: (ctx: ContextBase, api: API) => (options: CreateGroupOptions) => Promise<CreateGroupResponse>;
2633
+
2634
+ type SentFriendRequestInfo = {
2635
+ userId: string;
2636
+ zaloName: string;
2637
+ displayName: string;
2638
+ avatar: string;
2639
+ globalId: string;
2640
+ bizPkg: ZBusinessPackage;
2641
+ fReqInfo: {
2642
+ message: string;
2643
+ src: number;
2644
+ time: number;
2645
+ };
2646
+ };
2647
+ type GetSentFriendRequestResponse = {
2648
+ [userId: string]: SentFriendRequestInfo;
2649
+ };
2650
+ declare const getSentFriendRequestFactory: (ctx: ContextBase, api: API) => () => Promise<GetSentFriendRequestResponse>;
2651
+
2652
+ type DeleteAvatarResponse = {
2653
+ delPhotoIds: string[];
2654
+ errMap: {
2655
+ [key: string]: {
2656
+ err: number;
2657
+ };
2658
+ };
2659
+ };
2660
+ declare const deleteAvatarFactory: (ctx: ContextBase, api: API) => (photoId: string | string[]) => Promise<DeleteAvatarResponse>;
2661
+
2662
+ type UnreadMark = {
2663
+ id: number;
2664
+ cliMsgId: number;
2665
+ fromUid: number;
2666
+ ts: number;
2667
+ };
2668
+ type GetUnreadMarkResponse = {
2669
+ data: {
2670
+ convsGroup: UnreadMark[];
2671
+ convsUser: UnreadMark[];
2672
+ };
2673
+ status: number;
2674
+ };
2675
+ declare const getUnreadMarkFactory: (ctx: ContextBase, api: API) => () => Promise<GetUnreadMarkResponse>;
2676
+
2677
+ type GetAutoReplyListResponse = {
2678
+ item: AutoReplyItem[];
2679
+ version: number;
2680
+ };
2681
+ declare const getAutoReplyListFactory: (ctx: ContextBase, api: API) => () => Promise<GetAutoReplyListResponse>;
2682
+
2683
+ type GetAllFriendsResponse = User[];
2684
+ declare const getAllFriendsFactory: (ctx: ContextBase, api: API) => (count?: number, page?: number) => Promise<GetAllFriendsResponse>;
2685
+
2686
+ type GetGroupLinkDetailResponse = {
2687
+ link?: string;
2688
+ expiration_date?: number;
2689
+ /**
2690
+ * 1: enabled, 0: disabled
2691
+ */
2692
+ enabled: number;
2693
+ };
2694
+ declare const getGroupLinkDetailFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<GetGroupLinkDetailResponse>;
2695
+
2696
+ type CreateCatalogResponse = {
2697
+ item: CatalogItem;
2698
+ version_ls_catalog: number;
2699
+ version_catalog: number;
2700
+ };
2701
+ declare const createCatalogFactory: (ctx: ContextBase, api: API) => (catalogName: string) => Promise<CreateCatalogResponse>;
2702
+
2703
+ type EnableGroupLinkResponse = {
2704
+ link: string;
2705
+ expiration_date: number;
2706
+ enabled: number;
2707
+ };
2708
+ declare const enableGroupLinkFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<EnableGroupLinkResponse>;
2709
+
2710
+ type PollDetailResponse = PollDetail;
2711
+ declare const getPollDetailFactory: (ctx: ContextBase, api: API) => (pollId: number) => Promise<PollDetail>;
2712
+
2713
+ type BlockViewFeedResponse = "";
2714
+ declare const blockViewFeedFactory: (ctx: ContextBase, api: API) => (isBlockFeed: boolean, userId: string) => Promise<"">;
2715
+
2716
+ type UpdateProductCatalogPayload = {
2717
+ catalogId: string;
2718
+ productId: string;
2719
+ productName: string;
2720
+ price: string;
2721
+ description: string;
2722
+ createTime: number;
2723
+ /**
2724
+ * Upto 5 media files are allowed, will be ignored if product_photos is provided
2725
+ */
2726
+ files?: AttachmentSource[];
2727
+ /**
2728
+ * List of product photo URLs, upto 5
2729
+ *
2730
+ * You can manually get the URL using `uploadProductPhoto` api
2731
+ */
2732
+ product_photos?: string[];
2733
+ };
2734
+ type UpdateProductCatalogResponse = {
2735
+ item: ProductCatalogItem;
2736
+ version_ls_catalog: number;
2737
+ version_catalog: number;
2738
+ };
2739
+ declare const updateProductCatalogFactory: (ctx: ContextBase, api: API) => (payload: UpdateProductCatalogPayload) => Promise<UpdateProductCatalogResponse>;
2740
+
2741
+ type SendVideoOptions = {
2742
+ /**
2743
+ * Optional message to send along with the video
2744
+ */
2745
+ msg?: string;
2746
+ /**
2747
+ * URL of the video
2748
+ */
2749
+ videoUrl: string;
2750
+ /**
2751
+ * URL of the thumbnail
2752
+ */
2753
+ thumbnailUrl: string;
2754
+ /**
2755
+ * Video duration in milliseconds || Eg: video duration: 5.5s => 5.5 * 1000 = 5500
2756
+ */
2757
+ duration?: number;
2758
+ /**
2759
+ * Width of the video
2760
+ */
2761
+ width?: number;
2762
+ /**
2763
+ * Height of the video
2764
+ */
2765
+ height?: number;
2766
+ /**
2767
+ * Time to live in milliseconds (default: 0)
2768
+ */
2769
+ ttl?: number;
2770
+ };
2771
+ type SendVideoResponse = {
2772
+ msgId: number;
2773
+ };
2774
+ declare const sendVideoFactory: (ctx: ContextBase, api: API) => (options: SendVideoOptions, threadId: string, type?: ThreadType) => Promise<SendVideoResponse>;
2775
+
2776
+ type GetCatalogListPayload = {
2777
+ /**
2778
+ * Number of items to retrieve (default: 20)
2779
+ */
2780
+ limit?: number;
2781
+ lastProductId?: number;
2782
+ /**
2783
+ * Page number (default: 0)
2784
+ */
2785
+ page?: number;
2786
+ };
2787
+ type GetCatalogListResponse = {
2788
+ items: CatalogItem[];
2789
+ version: number;
2790
+ has_more: number;
2791
+ };
2792
+ declare const getCatalogListFactory: (ctx: ContextBase, api: API) => (payload?: GetCatalogListPayload) => Promise<GetCatalogListResponse>;
2793
+
2794
+ type ProfileInfo = User;
2795
+ type UserInfoResponse = {
2796
+ unchanged_profiles: Record<string, unknown>;
2797
+ phonebook_version: number;
2798
+ changed_profiles: Record<string, ProfileInfo>;
2799
+ };
2800
+ declare const getUserInfoFactory: (ctx: ContextBase, api: API) => (userId: string | string[]) => Promise<UserInfoResponse>;
2801
+
2802
+ type SharePollResponse = "";
2803
+ declare const sharePollFactory: (ctx: ContextBase, api: API) => (pollId: number) => Promise<"">;
2804
+
2805
+ type GroupMemberProfile = {
2806
+ displayName: string;
2807
+ zaloName: string;
2808
+ avatar: string;
2809
+ accountStatus: number;
2810
+ type: number;
2811
+ lastUpdateTime: number;
2812
+ globalId: string;
2813
+ id: string;
2814
+ };
2815
+ type GetGroupMembersInfoResponse = {
2816
+ profiles: {
2817
+ [memberId: string]: GroupMemberProfile;
2818
+ };
2819
+ unchangeds_profile: unknown[];
2820
+ };
2821
+ declare const getGroupMembersInfoFactory: (ctx: ContextBase, api: API) => (memberId: string | string[]) => Promise<GetGroupMembersInfoResponse>;
2822
+
2823
+ type RemoveUnreadMarkResponse = {
2824
+ data: {
2825
+ updateId: number;
2826
+ };
2827
+ status: number;
2828
+ };
2829
+ declare const removeUnreadMarkFactory: (ctx: ContextBase, api: API) => (threadId: string, type?: ThreadType) => Promise<RemoveUnreadMarkResponse>;
2830
+
2831
+ type GetFriendBoardListResponse = {
2832
+ data: string[];
2833
+ version: number;
2834
+ };
2835
+ declare const getFriendBoardListFactory: (ctx: ContextBase, api: API) => (conversationId: string) => Promise<GetFriendBoardListResponse>;
2836
+
2837
+ type AddReactionResponse = {
2838
+ msgIds: number[];
2839
+ };
2840
+ type CustomReaction = {
2841
+ rType: number;
2842
+ source: number;
2843
+ icon: string;
2844
+ };
2845
+ type AddReactionDestination = {
2846
+ data: {
2847
+ msgId: string;
2848
+ cliMsgId: string;
2849
+ };
2850
+ threadId: string;
2851
+ type: ThreadType;
2852
+ };
2853
+ declare const addReactionFactory: (ctx: ContextBase, api: API) => (icon: Reactions | CustomReaction, dest: AddReactionDestination) => Promise<AddReactionResponse>;
2854
+
2855
+ type RemoveFriendResponse = "";
2856
+ declare const removeFriendFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<"">;
2857
+
2858
+ declare enum ChatTTL {
2859
+ NO_DELETE = 0,
2860
+ ONE_DAY = 86400000,
2861
+ SEVEN_DAYS = 604800000,
2862
+ FOURTEEN_DAYS = 1209600000
2863
+ }
2864
+ type UpdateAutoDeleteChatResponse = "";
2865
+ declare const updateAutoDeleteChatFactory: (ctx: ContextBase, api: API) => (ttl: ChatTTL, threadId: string, type?: ThreadType) => Promise<"">;
2866
+
2867
+ type UpdateHiddenConversPinResponse = "";
2868
+ declare const updateHiddenConversPinFactory: (ctx: ContextBase, api: API) => (pin: string) => Promise<"">;
2869
+
2870
+ type SendCardOptions = {
2871
+ userId: string;
2872
+ phoneNumber?: string;
2873
+ ttl?: number;
2874
+ };
2875
+ type SendCardResponse = {
2876
+ msgId: number;
2877
+ };
2878
+ declare const sendCardFactory: (ctx: ContextBase, api: API) => (options: SendCardOptions, threadId: string, type?: ThreadType) => Promise<SendCardResponse>;
2879
+
2880
+ type GetRelatedFriendGroupResponse = {
2881
+ groupRelateds: {
2882
+ [friendId: string]: string[];
2883
+ };
2884
+ };
2885
+ declare const getRelatedFriendGroupFactory: (ctx: ContextBase, api: API) => (friendId: string | string[]) => Promise<GetRelatedFriendGroupResponse>;
2886
+
2887
+ type InviteUserToGroupsResponse = {
2888
+ grid_message_map: {
2889
+ [groupId: string]: {
2890
+ error_code: number;
2891
+ error_message: string;
2892
+ data: string | null;
2893
+ };
2894
+ };
2895
+ };
2896
+ declare const inviteUserToGroupsFactory: (ctx: ContextBase, api: API) => (userId: string, groupId: string | string[]) => Promise<InviteUserToGroupsResponse>;
2897
+
2898
+ type BlockUserResponse = "";
2899
+ declare const blockUserFactory: (ctx: ContextBase, api: API) => (userId: string) => Promise<"">;
2900
+
2901
+ type SendMessageResult = {
2902
+ msgId: number;
2903
+ };
2904
+ type SendMessageResponse = {
2905
+ message: SendMessageResult | null;
2906
+ attachment: SendMessageResult[];
2907
+ };
2908
+ type SendMessageQuote = {
2909
+ content: TMessage["content"];
2910
+ msgType: TMessage["msgType"];
2911
+ propertyExt: TMessage["propertyExt"];
2912
+ uidFrom: TMessage["uidFrom"];
2913
+ msgId: TMessage["msgId"];
2914
+ cliMsgId: TMessage["cliMsgId"];
2915
+ ts: TMessage["ts"];
2916
+ ttl: TMessage["ttl"];
2917
+ };
2918
+ declare enum TextStyle {
2919
+ Bold = "b",
2920
+ Italic = "i",
2921
+ Underline = "u",
2922
+ StrikeThrough = "s",
2923
+ Red = "c_db342e",
2924
+ Orange = "c_f27806",
2925
+ Yellow = "c_f7b503",
2926
+ Green = "c_15a85f",
2927
+ Small = "f_13",
2928
+ Big = "f_18",
2929
+ UnorderedList = "lst_1",
2930
+ OrderedList = "lst_2",
2931
+ Indent = "ind_$"
2932
+ }
2933
+ type Style = {
2934
+ start: number;
2935
+ len: number;
2936
+ st: Exclude<TextStyle, TextStyle.Indent>;
2937
+ } | {
2938
+ start: number;
2939
+ len: number;
2940
+ st: TextStyle.Indent;
2941
+ /**
2942
+ * Number of spaces used for indentation.
2943
+ */
2944
+ indentSize?: number;
2945
+ };
2946
+ declare enum Urgency {
2947
+ Default = 0,
2948
+ Important = 1,
2949
+ Urgent = 2
2950
+ }
2951
+ type Mention = {
2952
+ /**
2953
+ * mention position
2954
+ */
2955
+ pos: number;
2956
+ /**
2957
+ * id of the mentioned user
2958
+ */
2959
+ uid: string;
2960
+ /**
2961
+ * length of the mention
2962
+ */
2963
+ len: number;
2964
+ };
2965
+ type MessageContent = {
2966
+ /**
2967
+ * Text content of the message
2968
+ */
2969
+ msg: string;
2970
+ /**
2971
+ * Text styles
2972
+ */
2973
+ styles?: Style[];
2974
+ /**
2975
+ * Urgency of the message
2976
+ */
2977
+ urgency?: Urgency;
2978
+ /**
2979
+ * Quoted message (optional)
2980
+ */
2981
+ quote?: SendMessageQuote;
2982
+ /**
2983
+ * Mentions in the message (optional)
2984
+ */
2985
+ mentions?: Mention[];
2986
+ /**
2987
+ * Attachments in the message (optional)
2988
+ */
2989
+ attachments?: AttachmentSource | AttachmentSource[];
2990
+ /**
2991
+ * Time to live in milliseconds
2992
+ */
2993
+ ttl?: number;
2994
+ };
2995
+ declare const sendMessageFactory: (ctx: ContextBase, api: API) => (message: MessageContent | string, threadId: string, type?: ThreadType) => Promise<{
2996
+ message: SendMessageResult | null;
2997
+ attachment: SendMessageResult[];
2998
+ }>;
2999
+
3000
+ type UpdateProfilePayload = {
3001
+ profile: {
3002
+ name: string;
3003
+ /**
3004
+ * Date of birth in the format YYYY-MM-DD
3005
+ */
3006
+ dob: `${string}-${string}-${string}`;
3007
+ gender: Gender;
3008
+ };
3009
+ biz?: Partial<{
3010
+ cate: BusinessCategory;
3011
+ description: string;
3012
+ address: string;
3013
+ website: string;
3014
+ email: string;
3015
+ }>;
3016
+ };
3017
+ type UpdateProfileResponse = "";
3018
+ declare const updateProfileFactory: (ctx: ContextBase, api: API) => (payload: UpdateProfilePayload) => Promise<"">;
3019
+
3020
+ type GetHiddenConversationsResponse = {
3021
+ pin: string;
3022
+ threads: {
3023
+ /**
3024
+ * 1: true, 0: false
3025
+ */
3026
+ is_group: number;
3027
+ thread_id: string;
3028
+ }[];
3029
+ };
3030
+ declare const getHiddenConversationsFactory: (ctx: ContextBase, api: API) => () => Promise<GetHiddenConversationsResponse>;
3031
+
3032
+ type GetBizAccountResponse = {
3033
+ biz?: {
3034
+ desc: string | null;
3035
+ cate: BusinessCategory;
3036
+ addr: string;
3037
+ website: string;
3038
+ email: string;
3039
+ };
3040
+ setting_start_page?: {
3041
+ enable_biz_label: number;
3042
+ enable_cate: number;
3043
+ enable_add: number;
3044
+ cta_profile: number;
3045
+ /**
3046
+ * Relative path used to build the catalog URL.
3047
+ *
3048
+ * Example: https://catalog.zalo.me/${cta_catalog}
3049
+ */
3050
+ cta_catalog: string | null;
3051
+ } | null;
3052
+ pkgId: number;
3053
+ };
3054
+ declare const getBizAccountFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<GetBizAccountResponse>;
3055
+
3056
+ type GetFriendRequestStatusResponse = {
3057
+ addFriendPrivacy: number;
3058
+ isSeenFriendReq: boolean;
3059
+ is_friend: number;
3060
+ is_requested: number;
3061
+ is_requesting: number;
3062
+ };
3063
+ declare const getFriendRequestStatusFactory: (ctx: ContextBase, api: API) => (friendId: string) => Promise<GetFriendRequestStatusResponse>;
3064
+
3065
+ type FetchAccountInfoResponse = User;
3066
+ declare const fetchAccountInfoFactory: (ctx: ContextBase, api: API) => () => Promise<User>;
3067
+
3068
+ type DisableGroupLinkResponse = "";
3069
+ declare const disableGroupLinkFactory: (ctx: ContextBase, api: API) => (groupId: string) => Promise<"">;
3070
+
3071
+ type RemoveQuickMessageResponse = {
3072
+ itemIds: number[];
3073
+ version: number;
3074
+ };
3075
+ declare const removeQuickMessageFactory: (ctx: ContextBase, api: API) => (itemIds: number | number[]) => Promise<RemoveQuickMessageResponse>;
3076
+
3077
+ type RemoveReminderResponse = "" | number;
3078
+ declare const removeReminderFactory: (ctx: ContextBase, api: API) => (reminderId: string, threadId: string, type?: ThreadType) => Promise<RemoveReminderResponse>;
3079
+
3080
+ type DeleteGroupInviteBoxResponse = {
3081
+ delInvitaionIds: string[];
3082
+ errMap: {
3083
+ [groupId: string]: {
3084
+ err: number;
3085
+ };
3086
+ };
3087
+ };
3088
+ declare const deleteGroupInviteBoxFactory: (ctx: ContextBase, api: API) => (groupId: string | string[], blockFutureInvite?: boolean) => Promise<DeleteGroupInviteBoxResponse>;
3089
+
3090
+ type AddUnreadMarkResponse = {
3091
+ data: {
3092
+ updateId: number;
3093
+ };
3094
+ status: number;
3095
+ };
3096
+ declare const addUnreadMarkFactory: (ctx: ContextBase, api: API) => (threadId: string, type?: ThreadType) => Promise<AddUnreadMarkResponse>;
3097
+
3098
+ type GetQuickMessageListResponse = {
3099
+ cursor: number;
3100
+ version: number;
3101
+ items: QuickMessage[];
3102
+ };
3103
+ declare const getQuickMessageListFactory: (ctx: ContextBase, api: API) => () => Promise<GetQuickMessageListResponse>;
3104
+
3105
+ type GetGroupInviteBoxInfoPayload = {
3106
+ groupId: string;
3107
+ mpage?: number;
3108
+ mcount?: number;
3109
+ };
3110
+ type GetGroupInviteBoxInfoResponse = {
3111
+ groupInfo: GroupInfo & {
3112
+ topic?: Omit<GroupTopic, "action">;
3113
+ };
3114
+ inviterInfo: {
3115
+ id: string;
3116
+ dName: string;
3117
+ zaloName: string;
3118
+ avatar: string;
3119
+ avatar_25: string;
3120
+ accountStatus: number;
3121
+ type: number;
3122
+ };
3123
+ grCreatorInfo: {
3124
+ id: string;
3125
+ dName: string;
3126
+ zaloName: string;
3127
+ avatar: string;
3128
+ avatar_25: string;
3129
+ accountStatus: number;
3130
+ type: number;
3131
+ };
3132
+ expiredTs: string;
3133
+ type: number;
3134
+ };
3135
+ declare const getGroupInviteBoxInfoFactory: (ctx: ContextBase, api: API) => (payload: GetGroupInviteBoxInfoPayload) => Promise<GetGroupInviteBoxInfoResponse>;
3136
+
3137
+ type GetSettingsResponse = UserSetting;
3138
+ declare const getSettingsFactory: (ctx: ContextBase, api: API) => () => Promise<UserSetting>;
3139
+
3140
+ type AddGroupBlockedMemberResponse = "";
3141
+ declare const addGroupBlockedMemberFactory: (ctx: ContextBase, api: API) => (memberId: string | string[], groupId: string) => Promise<"">;
3142
+
3143
+ declare const getStickersFactory: (ctx: ContextBase, api: API) => (keyword: string) => Promise<number[]>;
3144
+
3145
+ type StickerDetail = {
3146
+ id: number;
3147
+ cateId: number;
3148
+ type: number;
3149
+ text: string;
3150
+ uri: string;
3151
+ fkey: number;
3152
+ status: number;
3153
+ stickerUrl: string;
3154
+ stickerSpriteUrl: string;
3155
+ stickerWebpUrl: unknown;
3156
+ totalFrames: number;
3157
+ duration: number;
3158
+ effectId: number;
3159
+ checksum: string;
3160
+ ext: number;
3161
+ source: number;
3162
+ fss: unknown;
3163
+ fssInfo: unknown;
3164
+ version: number;
3165
+ extInfo: unknown;
3166
+ };
3167
+ type StickerDetailResponse = StickerDetail[];
3168
+ declare const getStickersDetailFactory: (ctx: ContextBase, api: API) => (stickerIds: number | number[]) => Promise<StickerDetailResponse>;
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
+ getListReminder: ReturnType<typeof getListReminderFactory>;
3221
+ removeUserFromGroup: ReturnType<typeof removeUserFromGroupFactory>;
3222
+ createReminder: ReturnType<typeof createReminderFactory>;
3223
+ sendReport: ReturnType<typeof sendReportFactory>;
3224
+ getGroupInviteBoxList: ReturnType<typeof getGroupInviteBoxListFactory>;
3225
+ setMute: ReturnType<typeof setMuteFactory>;
3226
+ getListBoard: ReturnType<typeof getListBoardFactory>;
3227
+ deleteChat: ReturnType<typeof deleteChatFactory>;
3228
+ changeGroupName: ReturnType<typeof changeGroupNameFactory>;
3229
+ updateGroupSettings: ReturnType<typeof updateGroupSettingsFactory>;
3230
+ addPollOptions: ReturnType<typeof addPollOptionsFactory>;
3231
+ getReminderResponses: ReturnType<typeof getReminderResponsesFactory>;
3232
+ getMute: ReturnType<typeof getMuteFactory>;
3233
+ parseLink: ReturnType<typeof parseLinkFactory>;
3234
+ changeGroupOwner: ReturnType<typeof changeGroupOwnerFactory>;
3235
+ uploadAttachment: ReturnType<typeof uploadAttachmentFactory>;
3236
+ getProductCatalogList: ReturnType<typeof getProductCatalogListFactory>;
3237
+ deleteCatalog: ReturnType<typeof deleteCatalogFactory>;
3238
+ lastOnline: ReturnType<typeof lastOnlineFactory>;
3239
+ getGroupLinkInfo: ReturnType<typeof getGroupLinkInfoFactory>;
3240
+ forwardMessage: ReturnType<typeof forwardMessageFactory>;
3241
+ getCookie: ReturnType<typeof getCookieFactory>;
3242
+ updateAutoReply: ReturnType<typeof updateAutoReplyFactory>;
3243
+ changeFriendAlias: ReturnType<typeof changeFriendAliasFactory>;
3244
+ findUser: ReturnType<typeof findUserFactory>;
3245
+ editReminder: ReturnType<typeof editReminderFactory>;
3246
+ reuseAvatar: ReturnType<typeof reuseAvatarFactory>;
3247
+ getFriendOnlines: ReturnType<typeof getFriendOnlinesFactory>;
3248
+ uploadProductPhoto: ReturnType<typeof uploadProductPhotoFactory>;
3249
+ sendBankCard: ReturnType<typeof sendBankCardFactory>;
3250
+ getGroupInfo: ReturnType<typeof getGroupInfoFactory>;
3251
+ deleteMessage: ReturnType<typeof deleteMessageFactory>;
3252
+ votePoll: ReturnType<typeof votePollFactory>;
3253
+ sendFriendRequest: ReturnType<typeof sendFriendRequestFactory>;
3254
+ resetHiddenConversPin: ReturnType<typeof resetHiddenConversPinFactory>;
3255
+ addUserToGroup: ReturnType<typeof addUserToGroupFactory>;
3256
+ deleteProductCatalog: ReturnType<typeof deleteProductCatalogFactory>;
3257
+ getOwnId: ReturnType<typeof getOwnIdFactory>;
3258
+ undo: ReturnType<typeof undoFactory>;
3259
+ joinGroupInviteBox: ReturnType<typeof joinGroupInviteBoxFactory>;
3260
+ deleteAutoReply: ReturnType<typeof deleteAutoReplyFactory>;
3261
+ setPinnedConversations: ReturnType<typeof setPinnedConversationsFactory>;
3262
+ undoFriendRequest: ReturnType<typeof undoFriendRequestFactory>;
3263
+ getPendingGroupMembers: ReturnType<typeof getPendingGroupMembersFactory>;
3264
+ removeGroupDeputy: ReturnType<typeof removeGroupDeputyFactory>;
3265
+ getAllGroups: ReturnType<typeof getAllGroupsFactory>;
3266
+ changeGroupAvatar: ReturnType<typeof changeGroupAvatarFactory>;
3267
+ updateQuickMessage: ReturnType<typeof updateQuickMessageFactory>;
3268
+ reviewPendingMemberRequest: ReturnType<typeof reviewPendingMemberRequestFactory>;
3269
+ addGroupDeputy: ReturnType<typeof addGroupDeputyFactory>;
3270
+ rejectFriendRequest: ReturnType<typeof rejectFriendRequestFactory>;
3271
+ createPoll: ReturnType<typeof createPollFactory>;
3272
+ sendLink: ReturnType<typeof sendLinkFactory>;
3273
+ createAutoReply: ReturnType<typeof createAutoReplyFactory>;
3274
+ setHiddenConversations: ReturnType<typeof setHiddenConversationsFactory>;
3275
+ getContext: ReturnType<typeof getContextFactory>;
3276
+ joinGroupLink: ReturnType<typeof joinGroupLinkFactory>;
3277
+ getGroupBlockedMember: ReturnType<typeof getGroupBlockedMemberFactory>;
3278
+ updateSettings: ReturnType<typeof updateSettingsFactory>;
3279
+ sendDeliveredEvent: ReturnType<typeof sendDeliveredEventFactory>;
3280
+ getAvatarList: ReturnType<typeof getAvatarListFactory>;
3281
+ disperseGroup: ReturnType<typeof disperseGroupFactory>;
3282
+ createNote: ReturnType<typeof createNoteFactory>;
3283
+ unblockUser: ReturnType<typeof unblockUserFactory>;
3284
+ lockPoll: ReturnType<typeof lockPollFactory>;
3285
+ editNote: ReturnType<typeof editNoteFactory>;
3286
+ createProductCatalog: ReturnType<typeof createProductCatalogFactory>;
3287
+ changeAccountAvatar: ReturnType<typeof changeAccountAvatarFactory>;
3288
+ updateLang: ReturnType<typeof updateLangFactory>;
3289
+ getArchivedChatList: ReturnType<typeof getArchivedChatListFactory>;
3290
+ removeFriendAlias: ReturnType<typeof removeFriendAliasFactory>;
3291
+ getQR: ReturnType<typeof getQRFactory>;
3292
+ sendSticker: ReturnType<typeof sendStickerFactory>;
3293
+ getFriendRecommendations: ReturnType<typeof getFriendRecommendationsFactory>;
3294
+ updateLabels: ReturnType<typeof updateLabelsFactory>;
3295
+ updateActiveStatus: ReturnType<typeof updateActiveStatusFactory>;
3296
+ sendTypingEvent: ReturnType<typeof sendTypingEventFactory>;
3297
+ removeGroupBlockedMember: ReturnType<typeof removeGroupBlockedMemberFactory>;
3298
+ getAutoDeleteChat: ReturnType<typeof getAutoDeleteChatFactory>;
3299
+ getAliasList: ReturnType<typeof getAliasListFactory>;
3300
+ getLabels: ReturnType<typeof getLabelsFactory>;
3301
+ addQuickMessage: ReturnType<typeof addQuickMessageFactory>;
3302
+ getPinConversations: ReturnType<typeof getPinConversationsFactory>;
3303
+ sendVoice: ReturnType<typeof sendVoiceFactory>;
3304
+ keepAlive: ReturnType<typeof keepAliveFactory>;
3305
+ sendSeenEvent: ReturnType<typeof sendSeenEventFactory>;
3306
+ leaveGroup: ReturnType<typeof leaveGroupFactory>;
3307
+ acceptFriendRequest: ReturnType<typeof acceptFriendRequestFactory>;
3308
+ getReminder: ReturnType<typeof getReminderFactory>;
3309
+ updateCatalog: ReturnType<typeof updateCatalogFactory>;
3310
+ createGroup: ReturnType<typeof createGroupFactory>;
3311
+ getSentFriendRequest: ReturnType<typeof getSentFriendRequestFactory>;
3312
+ deleteAvatar: ReturnType<typeof deleteAvatarFactory>;
3313
+ getUnreadMark: ReturnType<typeof getUnreadMarkFactory>;
3314
+ getAutoReplyList: ReturnType<typeof getAutoReplyListFactory>;
3315
+ getAllFriends: ReturnType<typeof getAllFriendsFactory>;
3316
+ getGroupLinkDetail: ReturnType<typeof getGroupLinkDetailFactory>;
3317
+ createCatalog: ReturnType<typeof createCatalogFactory>;
3318
+ enableGroupLink: ReturnType<typeof enableGroupLinkFactory>;
3319
+ getPollDetail: ReturnType<typeof getPollDetailFactory>;
3320
+ blockViewFeed: ReturnType<typeof blockViewFeedFactory>;
3321
+ updateProductCatalog: ReturnType<typeof updateProductCatalogFactory>;
3322
+ sendVideo: ReturnType<typeof sendVideoFactory>;
3323
+ getCatalogList: ReturnType<typeof getCatalogListFactory>;
3324
+ getUserInfo: ReturnType<typeof getUserInfoFactory>;
3325
+ sharePoll: ReturnType<typeof sharePollFactory>;
3326
+ getGroupMembersInfo: ReturnType<typeof getGroupMembersInfoFactory>;
3327
+ removeUnreadMark: ReturnType<typeof removeUnreadMarkFactory>;
3328
+ getFriendBoardList: ReturnType<typeof getFriendBoardListFactory>;
3329
+ addReaction: ReturnType<typeof addReactionFactory>;
3330
+ removeFriend: ReturnType<typeof removeFriendFactory>;
3331
+ updateAutoDeleteChat: ReturnType<typeof updateAutoDeleteChatFactory>;
3332
+ updateHiddenConversPin: ReturnType<typeof updateHiddenConversPinFactory>;
3333
+ sendCard: ReturnType<typeof sendCardFactory>;
3334
+ getRelatedFriendGroup: ReturnType<typeof getRelatedFriendGroupFactory>;
3335
+ inviteUserToGroups: ReturnType<typeof inviteUserToGroupsFactory>;
3336
+ blockUser: ReturnType<typeof blockUserFactory>;
3337
+ sendMessage: ReturnType<typeof sendMessageFactory>;
3338
+ updateProfile: ReturnType<typeof updateProfileFactory>;
3339
+ getHiddenConversations: ReturnType<typeof getHiddenConversationsFactory>;
3340
+ getBizAccount: ReturnType<typeof getBizAccountFactory>;
3341
+ getFriendRequestStatus: ReturnType<typeof getFriendRequestStatusFactory>;
3342
+ fetchAccountInfo: ReturnType<typeof fetchAccountInfoFactory>;
3343
+ disableGroupLink: ReturnType<typeof disableGroupLinkFactory>;
3344
+ removeQuickMessage: ReturnType<typeof removeQuickMessageFactory>;
3345
+ removeReminder: ReturnType<typeof removeReminderFactory>;
3346
+ deleteGroupInviteBox: ReturnType<typeof deleteGroupInviteBoxFactory>;
3347
+ addUnreadMark: ReturnType<typeof addUnreadMarkFactory>;
3348
+ getQuickMessageList: ReturnType<typeof getQuickMessageListFactory>;
3349
+ getGroupInviteBoxInfo: ReturnType<typeof getGroupInviteBoxInfoFactory>;
3350
+ getSettings: ReturnType<typeof getSettingsFactory>;
3351
+ addGroupBlockedMember: ReturnType<typeof addGroupBlockedMemberFactory>;
3352
+ getStickers: ReturnType<typeof getStickersFactory>;
3353
+ getStickersDetail: ReturnType<typeof getStickersDetailFactory>;
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, type AcceptFriendRequestResponse, type AddGroupBlockedMemberResponse, type AddGroupDeputyResponse, type AddPollOptionsOption, type AddPollOptionsPayload, type AddPollOptionsResponse, type AddQuickMessagePayload, type AddQuickMessageResponse, type AddReactionDestination, type AddReactionResponse, type AddUnreadMarkResponse, type AddUserToGroupResponse, type AppContextBase, type AppContextExtended, type AttachmentSource, type AutoReplyItem, AutoReplyScope, BinBankCard, type BlockUserResponse, type BlockViewFeedResponse, type BoardItem, BoardType, BusinessCategory, BusinessCategoryName, type CatalogItem, type ChangeAccountAvatarResponse, type ChangeFriendAliasResponse, type ChangeGroupAvatarResponse, type ChangeGroupNameResponse, type ChangeGroupOwnerResponse, ChatTTL, CloseReason, type ContextBase, type ContextSession, type Cookie, type CreateAutoReplyPayload, type CreateAutoReplyResponse, type CreateCatalogResponse, type CreateGroupOptions, type CreateGroupResponse, type CreateNoteOptions, type CreateNoteResponse, type CreatePollOptions, type CreatePollResponse, type CreateProductCatalogPayload, type CreateProductCatalogResponse, type CreateReminderGroup, type CreateReminderOptions, type CreateReminderResponse, type CreateReminderUser, type Credentials, type CustomAPICallback, type CustomAPIProps, type CustomReaction, type DeleteAutoReplyResponse, type DeleteAvatarResponse, type DeleteCatalogResponse, type DeleteChatLastMessage, type DeleteChatResponse, type DeleteGroupInviteBoxResponse, type DeleteMessageDestination, type DeleteMessageResponse, type DeleteProductCatalogPayload, type DeleteProductCatalogResponse, type DeliveredMessage, DestType, type DisableGroupLinkResponse, type DisperseGroupResponse, type EditNoteOptions, type EditNoteResponse, type EditReminderGroup, type EditReminderOptions, type EditReminderResponse, type EditReminderUser, type EnableGroupLinkResponse, type FetchAccountInfoResponse, type FileData, type FindUserResponse, type ForwardMessageFail, type ForwardMessagePayload, type ForwardMessageResponse, type ForwardMessageSuccess, type FriendEvent, FriendEventType, type FriendRecommendationsCollapseMsgListConfig, type FriendRecommendationsDataInfo, type FriendRecommendationsRecommItem, Gender, type GetAliasListResponse, type GetAllFriendsResponse, type GetAllGroupsResponse, type GetArchivedChatListResponse, type GetAutoDeleteChatResponse, type GetAutoReplyListResponse, type GetAvatarListResponse, type GetBizAccountResponse, type GetCatalogListPayload, type GetCatalogListResponse, type GetFriendBoardListResponse, type GetFriendOnlinesResponse, type GetFriendOnlinesStatus, type GetFriendRecommendationsResponse, type GetFriendRequestStatusResponse, type GetGroupBlockedMemberPayload, type GetGroupBlockedMemberResponse, type GetGroupInviteBoxInfoPayload, type GetGroupInviteBoxInfoResponse, type GetGroupInviteBoxListPayload, type GetGroupInviteBoxListResponse, type GetGroupLinkDetailResponse, type GetGroupLinkInfoPayload, type GetGroupLinkInfoResponse, type GetGroupMembersInfoResponse, type GetHiddenConversationsResponse, type GetLabelsResponse, type GetListBoardResponse, type GetListReminderResponse, type GetMuteResponse, type GetPendingGroupMembersResponse, type GetPendingGroupMembersUserInfo, type GetPinConversationsResponse, type GetProductCatalogListPayload, type GetProductCatalogListResponse, type GetQRResponse, type GetQuickMessageListResponse, type GetRelatedFriendGroupResponse, type GetReminderResponse, type GetReminderResponsesResponse, type GetSentFriendRequestResponse, type GetSettingsResponse, type GetUnreadMarkResponse, type GroupCurrentMem, GroupDeliveredMessage, type GroupEvent, type GroupEventExtraData, type GroupEventGroupInfo, GroupEventType, type GroupEventUpdateMember, type GroupInfo, type GroupInfoPendingApprove, type GroupInfoResponse, type GroupMemberProfile, GroupMessage, GroupSeenMessage, type GroupSetting, type GroupTopic, type GroupTopicFileMessageParams, type GroupTopicGifMessageParams, type GroupTopicImageMessageParams, type GroupTopicMessageParams, type GroupTopicNoteParams, type GroupTopicOtherParams, type GroupTopicPollParams, type GroupTopicTextMessageParams, GroupTopicType, type GroupTopicVideoMessageParams, type GroupTopicVoiceMessageParams, GroupType, GroupTyping, type ImageData, type ImageMetadataGetter, type ImageMetadataGetterResponse, type InviteUserToGroupsResponse, type JoinGroupInviteBoxResponse, type JoinGroupLinkResponse, type KeepAliveResponse, type LabelData, type LastOnlineResponse, type LeaveGroupResponse, type ListBoardOptions, type ListReminderOptions, type LockPollResponse, type LoginQRCallback, type LoginQRCallbackEvent, LoginQRCallbackEventType, type Mention, type Message, type MessageContent, MuteAction, MuteDuration, type MuteEntriesInfo, type NoteDetail, type Options, type ParseLinkErrorMaps, type ParseLinkResponse, type PinnedMessageDetail, type PollDetail, type PollDetailResponse, type PollOptions, type ProductCatalogItem, type ProfileInfo, type QuickMessage, Reaction, Reactions, type RejectFriendRequestResponse, type ReminderGroup, type ReminderListGroup, type ReminderListUser, ReminderRepeatMode, type ReminderUser, type RemoveFriendAliasResponse, type RemoveFriendResponse, type RemoveGroupBlockedMemberResponse, type RemoveGroupDeputyResponse, type RemoveQuickMessageResponse, type RemoveReminderResponse, type RemoveUnreadMarkResponse, type RemoveUserFromGroupResponse, ReportReason, type ResetHiddenConversPinResponse, type ReuseAvatarResponse, type ReviewPendingMemberRequestPayload, type ReviewPendingMemberRequestResponse, ReviewPendingMemberRequestStatus, type SeenMessage, type SendBankCardPayload, type SendBankCardResponse, type SendCardOptions, type SendCardResponse, type SendDeliveredEventMessageParams, type SendDeliveredEventResponse, type SendFriendRequestResponse, type SendLinkOptions, type SendLinkResponse, type SendMessageQuote, type SendMessageResponse, type SendMessageResult, type SendReportOptions, type SendReportResponse, type SendSeenEventMessageParams, type SendSeenEventResponse, type SendStickerPayload, type SendStickerResponse, type SendTypingEventResponse, type SendVideoOptions, type SendVideoResponse, type SendVoiceOptions, type SendVoiceResponse, type SentFriendRequestInfo, type SetHiddenConversationsResponse, type SetMuteParams, type SetMuteResponse, type SetPinnedConversationsResponse, type SharePollResponse, type StickerDetail, type StickerDetailResponse, type Style, type TAttachmentContent, type TDeliveredMessage, type TFriendEvent, type TFriendEventBase, type TFriendEventPinCreate, type TFriendEventPinCreateTopic, type TFriendEventPinCreateTopicParams, type TFriendEventPinTopic, type TFriendEventPinUnpin, type TFriendEventRejectUndo, type TFriendEventRequest, type TFriendEventSeenRequest, type TGroupDeliveredMessage, type TGroupEvent, type TGroupEventBase, type TGroupEventBoard, type TGroupEventJoinRequest, type TGroupEventPinTopic, type TGroupEventRemindRespond, type TGroupEventRemindTopic, type TGroupEventReorderPinTopic, type TGroupMessage, type TGroupSeenMessage, type TGroupTyping, type TMention, type TMessage, type TOtherContent, type TQuote, type TReaction, type TTyping, type TUndo, type TUndoContent, type TUserSeenMessage, TextStyle, ThreadType, type Typing, type UnBlockUserResponse, Undo, type UndoFriendRequestResponse, type UndoPayload, type UndoResponse, type UnreadMark, type UpdateActiveStatusResponse, type UpdateAutoDeleteChatResponse, type UpdateAutoReplyPayload, type UpdateAutoReplyResponse, type UpdateCatalogPayload, type UpdateCatalogResponse, type UpdateGroupSettingsOptions, type UpdateGroupSettingsResponse, type UpdateHiddenConversPinResponse, type UpdateLabelsPayload, type UpdateLabelsResponse, UpdateLangAvailableLanguages, type UpdateLangResponse, type UpdateProductCatalogPayload, type UpdateProductCatalogResponse, type UpdateProfilePayload, type UpdateProfileResponse, type UpdateQuickMessagePayload, type UpdateQuickMessageResponse, type UpdateSettingsResponse, UpdateSettingsType, type UploadAttachmentFileResponse, type UploadAttachmentImageResponse, type UploadAttachmentResponse, type UploadAttachmentType, type UploadAttachmentVideoResponse, type UploadProductPhotoPayload, type UploadProductPhotoResponse, Urgency, type User, UserDeliveredMessage, type UserInfoResponse, UserMessage, UserSeenMessage, type UserSetting, UserTyping, type VotePollResponse, type ZBusinessPackage, type ZPWServiceMap, Zalo, ZaloApiError, ZaloApiLoginQRAborted, ZaloApiLoginQRDeclined, ZaloApiMissingImageMetadataGetter, initializeFriendEvent, initializeGroupEvent };