@wppconnect/wa-js 1.2.4 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/blocklist/events/eventTypes.d.ts +18 -0
  3. package/dist/blocklist/index.d.ts +0 -1
  4. package/dist/chat/{eventEmitter.d.ts → events/eventTypes.d.ts} +36 -38
  5. package/dist/chat/events/index.d.ts +3 -1
  6. package/dist/{patch.d.ts → chat/events/registerNewMessageEvent.d.ts} +0 -0
  7. package/dist/chat/events/registerPresenceChange.d.ts +16 -0
  8. package/dist/chat/index.d.ts +0 -1
  9. package/dist/conn/events/eventTypes.d.ts +55 -0
  10. package/dist/conn/functions/index.d.ts +1 -0
  11. package/dist/conn/functions/setKeepAlive.d.ts +28 -0
  12. package/dist/conn/index.d.ts +0 -1
  13. package/dist/contact/functions/getProfilePictureUrl.d.ts +27 -0
  14. package/dist/contact/functions/index.d.ts +1 -0
  15. package/dist/contact/index.d.ts +0 -1
  16. package/dist/eventEmitter/eventEmitter.d.ts +169 -0
  17. package/dist/eventEmitter/eventTypes.d.ts +26 -0
  18. package/dist/eventEmitter/index.d.ts +195 -0
  19. package/dist/group/functions/getGroupInfoFromInviteCode.d.ts +3 -3
  20. package/dist/group/index.d.ts +0 -1
  21. package/dist/index.d.ts +3 -1
  22. package/dist/labels/index.d.ts +0 -1
  23. package/dist/profile/index.d.ts +0 -1
  24. package/dist/status/events/eventTypes.d.ts +18 -0
  25. package/dist/status/index.d.ts +0 -1
  26. package/dist/util/index.d.ts +1 -0
  27. package/dist/util/types.d.ts +2 -0
  28. package/dist/util/wrapFunction.d.ts +20 -0
  29. package/dist/webpack/eventTypes.d.ts +19 -0
  30. package/dist/{webpack.d.ts → webpack/index.d.ts} +0 -0
  31. package/dist/whatsapp/collections/CallCollection.d.ts +3 -1
  32. package/dist/whatsapp/collections/ParticipantCollection.d.ts +3 -1
  33. package/dist/whatsapp/collections/PresenceCollection.d.ts +4 -4
  34. package/dist/whatsapp/collections/ProfilePicThumbCollection.d.ts +2 -4
  35. package/dist/whatsapp/collections/RecentStickerCollection.d.ts +3 -1
  36. package/dist/whatsapp/collections/StickerPackCollection.d.ts +3 -1
  37. package/dist/whatsapp/enums/ACK.d.ts +9 -3
  38. package/dist/whatsapp/enums/GROUP_SETTING_TYPE.d.ts +3 -1
  39. package/dist/whatsapp/enums/MSG_TYPE.d.ts +6 -2
  40. package/dist/whatsapp/exportModule.d.ts +19 -1
  41. package/dist/whatsapp/functions/createMsgProtobuf.d.ts +3 -1
  42. package/dist/whatsapp/functions/fetchLinkPreview.d.ts +3 -1
  43. package/dist/whatsapp/functions/findFirstWebLink.d.ts +3 -1
  44. package/dist/whatsapp/functions/getOrGenerate.d.ts +3 -1
  45. package/dist/whatsapp/functions/handleAck.d.ts +17 -3
  46. package/dist/whatsapp/functions/index.d.ts +3 -0
  47. package/dist/whatsapp/functions/isAuthenticated.d.ts +6 -3
  48. package/dist/whatsapp/functions/isMDBackend.d.ts +19 -0
  49. package/dist/whatsapp/functions/mediaTypeFromProtobuf.d.ts +19 -0
  50. package/dist/whatsapp/functions/profilePic.d.ts +2 -1
  51. package/dist/whatsapp/functions/randomId.d.ts +3 -1
  52. package/dist/whatsapp/functions/sendQueryExists.d.ts +3 -1
  53. package/dist/whatsapp/functions/sendQueryGroupInvite.d.ts +3 -3
  54. package/dist/whatsapp/functions/status.d.ts +6 -2
  55. package/dist/whatsapp/functions/typeAttributeFromProtobuf.d.ts +19 -0
  56. package/dist/whatsapp/misc/Browser.d.ts +3 -1
  57. package/dist/whatsapp/misc/Clock.d.ts +6 -2
  58. package/dist/whatsapp/misc/Constants.d.ts +3 -1
  59. package/dist/whatsapp/misc/EventEmitter.d.ts +3 -1
  60. package/dist/whatsapp/misc/ImageUtils.d.ts +3 -1
  61. package/dist/whatsapp/misc/Locale.d.ts +3 -1
  62. package/dist/whatsapp/misc/MsgKey.d.ts +3 -1
  63. package/dist/whatsapp/misc/UserPrefs.d.ts +3 -1
  64. package/dist/whatsapp/misc/VCard.d.ts +3 -1
  65. package/dist/whatsapp/misc/Wap.d.ts +6 -2
  66. package/dist/whatsapp/misc/Wid.d.ts +3 -1
  67. package/dist/whatsapp/misc/WidFactory.d.ts +3 -1
  68. package/dist/whatsapp/models/CallModel.d.ts +6 -2
  69. package/dist/whatsapp/models/CallParticipantModel.d.ts +6 -2
  70. package/dist/whatsapp/models/PresenceModel.d.ts +49 -0
  71. package/dist/whatsapp/models/ProfilePicThumbModel.d.ts +3 -3
  72. package/dist/whatsapp/models/StickerModel.d.ts +6 -2
  73. package/dist/whatsapp/models/WebCallModel.d.ts +6 -2
  74. package/dist/whatsapp/models/index.d.ts +1 -0
  75. package/dist/whatsapp/multidevice/adv.d.ts +3 -1
  76. package/dist/whatsapp/multidevice/waNoiseInfo.d.ts +3 -1
  77. package/dist/whatsapp/stores.d.ts +3 -1
  78. package/dist/wppconnect-wa.js +1 -1
  79. package/dist/wppconnect-wa.js.LICENSE.txt +8 -0
  80. package/package.json +26 -23
  81. package/dist/blocklist/eventEmitter.d.ts +0 -49
  82. package/dist/conn/eventEmitter.d.ts +0 -86
  83. package/dist/contact/eventEmitter.d.ts +0 -48
  84. package/dist/group/eventEmitter.d.ts +0 -48
  85. package/dist/labels/eventEmitter.d.ts +0 -48
  86. package/dist/profile/eventEmitter.d.ts +0 -48
  87. package/dist/status/eventEmitter.d.ts +0 -49
