@wppconnect-team/wppconnect 2.0.0 → 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.
- package/CHANGELOG.md +6 -0
- package/dist/api/helpers/base64-mimetype.js +2 -2
- package/dist/api/helpers/decrypt.js +65 -72
- package/dist/api/helpers/download-file.js +31 -81
- package/dist/api/helpers/evaluate-and-return.js +98 -93
- package/dist/api/helpers/file-to-base64.js +30 -81
- package/dist/api/helpers/filename-from-mimetype.js +4 -4
- package/dist/api/helpers/scrape-img-qr.js +37 -86
- package/dist/api/helpers/scrape-login.js +12 -57
- package/dist/api/helpers/select-sticker.js +35 -100
- package/dist/api/layers/business.layer.js +29 -134
- package/dist/api/layers/catalog.layer.js +59 -210
- package/dist/api/layers/community.layer.js +29 -120
- package/dist/api/layers/controls.layer.js +62 -262
- package/dist/api/layers/group.layer.js +126 -391
- package/dist/api/layers/host.layer.js +348 -702
- package/dist/api/layers/labels.layer.js +35 -131
- package/dist/api/layers/listener.layer.js +386 -504
- package/dist/api/layers/newsletter.layer.js +20 -89
- package/dist/api/layers/profile.layer.js +73 -184
- package/dist/api/layers/retriever.layer.js +161 -468
- package/dist/api/layers/sender.layer.js +554 -1094
- package/dist/api/layers/status.layer.js +80 -179
- package/dist/api/layers/ui.layer.js +32 -129
- package/dist/api/model/enum/definitions.js +1 -1
- package/dist/api/whatsapp.js +200 -437
- package/dist/config/WAuserAgente.js +1 -1
- package/dist/config/create-config.js +1 -1
- package/dist/config/puppeteer.config.js +1 -1
- package/dist/controllers/auth.js +42 -110
- package/dist/controllers/browser.js +251 -411
- package/dist/controllers/initializer.js +171 -265
- package/dist/controllers/websocket.js +29 -28
- package/dist/controllers/welcome.js +38 -88
- package/dist/token-store/fileTokenStore.js +83 -173
- package/dist/token-store/isValidSessionToken.js +2 -2
- package/dist/token-store/isValidTokenStore.js +2 -2
- package/dist/token-store/memoryTokenStore.js +11 -14
- package/dist/utils/ffmpeg.js +75 -131
- package/dist/utils/logger.js +5 -5
- package/dist/utils/semver.js +6 -6
- package/dist/utils/sleep.js +1 -1
- package/package.json +6 -6
|
@@ -15,67 +15,15 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public License
|
|
16
16
|
* along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
var __extends = (this && this.__extends) || (function () {
|
|
19
|
-
var extendStatics = function (d, b) {
|
|
20
|
-
extendStatics = Object.setPrototypeOf ||
|
|
21
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
22
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
23
|
-
return extendStatics(d, b);
|
|
24
|
-
};
|
|
25
|
-
return function (d, b) {
|
|
26
|
-
if (typeof b !== "function" && b !== null)
|
|
27
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
28
|
-
extendStatics(d, b);
|
|
29
|
-
function __() { this.constructor = d; }
|
|
30
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
34
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
35
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
36
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
37
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
38
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
39
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
43
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
44
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
45
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
|
-
function step(op) {
|
|
47
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
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
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
|
-
switch (op[0]) {
|
|
52
|
-
case 0: case 1: t = op; break;
|
|
53
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
54
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
55
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
56
|
-
default:
|
|
57
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
58
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
59
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
60
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
61
|
-
if (t[2]) _.ops.pop();
|
|
62
|
-
_.trys.pop(); continue;
|
|
63
|
-
}
|
|
64
|
-
op = body.call(thisArg, _);
|
|
65
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
66
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
19
|
exports.NewsletterLayer = void 0;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return _this;
|
|
20
|
+
const helpers_1 = require("../helpers");
|
|
21
|
+
const host_layer_1 = require("./host.layer");
|
|
22
|
+
class NewsletterLayer extends host_layer_1.HostLayer {
|
|
23
|
+
page;
|
|
24
|
+
constructor(page, session, options) {
|
|
25
|
+
super(page, session, options);
|
|
26
|
+
this.page = page;
|
|
79
27
|
}
|
|
80
28
|
/**
|
|
81
29
|
* Create Newsletter
|
|
@@ -88,13 +36,9 @@ var NewsletterLayer = /** @class */ (function (_super) {
|
|
|
88
36
|
* @param name Name Newsletter
|
|
89
37
|
* @param options options Newsletter, description and picture
|
|
90
38
|
*/
|
|
91
|
-
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (name, options) { return WPP.newsletter.create(name, options); }, name, options)];
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
};
|
|
39
|
+
async createNewsletter(name, options) {
|
|
40
|
+
return (0, helpers_1.evaluateAndReturn)(this.page, (name, options) => WPP.newsletter.create(name, options), name, options);
|
|
41
|
+
}
|
|
98
42
|
/**
|
|
99
43
|
* Destroy a Newsletter
|
|
100
44
|
* @category Newsletter
|
|
@@ -105,13 +49,9 @@ var NewsletterLayer = /** @class */ (function (_super) {
|
|
|
105
49
|
* ```
|
|
106
50
|
* @param name id of Newsletter
|
|
107
51
|
*/
|
|
108
|
-
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (id) { return WPP.newsletter.destroy(id); }, id)];
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
};
|
|
52
|
+
async destroyNewsletter(id) {
|
|
53
|
+
return (0, helpers_1.evaluateAndReturn)(this.page, (id) => WPP.newsletter.destroy(id), id);
|
|
54
|
+
}
|
|
115
55
|
/**
|
|
116
56
|
* Edit a Newsletter
|
|
117
57
|
* @category Newsletter
|
|
@@ -126,13 +66,9 @@ var NewsletterLayer = /** @class */ (function (_super) {
|
|
|
126
66
|
* ```
|
|
127
67
|
* @param name id of Newsletter
|
|
128
68
|
*/
|
|
129
|
-
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (id, opts) { return WPP.newsletter.edit(id, opts); }, id, opts)];
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
};
|
|
69
|
+
async editNewsletter(id, opts) {
|
|
70
|
+
return (0, helpers_1.evaluateAndReturn)(this.page, (id, opts) => WPP.newsletter.edit(id, opts), id, opts);
|
|
71
|
+
}
|
|
136
72
|
/**
|
|
137
73
|
* Mute a Newsletter
|
|
138
74
|
* @category Newsletter
|
|
@@ -143,13 +79,8 @@ var NewsletterLayer = /** @class */ (function (_super) {
|
|
|
143
79
|
* ```
|
|
144
80
|
* @param name id of Newsletter
|
|
145
81
|
*/
|
|
146
|
-
|
|
147
|
-
return
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
return NewsletterLayer;
|
|
154
|
-
}(host_layer_1.HostLayer));
|
|
82
|
+
async muteNesletter(id) {
|
|
83
|
+
return (0, helpers_1.evaluateAndReturn)(this.page, (id) => WPP.newsletter.mute(id), id);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
155
86
|
exports.NewsletterLayer = NewsletterLayer;
|
|
@@ -15,67 +15,15 @@
|
|
|
15
15
|
* You should have received a copy of the GNU Lesser General Public License
|
|
16
16
|
* along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
-
var __extends = (this && this.__extends) || (function () {
|
|
19
|
-
var extendStatics = function (d, b) {
|
|
20
|
-
extendStatics = Object.setPrototypeOf ||
|
|
21
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
22
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
23
|
-
return extendStatics(d, b);
|
|
24
|
-
};
|
|
25
|
-
return function (d, b) {
|
|
26
|
-
if (typeof b !== "function" && b !== null)
|
|
27
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
28
|
-
extendStatics(d, b);
|
|
29
|
-
function __() { this.constructor = d; }
|
|
30
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
34
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
35
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
36
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
37
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
38
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
39
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
43
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
44
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
45
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
46
|
-
function step(op) {
|
|
47
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
48
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
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
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
51
|
-
switch (op[0]) {
|
|
52
|
-
case 0: case 1: t = op; break;
|
|
53
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
54
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
55
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
56
|
-
default:
|
|
57
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
58
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
59
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
60
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
61
|
-
if (t[2]) _.ops.pop();
|
|
62
|
-
_.trys.pop(); continue;
|
|
63
|
-
}
|
|
64
|
-
op = body.call(thisArg, _);
|
|
65
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
66
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
19
|
exports.ProfileLayer = void 0;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return _this;
|
|
20
|
+
const helpers_1 = require("../helpers");
|
|
21
|
+
const status_layer_1 = require("./status.layer");
|
|
22
|
+
class ProfileLayer extends status_layer_1.StatusLayer {
|
|
23
|
+
page;
|
|
24
|
+
constructor(page, session, options) {
|
|
25
|
+
super(page, session, options);
|
|
26
|
+
this.page = page;
|
|
79
27
|
}
|
|
80
28
|
/**
|
|
81
29
|
* @category Chat
|
|
@@ -84,158 +32,99 @@ var ProfileLayer = /** @class */ (function (_super) {
|
|
|
84
32
|
* @param type kind of silence "hours" "minutes" "year"
|
|
85
33
|
* To remove the silence, just enter the contact parameter
|
|
86
34
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
result = _a.sent();
|
|
95
|
-
if (result['erro'] == true) {
|
|
96
|
-
throw result;
|
|
97
|
-
}
|
|
98
|
-
return [2 /*return*/, result];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
};
|
|
35
|
+
async sendMute(id, time, type) {
|
|
36
|
+
const result = await (0, helpers_1.evaluateAndReturn)(this.page, (id, time, type) => WAPI.sendMute(id, time, type), id, time, type);
|
|
37
|
+
if (result['erro'] == true) {
|
|
38
|
+
throw result;
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
103
42
|
/**
|
|
104
43
|
* Sets current user profile status
|
|
105
44
|
* @category Profile
|
|
106
45
|
* @param status
|
|
107
46
|
*/
|
|
108
|
-
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var status = _a.status;
|
|
114
|
-
WPP.profile.setMyStatus(status);
|
|
115
|
-
}, { status: status })];
|
|
116
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
};
|
|
47
|
+
async setProfileStatus(status) {
|
|
48
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ status }) => {
|
|
49
|
+
WPP.profile.setMyStatus(status);
|
|
50
|
+
}, { status });
|
|
51
|
+
}
|
|
121
52
|
/**
|
|
122
53
|
* Gets current user profile status
|
|
123
54
|
* @category Profile
|
|
124
55
|
*/
|
|
125
|
-
|
|
126
|
-
return (0, helpers_1.evaluateAndReturn)(this.page,
|
|
127
|
-
}
|
|
56
|
+
getProfileStatus() {
|
|
57
|
+
return (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.profile.getMyStatus());
|
|
58
|
+
}
|
|
128
59
|
/**
|
|
129
60
|
* Sets the user's current profile photo
|
|
130
61
|
* @category Profile
|
|
131
62
|
* @param name
|
|
132
63
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Object.assign(error, {
|
|
166
|
-
code: 'empty_file',
|
|
167
|
-
});
|
|
168
|
-
throw error;
|
|
169
|
-
}
|
|
170
|
-
mimeInfo = (0, helpers_1.base64MimeType)(base64);
|
|
171
|
-
if (!mimeInfo || !mimeInfo.includes('image')) {
|
|
172
|
-
error = new Error('Not an image, allowed formats png, jpeg and webp');
|
|
173
|
-
Object.assign(error, {
|
|
174
|
-
code: 'invalid_image',
|
|
175
|
-
});
|
|
176
|
-
throw error;
|
|
177
|
-
}
|
|
178
|
-
buff = Buffer.from(base64.replace(/^data:image\/(png|jpe?g|webp);base64,/, ''), 'base64');
|
|
179
|
-
return [4 /*yield*/, (0, helpers_1.resizeImg)(buff, { width: 96, height: 96 })];
|
|
180
|
-
case 6:
|
|
181
|
-
_webb64_96 = _a.sent();
|
|
182
|
-
return [4 /*yield*/, (0, helpers_1.resizeImg)(buff, { width: 640, height: 640 })];
|
|
183
|
-
case 7:
|
|
184
|
-
_webb64_640 = _a.sent();
|
|
185
|
-
obj = { a: _webb64_640, b: _webb64_96 };
|
|
186
|
-
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
187
|
-
var obj = _a.obj, to = _a.to;
|
|
188
|
-
return WAPI.setProfilePic(obj, to);
|
|
189
|
-
}, {
|
|
190
|
-
obj: obj,
|
|
191
|
-
to: to,
|
|
192
|
-
})];
|
|
193
|
-
case 8: return [2 /*return*/, _a.sent()];
|
|
194
|
-
}
|
|
64
|
+
async setProfilePic(pathOrBase64, to) {
|
|
65
|
+
let base64 = '';
|
|
66
|
+
if (pathOrBase64.startsWith('data:')) {
|
|
67
|
+
base64 = pathOrBase64;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
let fileContent = await (0, helpers_1.downloadFileToBase64)(pathOrBase64, [
|
|
71
|
+
'image/gif',
|
|
72
|
+
'image/png',
|
|
73
|
+
'image/jpg',
|
|
74
|
+
'image/jpeg',
|
|
75
|
+
'image/webp',
|
|
76
|
+
]);
|
|
77
|
+
if (!fileContent) {
|
|
78
|
+
fileContent = await (0, helpers_1.fileToBase64)(pathOrBase64);
|
|
79
|
+
}
|
|
80
|
+
if (fileContent) {
|
|
81
|
+
base64 = fileContent;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (!base64) {
|
|
85
|
+
const error = new Error('Empty or invalid file or base64');
|
|
86
|
+
Object.assign(error, {
|
|
87
|
+
code: 'empty_file',
|
|
88
|
+
});
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
const mimeInfo = (0, helpers_1.base64MimeType)(base64);
|
|
92
|
+
if (!mimeInfo || !mimeInfo.includes('image')) {
|
|
93
|
+
const error = new Error('Not an image, allowed formats png, jpeg and webp');
|
|
94
|
+
Object.assign(error, {
|
|
95
|
+
code: 'invalid_image',
|
|
195
96
|
});
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
const buff = Buffer.from(base64.replace(/^data:image\/(png|jpe?g|webp);base64,/, ''), 'base64');
|
|
100
|
+
let _webb64_96 = await (0, helpers_1.resizeImg)(buff, { width: 96, height: 96 }), _webb64_640 = await (0, helpers_1.resizeImg)(buff, { width: 640, height: 640 });
|
|
101
|
+
let obj = { a: _webb64_640, b: _webb64_96 };
|
|
102
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ obj, to }) => WAPI.setProfilePic(obj, to), {
|
|
103
|
+
obj,
|
|
104
|
+
to,
|
|
196
105
|
});
|
|
197
|
-
}
|
|
106
|
+
}
|
|
198
107
|
/**
|
|
199
108
|
* Sets current user profile name
|
|
200
109
|
* @category Profile
|
|
201
110
|
* @param name
|
|
202
111
|
*/
|
|
203
|
-
|
|
204
|
-
return
|
|
205
|
-
|
|
206
|
-
switch (_a.label) {
|
|
207
|
-
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
208
|
-
var name = _a.name;
|
|
209
|
-
return WPP.profile.setMyProfileName(name);
|
|
210
|
-
}, { name: name })];
|
|
211
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
};
|
|
112
|
+
async setProfileName(name) {
|
|
113
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ name }) => WPP.profile.setMyProfileName(name), { name });
|
|
114
|
+
}
|
|
216
115
|
/**
|
|
217
116
|
* Gets the current user profile name
|
|
218
117
|
* @category Profile
|
|
219
118
|
*/
|
|
220
|
-
|
|
221
|
-
return (0, helpers_1.evaluateAndReturn)(this.page,
|
|
222
|
-
}
|
|
119
|
+
getProfileName() {
|
|
120
|
+
return (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.profile.getMyProfileName());
|
|
121
|
+
}
|
|
223
122
|
/**
|
|
224
123
|
* Remove your profile picture
|
|
225
124
|
* @category Profile
|
|
226
125
|
*/
|
|
227
|
-
|
|
228
|
-
return
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () {
|
|
232
|
-
return WPP.profile.removeMyProfilePicture();
|
|
233
|
-
})];
|
|
234
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
};
|
|
239
|
-
return ProfileLayer;
|
|
240
|
-
}(status_layer_1.StatusLayer));
|
|
126
|
+
async removeMyProfilePicture() {
|
|
127
|
+
return await (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.profile.removeMyProfilePicture());
|
|
128
|
+
}
|
|
129
|
+
}
|
|
241
130
|
exports.ProfileLayer = ProfileLayer;
|