@wppconnect-team/wppconnect 1.19.0 → 1.19.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.
- package/CHANGELOG.md +9 -0
- package/dist/api/helpers/download-file.js +1 -1
- package/dist/api/helpers/evaluate-and-return.js +1 -1
- package/dist/api/helpers/file-to-base64.js +1 -1
- package/dist/api/helpers/scrape-img-qr.js +1 -1
- package/dist/api/helpers/scrape-login.js +1 -1
- package/dist/api/helpers/select-sticker.js +1 -1
- package/dist/api/layers/business.layer.d.ts +161 -0
- package/dist/api/layers/business.layer.js +207 -1
- package/dist/api/layers/catalog.layer.js +1 -1
- package/dist/api/layers/controls.layer.js +1 -1
- package/dist/api/layers/group.layer.js +1 -1
- package/dist/api/layers/host.layer.js +1 -1
- package/dist/api/layers/labels.layer.js +1 -1
- package/dist/api/layers/listener.layer.js +8 -3
- package/dist/api/layers/profile.layer.js +1 -1
- package/dist/api/layers/retriever.layer.js +1 -1
- package/dist/api/layers/sender.layer.js +1 -1
- package/dist/api/layers/status.layer.js +1 -1
- package/dist/api/layers/ui.layer.js +1 -1
- package/dist/api/model/initializer.d.ts +3 -3
- package/dist/api/whatsapp.js +1 -1
- package/dist/controllers/auth.js +3 -4
- package/dist/controllers/browser.js +21 -6
- package/dist/controllers/initializer.js +1 -1
- package/dist/controllers/welcome.js +1 -1
- package/dist/lib/wapi/wapi.js +1 -1
- package/dist/token-store/fileTokenStore.js +1 -1
- package/dist/utils/ffmpeg.js +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 1.19.1 (2022-11-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Fixed onMessage method (fix [#1351](https://github.com/wppconnect-team/wppconnect/issues/1351)) ([e8549a1](https://github.com/wppconnect-team/wppconnect/commit/e8549a10cf7b3ed5a04209bdd7d58b9a3c073f32))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
# 1.19.0 (2022-11-02)
|
|
2
11
|
|
|
3
12
|
|
|
@@ -30,7 +30,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
30
30
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
31
31
|
function step(op) {
|
|
32
32
|
if (f) throw new TypeError("Generator is already executing.");
|
|
33
|
-
while (_) try {
|
|
33
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
34
34
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
35
35
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
36
36
|
switch (op[0]) {
|
|
@@ -30,7 +30,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
30
30
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
31
31
|
function step(op) {
|
|
32
32
|
if (f) throw new TypeError("Generator is already executing.");
|
|
33
|
-
while (_) try {
|
|
33
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
34
34
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
35
35
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
36
36
|
switch (op[0]) {
|
|
@@ -53,7 +53,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
53
53
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
54
54
|
function step(op) {
|
|
55
55
|
if (f) throw new TypeError("Generator is already executing.");
|
|
56
|
-
while (_) try {
|
|
56
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
57
57
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
58
58
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
59
59
|
switch (op[0]) {
|
|
@@ -30,7 +30,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
30
30
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
31
31
|
function step(op) {
|
|
32
32
|
if (f) throw new TypeError("Generator is already executing.");
|
|
33
|
-
while (_) try {
|
|
33
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
34
34
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
35
35
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
36
36
|
switch (op[0]) {
|
|
@@ -30,7 +30,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
30
30
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
31
31
|
function step(op) {
|
|
32
32
|
if (f) throw new TypeError("Generator is already executing.");
|
|
33
|
-
while (_) try {
|
|
33
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
34
34
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
35
35
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
36
36
|
switch (op[0]) {
|
|
@@ -30,7 +30,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
30
30
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
31
31
|
function step(op) {
|
|
32
32
|
if (f) throw new TypeError("Generator is already executing.");
|
|
33
|
-
while (_) try {
|
|
33
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
34
34
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
35
35
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
36
36
|
switch (op[0]) {
|
|
@@ -9,12 +9,173 @@ export declare class BusinessLayer extends ControlsLayer {
|
|
|
9
9
|
* @param id Buisness profile id ('00000@c.us')
|
|
10
10
|
*/
|
|
11
11
|
getBusinessProfilesProducts(id: string): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Get Business Profile
|
|
14
|
+
* @param id Buisness profile id ('00000@c.us')
|
|
15
|
+
*/
|
|
16
|
+
getBusinessProfile(id: string): Promise<any>;
|
|
12
17
|
/**
|
|
13
18
|
* Querys order catalog
|
|
14
19
|
* @param messageId string
|
|
15
20
|
* @returns Message object
|
|
16
21
|
*/
|
|
17
22
|
getOrderbyMsg(messageId: string): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Update your business profile
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* await client.editBusinessProfile({description: 'New description for profile'});
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* ```javascript
|
|
32
|
+
* await client.editBusinessProfile({categories: {
|
|
33
|
+
id: "133436743388217",
|
|
34
|
+
localized_display_name: "Artes e entretenimento",
|
|
35
|
+
not_a_biz: false,
|
|
36
|
+
}});
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* ```javascript
|
|
40
|
+
* await client.editBusinessProfile({address: 'Street 01, New York'});
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* ```javascript
|
|
44
|
+
* await client.editBusinessProfile({email: 'test@test.com.br'});
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Change website of profile (max 2 sites)
|
|
48
|
+
* ```javascript
|
|
49
|
+
* await client.editBusinessProfile({website: [
|
|
50
|
+
"https://www.wppconnect.io",
|
|
51
|
+
"https://www.teste2.com.br",
|
|
52
|
+
]});
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Change businessHours for Specific Hours
|
|
56
|
+
* ```javascript
|
|
57
|
+
* await client.editBusinessProfile({ businessHours: {
|
|
58
|
+
* {
|
|
59
|
+
tue: {
|
|
60
|
+
mode: "specific_hours",
|
|
61
|
+
hours: [
|
|
62
|
+
[
|
|
63
|
+
540,
|
|
64
|
+
1080,
|
|
65
|
+
],
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
wed: {
|
|
69
|
+
mode: "specific_hours",
|
|
70
|
+
hours: [
|
|
71
|
+
[
|
|
72
|
+
540,
|
|
73
|
+
1080,
|
|
74
|
+
],
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
thu: {
|
|
78
|
+
mode: "specific_hours",
|
|
79
|
+
hours: [
|
|
80
|
+
[
|
|
81
|
+
540,
|
|
82
|
+
1080,
|
|
83
|
+
],
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
fri: {
|
|
87
|
+
mode: "specific_hours",
|
|
88
|
+
hours: [
|
|
89
|
+
[
|
|
90
|
+
540,
|
|
91
|
+
1080,
|
|
92
|
+
],
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
sat: {
|
|
96
|
+
mode: "specific_hours",
|
|
97
|
+
hours: [
|
|
98
|
+
[
|
|
99
|
+
540,
|
|
100
|
+
1080,
|
|
101
|
+
],
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
sun: {
|
|
105
|
+
mode: "specific_hours",
|
|
106
|
+
hours: [
|
|
107
|
+
[
|
|
108
|
+
540,
|
|
109
|
+
1080,
|
|
110
|
+
],
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
timezone: "America/Sao_Paulo"
|
|
116
|
+
});
|
|
117
|
+
*
|
|
118
|
+
* Change businessHours for Always Opened
|
|
119
|
+
* ```javascript
|
|
120
|
+
* await client.editBusinessProfile({ businessHours: {
|
|
121
|
+
{
|
|
122
|
+
mon: {
|
|
123
|
+
mode: "open_24h",
|
|
124
|
+
},
|
|
125
|
+
tue: {
|
|
126
|
+
mode: "open_24h",
|
|
127
|
+
},
|
|
128
|
+
wed: {
|
|
129
|
+
mode: "open_24h",
|
|
130
|
+
},
|
|
131
|
+
thu: {
|
|
132
|
+
mode: "open_24h",
|
|
133
|
+
},
|
|
134
|
+
fri: {
|
|
135
|
+
mode: "open_24h",
|
|
136
|
+
},
|
|
137
|
+
sat: {
|
|
138
|
+
mode: "open_24h",
|
|
139
|
+
},
|
|
140
|
+
sun: {
|
|
141
|
+
mode: "open_24h",
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
timezone: "America/Sao_Paulo"
|
|
145
|
+
});
|
|
146
|
+
*
|
|
147
|
+
* Change businessHours for Appointment Only
|
|
148
|
+
* ```javascript
|
|
149
|
+
* await client.editBusinessProfile({ businessHours: { {
|
|
150
|
+
mon: {
|
|
151
|
+
mode: "appointment_only",
|
|
152
|
+
},
|
|
153
|
+
tue: {
|
|
154
|
+
mode: "appointment_only",
|
|
155
|
+
},
|
|
156
|
+
wed: {
|
|
157
|
+
mode: "appointment_only",
|
|
158
|
+
},
|
|
159
|
+
thu: {
|
|
160
|
+
mode: "appointment_only",
|
|
161
|
+
},
|
|
162
|
+
fri: {
|
|
163
|
+
mode: "appointment_only",
|
|
164
|
+
},
|
|
165
|
+
sat: {
|
|
166
|
+
mode: "appointment_only",
|
|
167
|
+
},
|
|
168
|
+
sun: {
|
|
169
|
+
mode: "appointment_only",
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
timezone: "America/Sao_Paulo"
|
|
173
|
+
});
|
|
174
|
+
*
|
|
175
|
+
*
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
editBusinessProfile(options: any): Promise<any>;
|
|
18
179
|
/**
|
|
19
180
|
* Sends product with product image to given chat id
|
|
20
181
|
* @param to Chat id
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -91,6 +91,32 @@ var BusinessLayer = /** @class */ (function (_super) {
|
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Get Business Profile
|
|
96
|
+
* @param id Buisness profile id ('00000@c.us')
|
|
97
|
+
*/
|
|
98
|
+
BusinessLayer.prototype.getBusinessProfile = function (id) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
+
var _this = this;
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
103
|
+
var id = _a.id;
|
|
104
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
105
|
+
var _b, _c, _d, _e;
|
|
106
|
+
return __generator(this, function (_f) {
|
|
107
|
+
switch (_f.label) {
|
|
108
|
+
case 0:
|
|
109
|
+
_c = (_b = JSON).parse;
|
|
110
|
+
_e = (_d = JSON).stringify;
|
|
111
|
+
return [4 /*yield*/, WPP.contact.getBusinessProfile(id)];
|
|
112
|
+
case 1: return [2 /*return*/, _c.apply(_b, [_e.apply(_d, [_f.sent()])])];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}, { id: id })];
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
};
|
|
94
120
|
/**
|
|
95
121
|
* Querys order catalog
|
|
96
122
|
* @param messageId string
|
|
@@ -106,6 +132,186 @@ var BusinessLayer = /** @class */ (function (_super) {
|
|
|
106
132
|
});
|
|
107
133
|
});
|
|
108
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Update your business profile
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```javascript
|
|
140
|
+
* await client.editBusinessProfile({description: 'New description for profile'});
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* ```javascript
|
|
144
|
+
* await client.editBusinessProfile({categories: {
|
|
145
|
+
id: "133436743388217",
|
|
146
|
+
localized_display_name: "Artes e entretenimento",
|
|
147
|
+
not_a_biz: false,
|
|
148
|
+
}});
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* ```javascript
|
|
152
|
+
* await client.editBusinessProfile({address: 'Street 01, New York'});
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* ```javascript
|
|
156
|
+
* await client.editBusinessProfile({email: 'test@test.com.br'});
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* Change website of profile (max 2 sites)
|
|
160
|
+
* ```javascript
|
|
161
|
+
* await client.editBusinessProfile({website: [
|
|
162
|
+
"https://www.wppconnect.io",
|
|
163
|
+
"https://www.teste2.com.br",
|
|
164
|
+
]});
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* Change businessHours for Specific Hours
|
|
168
|
+
* ```javascript
|
|
169
|
+
* await client.editBusinessProfile({ businessHours: {
|
|
170
|
+
* {
|
|
171
|
+
tue: {
|
|
172
|
+
mode: "specific_hours",
|
|
173
|
+
hours: [
|
|
174
|
+
[
|
|
175
|
+
540,
|
|
176
|
+
1080,
|
|
177
|
+
],
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
wed: {
|
|
181
|
+
mode: "specific_hours",
|
|
182
|
+
hours: [
|
|
183
|
+
[
|
|
184
|
+
540,
|
|
185
|
+
1080,
|
|
186
|
+
],
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
thu: {
|
|
190
|
+
mode: "specific_hours",
|
|
191
|
+
hours: [
|
|
192
|
+
[
|
|
193
|
+
540,
|
|
194
|
+
1080,
|
|
195
|
+
],
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
fri: {
|
|
199
|
+
mode: "specific_hours",
|
|
200
|
+
hours: [
|
|
201
|
+
[
|
|
202
|
+
540,
|
|
203
|
+
1080,
|
|
204
|
+
],
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
sat: {
|
|
208
|
+
mode: "specific_hours",
|
|
209
|
+
hours: [
|
|
210
|
+
[
|
|
211
|
+
540,
|
|
212
|
+
1080,
|
|
213
|
+
],
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
sun: {
|
|
217
|
+
mode: "specific_hours",
|
|
218
|
+
hours: [
|
|
219
|
+
[
|
|
220
|
+
540,
|
|
221
|
+
1080,
|
|
222
|
+
],
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
timezone: "America/Sao_Paulo"
|
|
228
|
+
});
|
|
229
|
+
*
|
|
230
|
+
* Change businessHours for Always Opened
|
|
231
|
+
* ```javascript
|
|
232
|
+
* await client.editBusinessProfile({ businessHours: {
|
|
233
|
+
{
|
|
234
|
+
mon: {
|
|
235
|
+
mode: "open_24h",
|
|
236
|
+
},
|
|
237
|
+
tue: {
|
|
238
|
+
mode: "open_24h",
|
|
239
|
+
},
|
|
240
|
+
wed: {
|
|
241
|
+
mode: "open_24h",
|
|
242
|
+
},
|
|
243
|
+
thu: {
|
|
244
|
+
mode: "open_24h",
|
|
245
|
+
},
|
|
246
|
+
fri: {
|
|
247
|
+
mode: "open_24h",
|
|
248
|
+
},
|
|
249
|
+
sat: {
|
|
250
|
+
mode: "open_24h",
|
|
251
|
+
},
|
|
252
|
+
sun: {
|
|
253
|
+
mode: "open_24h",
|
|
254
|
+
},
|
|
255
|
+
}
|
|
256
|
+
timezone: "America/Sao_Paulo"
|
|
257
|
+
});
|
|
258
|
+
*
|
|
259
|
+
* Change businessHours for Appointment Only
|
|
260
|
+
* ```javascript
|
|
261
|
+
* await client.editBusinessProfile({ businessHours: { {
|
|
262
|
+
mon: {
|
|
263
|
+
mode: "appointment_only",
|
|
264
|
+
},
|
|
265
|
+
tue: {
|
|
266
|
+
mode: "appointment_only",
|
|
267
|
+
},
|
|
268
|
+
wed: {
|
|
269
|
+
mode: "appointment_only",
|
|
270
|
+
},
|
|
271
|
+
thu: {
|
|
272
|
+
mode: "appointment_only",
|
|
273
|
+
},
|
|
274
|
+
fri: {
|
|
275
|
+
mode: "appointment_only",
|
|
276
|
+
},
|
|
277
|
+
sat: {
|
|
278
|
+
mode: "appointment_only",
|
|
279
|
+
},
|
|
280
|
+
sun: {
|
|
281
|
+
mode: "appointment_only",
|
|
282
|
+
},
|
|
283
|
+
}
|
|
284
|
+
timezone: "America/Sao_Paulo"
|
|
285
|
+
});
|
|
286
|
+
*
|
|
287
|
+
*
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
BusinessLayer.prototype.editBusinessProfile = function (options) {
|
|
291
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
292
|
+
var _this = this;
|
|
293
|
+
return __generator(this, function (_a) {
|
|
294
|
+
switch (_a.label) {
|
|
295
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
296
|
+
var options = _a.options;
|
|
297
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
298
|
+
var _b, _c, _d, _e;
|
|
299
|
+
return __generator(this, function (_f) {
|
|
300
|
+
switch (_f.label) {
|
|
301
|
+
case 0:
|
|
302
|
+
_c = (_b = JSON).parse;
|
|
303
|
+
_e = (_d = JSON).stringify;
|
|
304
|
+
return [4 /*yield*/, WPP.profile.editBusinessProfile(options)];
|
|
305
|
+
case 1: return [2 /*return*/, _c.apply(_b, [_e.apply(_d, [_f.sent()])])];
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
}, { options: options })];
|
|
310
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
};
|
|
109
315
|
/**
|
|
110
316
|
* Sends product with product image to given chat id
|
|
111
317
|
* @param to Chat id
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -41,7 +41,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
41
41
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
42
42
|
function step(op) {
|
|
43
43
|
if (f) throw new TypeError("Generator is already executing.");
|
|
44
|
-
while (_) try {
|
|
44
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
45
45
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
46
46
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
47
47
|
switch (op[0]) {
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -89,6 +89,7 @@ var ListenerLayer = /** @class */ (function (_super) {
|
|
|
89
89
|
_this.listenerEmitter = new events_1.EventEmitter({
|
|
90
90
|
captureRejections: true,
|
|
91
91
|
});
|
|
92
|
+
_this.listenerEmitter.setMaxListeners(0);
|
|
92
93
|
_this.listenerEmitter.on(exposed_enum_1.ExposedFn.onInterfaceChange, function (state) {
|
|
93
94
|
_this.log('http', "Current state: ".concat(state.mode, " (").concat(state.displayInfo, ")"));
|
|
94
95
|
});
|
|
@@ -137,12 +138,15 @@ var ListenerLayer = /** @class */ (function (_super) {
|
|
|
137
138
|
this_1.log('debug', "Exposing ".concat(func, " function"));
|
|
138
139
|
return [4 /*yield*/, this_1.page
|
|
139
140
|
.exposeFunction(func, function () {
|
|
140
|
-
var _a;
|
|
141
141
|
var args = [];
|
|
142
142
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
143
143
|
args[_i] = arguments[_i];
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
Promise.resolve().then(function () {
|
|
146
|
+
var _a;
|
|
147
|
+
_this.log('debug', "Emitting ".concat(func, " event (").concat(_this.listenerEmitter.listenerCount(func), " registered)"));
|
|
148
|
+
(_a = _this.listenerEmitter).emit.apply(_a, __spreadArray([func], args, false));
|
|
149
|
+
});
|
|
146
150
|
})
|
|
147
151
|
.catch(function () { })];
|
|
148
152
|
case 2:
|
|
@@ -345,6 +349,7 @@ var ListenerLayer = /** @class */ (function (_super) {
|
|
|
345
349
|
*/
|
|
346
350
|
ListenerLayer.prototype.registerEvent = function (event, listener) {
|
|
347
351
|
var _this = this;
|
|
352
|
+
this.log('debug', "Registering ".concat(event.toString(), " event"));
|
|
348
353
|
this.listenerEmitter.on(event, listener);
|
|
349
354
|
return {
|
|
350
355
|
dispose: function () {
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -79,7 +79,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
79
79
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
80
80
|
function step(op) {
|
|
81
81
|
if (f) throw new TypeError("Generator is already executing.");
|
|
82
|
-
while (_) try {
|
|
82
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
83
83
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
84
84
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
85
85
|
switch (op[0]) {
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|
|
@@ -4,15 +4,15 @@ import { StatusFind } from './enum';
|
|
|
4
4
|
/**
|
|
5
5
|
* A callback will be received, informing the status of the qrcode
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type CatchQRCallback = (qrCode: string, asciiQR: string, attempt: number, urlCode?: string) => void;
|
|
8
8
|
/**
|
|
9
9
|
* A callback will be received, informing the customer's status
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type StatusFindCallback = (status: StatusFind | keyof typeof StatusFind, session: string) => void;
|
|
12
12
|
/**
|
|
13
13
|
* A callback will be received, informing data as percentage and loading screen message
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type LoadingScreenCallback = (percent: number, message: string) => void;
|
|
16
16
|
export interface CreateOptions extends CreateConfig {
|
|
17
17
|
/**
|
|
18
18
|
* You must pass a string type parameter, this parameter will be the name of the client's session. If the parameter is not passed, the section name will be "session".
|
package/dist/api/whatsapp.js
CHANGED
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
46
|
function step(op) {
|
|
47
47
|
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (_) try {
|
|
48
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
49
49
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
50
50
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
51
|
switch (op[0]) {
|