@@ -0,0 +1,195 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { EventEmitter } from './eventEmitter';
17
+ import { EventTypes } from './eventTypes';
18
+ export * from './eventTypes';
19
+ export declare const internalEv: EventEmitter<EventTypes>;
20
+ export declare const ev: EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
21
+ alfa: string;
22
+ beta: (from: number, to: string) => void;
23
+ }>;
24
+ export { EventEmitter };
25
+ export declare const addListener: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
26
+ alfa: string;
27
+ beta: (from: number, to: string) => void;
28
+ })[Name]>) => void) => EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
29
+ alfa: string;
30
+ beta: (from: number, to: string) => void;
31
+ }> | import("eventemitter2").Listener;
32
+ export declare const emit: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, ...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
33
+ alfa: string;
34
+ beta: (from: number, to: string) => void;
35
+ })[Name]>) => boolean;
36
+ export declare const emitAsync: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, ...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
37
+ alfa: string;
38
+ beta: (from: number, to: string) => void;
39
+ })[Name]>) => Promise<any[]>;
40
+ export declare const eventNames: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(nsAsArray?: boolean | undefined) => Name[];
41
+ export declare const getMaxListeners: () => number;
42
+ export declare const hasListeners: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event?: Name | undefined) => boolean;
43
+ export declare const listenTo: {
44
+ (target: import("eventemitter2").GeneralEventEmitter, events: string | symbol | import("eventemitter2").event[], options?: import("eventemitter2").ListenToOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
45
+ alfa: string;
46
+ beta: (from: number, to: string) => void;
47
+ }>;
48
+ (target: import("eventemitter2").GeneralEventEmitter, events: import("eventemitter2").event[], options?: import("eventemitter2").ListenToOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
49
+ alfa: string;
50
+ beta: (from: number, to: string) => void;
51
+ }>;
52
+ (target: import("eventemitter2").GeneralEventEmitter, events: object, options?: import("eventemitter2").ListenToOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
53
+ alfa: string;
54
+ beta: (from: number, to: string) => void;
55
+ }>;
56
+ };
57
+ export declare const listenerCount: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event?: Name | undefined) => number;
58
+ export declare const listeners: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event?: Name | undefined) => import("eventemitter2").ListenerFn[];
59
+ export declare const listenersAny: () => import("eventemitter2").ListenerFn[];
60
+ export declare const many: {
61
+ <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, timesToListen: number, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
62
+ alfa: string;
63
+ beta: (from: number, to: string) => void;
64
+ })[Name]>) => void, options: import("./eventEmitter").OnOptions & {
65
+ objectify: true;
66
+ }): import("eventemitter2").Listener;
67
+ <Name_1 extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name_1, timesToListen: number, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
68
+ alfa: string;
69
+ beta: (from: number, to: string) => void;
70
+ })[Name_1]>) => void, options?: boolean | import("./eventEmitter").OnOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
71
+ alfa: string;
72
+ beta: (from: number, to: string) => void;
73
+ }>;
74
+ };
75
+ export declare const off: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
76
+ alfa: string;
77
+ beta: (from: number, to: string) => void;
78
+ })[Name]>) => void) => EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
79
+ alfa: string;
80
+ beta: (from: number, to: string) => void;
81
+ }>;
82
+ export declare const offAny: (listener: import("eventemitter2").ListenerFn) => EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
83
+ alfa: string;
84
+ beta: (from: number, to: string) => void;
85
+ }>;
86
+ export declare const on: {
87
+ <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
88
+ alfa: string;
89
+ beta: (from: number, to: string) => void;
90
+ })[Name]>) => void, options: import("./eventEmitter").OnOptions & {
91
+ objectify: true;
92
+ }): import("eventemitter2").Listener;
93
+ <Name_1 extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name_1, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
94
+ alfa: string;
95
+ beta: (from: number, to: string) => void;
96
+ })[Name_1]>) => void, options?: boolean | import("./eventEmitter").OnOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
97
+ alfa: string;
98
+ beta: (from: number, to: string) => void;
99
+ }>;
100
+ };
101
+ export declare const onAny: (listener: import("eventemitter2").EventAndListener) => EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
102
+ alfa: string;
103
+ beta: (from: number, to: string) => void;
104
+ }>;
105
+ export declare const once: {
106
+ <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
107
+ alfa: string;
108
+ beta: (from: number, to: string) => void;
109
+ })[Name]>) => void, options: import("./eventEmitter").OnOptions & {
110
+ objectify: true;
111
+ }): import("eventemitter2").Listener;
112
+ <Name_1 extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name_1, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
113
+ alfa: string;
114
+ beta: (from: number, to: string) => void;
115
+ })[Name_1]>) => void, options?: true | import("./eventEmitter").OnOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
116
+ alfa: string;
117
+ beta: (from: number, to: string) => void;
118
+ }>;
119
+ };
120
+ export declare const prependAny: (listener: import("eventemitter2").EventAndListener) => EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
121
+ alfa: string;
122
+ beta: (from: number, to: string) => void;
123
+ }>;
124
+ export declare const prependListener: {
125
+ <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
126
+ alfa: string;
127
+ beta: (from: number, to: string) => void;
128
+ })[Name]>) => void, options: import("./eventEmitter").OnOptions & {
129
+ objectify: true;
130
+ }): import("eventemitter2").Listener;
131
+ <Name_1 extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name_1, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
132
+ alfa: string;
133
+ beta: (from: number, to: string) => void;
134
+ })[Name_1]>) => void, options?: boolean | import("./eventEmitter").OnOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
135
+ alfa: string;
136
+ beta: (from: number, to: string) => void;
137
+ }>;
138
+ };
139
+ export declare const prependMany: {
140
+ <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, timesToListen: number, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
141
+ alfa: string;
142
+ beta: (from: number, to: string) => void;
143
+ })[Name]>) => void, options: import("./eventEmitter").OnOptions & {
144
+ objectify: true;
145
+ }): import("eventemitter2").Listener;
146
+ <Name_1 extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name_1, timesToListen: number, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
147
+ alfa: string;
148
+ beta: (from: number, to: string) => void;
149
+ })[Name_1]>) => void, options?: boolean | import("./eventEmitter").OnOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
150
+ alfa: string;
151
+ beta: (from: number, to: string) => void;
152
+ }>;
153
+ };
154
+ export declare const prependOnceListener: {
155
+ <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
156
+ alfa: string;
157
+ beta: (from: number, to: string) => void;
158
+ })[Name]>) => void, options: import("./eventEmitter").OnOptions & {
159
+ objectify: true;
160
+ }): import("eventemitter2").Listener;
161
+ <Name_1 extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name_1, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
162
+ alfa: string;
163
+ beta: (from: number, to: string) => void;
164
+ })[Name_1]>) => void, options?: boolean | import("./eventEmitter").OnOptions | undefined): EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
165
+ alfa: string;
166
+ beta: (from: number, to: string) => void;
167
+ }>;
168
+ };
169
+ export declare const removeAllListeners: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event?: Name | undefined) => EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
170
+ alfa: string;
171
+ beta: (from: number, to: string) => void;
172
+ }>;
173
+ export declare const removeListener: <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, listener: (...args: import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
174
+ alfa: string;
175
+ beta: (from: number, to: string) => void;
176
+ })[Name]>) => void) => EventEmitter<import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
177
+ alfa: string;
178
+ beta: (from: number, to: string) => void;
179
+ }>;
180
+ export declare const setMaxListeners: (n: number) => void;
181
+ export declare const stopListeningTo: (target?: import("eventemitter2").GeneralEventEmitter | undefined, event?: string | symbol | import("eventemitter2").event[] | undefined) => boolean;
182
+ export declare const waitFor: {
183
+ <Name extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name, timeout?: number | undefined): import("eventemitter2").CancelablePromise<import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
184
+ alfa: string;
185
+ beta: (from: number, to: string) => void;
186
+ })[Name]>>;
187
+ <Name_1 extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name_1, filter?: import("eventemitter2").WaitForFilter | undefined): import("eventemitter2").CancelablePromise<import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
188
+ alfa: string;
189
+ beta: (from: number, to: string) => void;
190
+ })[Name_1]>>;
191
+ <Name_2 extends "blocklist.sync" | keyof import("./eventTypes").ChatEventTypes | keyof import("./eventTypes").ConnEventTypes | "status.sync" | keyof import("./eventTypes").WebpackEvents | "alfa" | "beta">(event: Name_2, options?: import("eventemitter2").WaitForOptions | undefined): import("eventemitter2").CancelablePromise<import("./eventEmitter").ListenerType<(import("./eventTypes").BlocklistEventTypes & import("./eventTypes").ChatEventTypes & import("./eventTypes").ConnEventTypes & import("./eventTypes").StatusEventTypes & import("./eventTypes").WebpackEvents & {
192
+ alfa: string;
193
+ beta: (from: number, to: string) => void;
194
+ })[Name_2]>>;
195
+ };
@@ -24,15 +24,15 @@
24
24
  * @category Group
25
25
  */
26
26
  export declare function getGroupInfoFromInviteCode(inviteCode: string): Promise<{
27
- descOwner: string;
27
+ descOwner: string | undefined;
28
28
  id: string;
29
- owner: string;
29
+ owner: string | undefined;
30
30
  participants: {
31
31
  id: string;
32
32
  isAdmin: boolean;
33
33
  isSuperAdmin: boolean;
34
34
  }[];
35
- subjectOwner: string;
35
+ subjectOwner: string | undefined;
36
36
  announce: boolean;
37
37
  creation: number;
38
38
  desc: string;
@@ -13,5 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { clearListeners, EventTypes, listenerCount, off, on, once, UnsubscribeFn, } from './eventEmitter';
17
16
  export * from './functions';
package/dist/index.d.ts CHANGED
@@ -15,7 +15,6 @@
15
15
  */
16
16
  import './config';
17
17
  import './deviceName';
18
- import './patch';
19
18
  import * as webpack from './webpack';
20
19
  export { webpack };
21
20
  export { isInjected, isReady } from './webpack';
@@ -24,11 +23,14 @@ export * as blocklist from './blocklist';
24
23
  export * as chat from './chat';
25
24
  export * as conn from './conn';
26
25
  export * as contact from './contact';
26
+ export * as ev from './eventEmitter';
27
27
  export * as group from './group';
28
28
  export * as labels from './labels';
29
29
  export * as profile from './profile';
30
30
  export * as status from './status';
31
31
  export * as util from './util';
32
32
  export * as whatsapp from './whatsapp';
33
+ export { emit, emitAsync, eventNames, getMaxListeners, hasListeners, listenTo, listenerCount, listeners, listenersAny, many, off, offAny, on, onAny, once, prependAny, prependListener, prependMany, prependOnceListener, removeAllListeners, removeListener, setMaxListeners, stopListeningTo, waitFor, } from './eventEmitter';
33
34
  export declare const version: string;
35
+ export declare const supportedWhatsappWeb: string;
34
36
  export declare const license = "Apache-2.0";
@@ -13,6 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { clearListeners, EventTypes, listenerCount, off, on, once, UnsubscribeFn, } from './eventEmitter';
17
16
  export * from './functions';
18
17
  export * from './types';
@@ -13,5 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { clearListeners, EventTypes, listenerCount, off, on, once, UnsubscribeFn, } from './eventEmitter';
17
16
  export * from './functions';
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface StatusEventTypes {
17
+ 'status.sync': undefined;
18
+ }
@@ -15,5 +15,4 @@
15
15
  */
16
16
  import './events';
17
17
  export * from './defaultSendStatusOptions';
18
- export { clearListeners, EventTypes, listenerCount, off, on, once, UnsubscribeFn, } from './eventEmitter';
19
18
  export * from './functions';
@@ -19,3 +19,4 @@ export * from './createWid';
19
19
  export * from './errors';
20
20
  export * from './isBase64';
21
21
  export * from './types';
22
+ export * from './wrapFunction';
@@ -13,6 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export declare type InferArgs<T> = T extends (...t: [...infer Arg]) => any ? Arg : never;
17
+ export declare type InferReturn<T> = T extends (...t: [...infer Arg]) => infer Res ? Res : never;
16
18
  export declare type FunctionPropertyNames<T> = {
17
19
  [K in keyof T]: T[K] extends Function ? K : never;
18
20
  }[keyof T];
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { InferArgs, InferReturn } from './types';
17
+ /**
18
+ * Wrap a function with the callback
19
+ */
20
+ export declare function wrapFunction<TFunc extends (...args: any[]) => any>(func: TFunc, callback: (func: TFunc, ...args: InferArgs<TFunc>) => InferReturn<TFunc>): (...args: InferArgs<TFunc>) => InferReturn<TFunc>;
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2021 WPPConnect Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export interface WebpackEvents {
17
+ 'webpack.injected': void;
18
+ 'webpack.ready': void;
19
+ }
File without changes
@@ -15,7 +15,9 @@
15
15
  */
16
16
  import { CallModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 31218 */
18
+ /** @whatsapp 60868
19
+ * @whatsapp 31218 >= 2.2204.13
20
+ */
19
21
  export declare class CallCollection extends Collection<CallModel> {
20
22
  static model: CallModel;
21
23
  pendingOffers?: any;
@@ -15,7 +15,9 @@
15
15
  */
16
16
  import { ParticipantModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 96091 */
18
+ /** @whatsapp 96091
19
+ * @whatsapp 54311 >= 2.2212.8
20
+ */
19
21
  export declare class ParticipantCollection extends Collection<ParticipantModel> {
20
22
  static model: ParticipantModel;
21
23
  static comparator(): any;
@@ -13,11 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ChatstateModel } from '../models';
17
- import { Collection } from './Collection';
16
+ import { PresenceModel } from '../models';
17
+ import { BaseCollection } from './BaseCollection';
18
18
  /** @whatsapp 68315 */
19
- export declare class PresenceCollection extends Collection<ChatstateModel> {
20
- static model: ChatstateModel;
19
+ export declare class PresenceCollection extends BaseCollection<PresenceModel> {
20
+ static model: PresenceModel;
21
21
  static staleCollection?: any;
22
22
  clearAllPresence(): any;
23
23
  }
@@ -14,14 +14,12 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ProfilePicThumbModel } from '../models';
17
- import { Collection } from './Collection';
17
+ import { BaseCollection } from './BaseCollection';
18
18
  /** @whatsapp 82039 */
19
- export declare class ProfilePicThumbCollection extends Collection<ProfilePicThumbModel> {
19
+ export declare class ProfilePicThumbCollection extends BaseCollection<ProfilePicThumbModel> {
20
20
  static model: ProfilePicThumbModel;
21
21
  static staleCollection?: any;
22
22
  static resumeOnAvailable?: any;
23
- static cachePolicy?: any;
24
- onResume(): any;
25
23
  imageChanged(e?: any, t?: any): any;
26
24
  resyncPictures(e?: any): any;
27
25
  findThumbnailWid(e?: any): any;
@@ -15,7 +15,9 @@
15
15
  */
16
16
  import { StickerModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 49264 */
18
+ /** @whatsapp 49264
19
+ * @whatsapp 91692 >= 2.2212.8
20
+ */
19
21
  export declare class RecentStickerCollection extends Collection<StickerModel> {
20
22
  static model: StickerModel;
21
23
  enqueue(e?: any): any;
@@ -15,7 +15,9 @@
15
15
  */
16
16
  import { StickerPackModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 44333 */
18
+ /** @whatsapp 44333
19
+ * @whatsapp 66299 >= 2.2212.8
20
+ */
19
21
  export declare class StickerPackCollection extends Collection<StickerPackModel> {
20
22
  static model: StickerPackModel;
21
23
  checksum?: any;
@@ -13,7 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /** @whatsapp 35470 */
16
+ /** @whatsapp 35470
17
+ * @whatsapp 69618 >= 2.2204.13
18
+ */
17
19
  export declare enum ACK {
18
20
  MD_DOWNGRADE = -7,
19
21
  INACTIVE = -6,
@@ -29,12 +31,16 @@ export declare enum ACK {
29
31
  PLAYED = 4,
30
32
  PEER = 5
31
33
  }
32
- /** @whatsapp 35470 */
34
+ /** @whatsapp 35470
35
+ * @whatsapp 69618 >= 2.2204.13
36
+ */
33
37
  export declare enum EDIT_ATTR {
34
38
  SENDER_REVOKE = 7,
35
39
  ADMIN_REVOKE = 8
36
40
  }
37
- /** @whatsapp 35470 */
41
+ /** @whatsapp 35470
42
+ * @whatsapp 69618 >= 2.2204.13
43
+ */
38
44
  export declare enum ACK_STRING {
39
45
  SENDER = "sender",
40
46
  DELIVERY = "delivery",
@@ -13,7 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /** @whatsapp 12380 */
16
+ /** @whatsapp 12380
17
+ * @whatsapp 69618 >= 2.2204.13
18
+ */
17
19
  export declare enum GROUP_SETTING_TYPE {
18
20
  ANNOUNCEMENT = "announcement",
19
21
  RESTRICT = "restrict",
@@ -13,7 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /** @whatsapp 15461 */
16
+ /** @whatsapp 15461
17
+ * @whatsapp 69618 >= 2.2204.13
18
+ */
17
19
  export declare enum MSG_TYPE {
18
20
  NOTIFICATION = "notification",
19
21
  NOTIFICATION_TEMPLATE = "notification_template",
@@ -50,5 +52,7 @@ export declare enum MSG_TYPE {
50
52
  NATIVE_FLOW = "native_flow",
51
53
  UNKNOWN = "unknown"
52
54
  }
53
- /** @whatsapp 15461 */
55
+ /** @whatsapp 15461
56
+ * @whatsapp 69618 >= 2.2204.13
57
+ */
54
58
  export declare const SYSTEM_MESSAGE_TYPES: string[];
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { InferArgs, InferReturn } from '../util';
16
17
  import * as webpack from '../webpack';
17
18
  export declare const _moduleIdMap: WeakMap<any, string>;
18
19
  /**
@@ -27,6 +28,23 @@ export declare const _moduleIdMap: WeakMap<any, string>;
27
28
  * @param condition The seach condition to find the module
28
29
  */
29
30
  export declare function exportModule(exports: any, properties: string | {
30
- [key: string]: null | undefined | string | ((module: any) => any);
31
+ [key: string]: null | undefined | string | string[];
31
32
  }, condition: webpack.SearchModuleCondition): void;
32
33
  export declare function exportProxyModel(exports: any, name: string): void;
34
+ /**
35
+ * Wrap a exported function from a module
36
+ *
37
+ * @param func The original function
38
+ * @param callback A callback to wrap the function
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ *wrapModuleFunction(createMsgProtobuf, (func, ...args) => {
43
+ const [message] = args; // Extract arguments
44
+ const result = func(...args); // Call the original function
45
+ // Logic to change the result
46
+ return result; // The new return
47
+ });
48
+ * ```
49
+ */
50
+ export declare function wrapModuleFunction<TFunc extends (...args: any[]) => any>(func: TFunc, callback: (func: TFunc, ...args: InferArgs<TFunc>) => InferReturn<TFunc>): void;
@@ -17,4 +17,6 @@ import { MsgModel } from '..';
17
17
  /** @whatsapp 6565 */
18
18
  export declare function createMsgProtobuf(e: MsgModel, t?: {
19
19
  [key: string]: any;
20
- }): Promise<any>;
20
+ }): {
21
+ [key: string]: any;
22
+ };
@@ -25,5 +25,7 @@ export interface LinkPreviewResult {
25
25
  doNotPlayInline: boolean;
26
26
  };
27
27
  }
28
- /** @whatsapp 75820 */
28
+ /** @whatsapp 19146
29
+ * @whatsapp 75820 >= 2.2204.13
30
+ */
29
31
  export declare function fetchLinkPreview(url: string): Promise<null | LinkPreviewResult>;
@@ -13,5 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /** @whatsapp 31042 */
16
+ /** @whatsapp 29929
17
+ * @whatsapp 31042 >= 2.2204.13
18
+ */
17
19
  export declare function findFirstWebLink(message: string): undefined | string;
@@ -13,5 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /** @whatsapp 16413 */
16
+ /** @whatsapp 98250
17
+ * @whatsapp 16413 >= 2.2204.13
18
+ */
17
19
  export declare function getOrGenerate(): string;
@@ -13,9 +13,23 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { Wid } from '../misc';
17
+ export interface SimpleAckData {
18
+ type: string;
19
+ stanzaId: string;
20
+ externalIds: string[];
21
+ from: Wid;
22
+ participant: null | Wid;
23
+ recipient: null;
24
+ ts: number;
25
+ ack: number;
26
+ ackString: null | string;
27
+ offline: null;
28
+ biz?: null;
29
+ }
16
30
  /** @whatsapp 90756 */
17
- export declare function handleStatusSimpleAck(ackData: any): Promise<any>;
31
+ export declare function handleStatusSimpleAck(ackData: SimpleAckData): Promise<any>;
18
32
  /** @whatsapp 48309 */
19
- export declare function handleChatSimpleAck(ackData: any): Promise<any>;
33
+ export declare function handleChatSimpleAck(ackData: SimpleAckData): Promise<any>;
20
34
  /** @whatsapp 84947 */
21
- export declare function handleGroupSimpleAck(ackData: any): Promise<any>;
35
+ export declare function handleGroupSimpleAck(ackData: SimpleAckData): Promise<any>;