@open-wa/wa-automate 4.23.2 → 4.23.6
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/dist/api/Client.d.ts +6 -0
- package/dist/api/Client.js +15 -2
- package/dist/api/model/config.d.ts +1 -1
- package/dist/api/model/events.d.ts +6 -1
- package/dist/api/model/events.js +5 -0
- package/dist/cli/setup.js +1 -1
- package/dist/controllers/initializer.js +5 -1
- package/dist/lib/wapi.js +1 -1
- package/package.json +2 -2
package/dist/api/Client.d.ts
CHANGED
@@ -210,6 +210,12 @@ export declare class Client {
|
|
210
210
|
* Listens to new orders. Only works on business accounts
|
211
211
|
*/
|
212
212
|
onOrder(fn: (order: Order) => void): Promise<Listener | boolean>;
|
213
|
+
/**
|
214
|
+
*[REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
215
|
+
*
|
216
|
+
* Listens to new orders. Only works on business accounts
|
217
|
+
*/
|
218
|
+
onNewProduct(fn: (product: Product) => void): Promise<Listener | boolean>;
|
213
219
|
/**
|
214
220
|
* [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
215
221
|
*
|
package/dist/api/Client.js
CHANGED
@@ -266,7 +266,10 @@ class Client {
|
|
266
266
|
const ident = typeof ((_f = this._createConfig) === null || _f === void 0 ? void 0 : _f.autoEmoji) === "string" ? (_g = this._createConfig) === null || _g === void 0 ? void 0 : _g.autoEmoji : ":";
|
267
267
|
this.onMessage((message) => __awaiter(this, void 0, void 0, function* () {
|
268
268
|
if (message.body && message.body.startsWith(ident) && message.body.endsWith(ident)) {
|
269
|
-
|
269
|
+
const emojiId = message.body.replace(new RegExp(ident, 'g'), "");
|
270
|
+
if (!emojiId)
|
271
|
+
return;
|
272
|
+
return yield this.sendEmoji(message.from, emojiId, message.id);
|
270
273
|
}
|
271
274
|
}));
|
272
275
|
}
|
@@ -715,6 +718,16 @@ class Client {
|
|
715
718
|
return this.registerListener(events_2.SimpleListener.Order, fn);
|
716
719
|
});
|
717
720
|
}
|
721
|
+
/**
|
722
|
+
*[REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
723
|
+
*
|
724
|
+
* Listens to new orders. Only works on business accounts
|
725
|
+
*/
|
726
|
+
onNewProduct(fn) {
|
727
|
+
return __awaiter(this, void 0, void 0, function* () {
|
728
|
+
return this.registerListener(events_2.SimpleListener.NewProduct, fn);
|
729
|
+
});
|
730
|
+
}
|
718
731
|
/**
|
719
732
|
* [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
720
733
|
*
|
@@ -2795,7 +2808,7 @@ class Client {
|
|
2795
2808
|
a.stickerMetadata = { discord: this._createConfig.discord };
|
2796
2809
|
}
|
2797
2810
|
try {
|
2798
|
-
const { data } = yield axios_1.default.post(`${((fallback ? pkg.stickerUrl : 'https://
|
2811
|
+
const { data } = yield axios_1.default.post(`${((fallback ? pkg.stickerUrl : 'https://sticker-api.openwa.dev') || this._createConfig.stickerServerEndpoint).replace(/\/$/, '')}/${func}`, Object.assign(Object.assign({}, a), { sessionInfo, config: this.getConfig() }), {
|
2799
2812
|
maxBodyLength: 20000000,
|
2800
2813
|
maxContentLength: 1500000 // 1.5mb response body limit
|
2801
2814
|
});
|
@@ -545,7 +545,7 @@ export interface ConfigObject {
|
|
545
545
|
*
|
546
546
|
* Redundant until self-hostable sticker server is available.
|
547
547
|
*
|
548
|
-
* @default `https://
|
548
|
+
* @default `https://sticker-api.openwa.dev`
|
549
549
|
*/
|
550
550
|
stickerServerEndpoint?: string | boolean;
|
551
551
|
/**
|
package/dist/api/model/events.js
CHANGED
@@ -89,4 +89,9 @@ var SimpleListener;
|
|
89
89
|
* Represents [[onContactAdded]]
|
90
90
|
*/
|
91
91
|
SimpleListener["Order"] = "onOrder";
|
92
|
+
/**
|
93
|
+
* Requires licence
|
94
|
+
* Represents [[onNewProduct]]
|
95
|
+
*/
|
96
|
+
SimpleListener["NewProduct"] = "onNewProduct";
|
92
97
|
})(SimpleListener = exports.SimpleListener || (exports.SimpleListener = {}));
|
package/dist/cli/setup.js
CHANGED
@@ -353,7 +353,7 @@ const cli = () => {
|
|
353
353
|
booleanDefault: undefined
|
354
354
|
});
|
355
355
|
const cliConfig = Object.assign(Object.assign(Object.assign({ sessionId: "session" }, _cli.flags), (exports.configFile(_cli.flags.config) || {})), exports.envArgs());
|
356
|
-
const PORT = cliConfig.port || process.env.PORT || 8080;
|
356
|
+
const PORT = Number(cliConfig.port || process.env.PORT || 8080);
|
357
357
|
const spinner = new events_1.Spin(cliConfig.sessionId, 'STARTUP', cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.disableSpins);
|
358
358
|
const createConfig = Object.assign({}, cliConfig);
|
359
359
|
if (cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.session) {
|
@@ -85,7 +85,7 @@ let axios;
|
|
85
85
|
*/
|
86
86
|
//@ts-ignore
|
87
87
|
function create(config = {}) {
|
88
|
-
var _a, _b;
|
88
|
+
var _a, _b, _c;
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
90
90
|
const START_TIME = Date.now();
|
91
91
|
let waPage = undefined;
|
@@ -398,6 +398,10 @@ function create(config = {}) {
|
|
398
398
|
catch (error) {
|
399
399
|
spinner.emit(error.message);
|
400
400
|
yield kill(waPage);
|
401
|
+
if (error.name === "ProtocolError" && ((_c = error.message) === null || _c === void 0 ? void 0 : _c.includes("Target closed"))) {
|
402
|
+
spinner.fail(error.message);
|
403
|
+
process.exit();
|
404
|
+
}
|
401
405
|
if (error.name === "TimeoutError" && (config === null || config === void 0 ? void 0 : config.multiDevice)) {
|
402
406
|
spinner.fail(`Please delete the ${config === null || config === void 0 ? void 0 : config.userDataDir} folder and any related data.json files and try again. It is highly suggested to set useChrome: true also.`);
|
403
407
|
}
|
package/dist/lib/wapi.js
CHANGED
@@ -52,7 +52,7 @@ if (!window.Store||!window.Store.Msg) {
|
|
52
52
|
{ id: "Participants", conditions: (module) => (module.addParticipants && module.removeParticipants && module.promoteParticipants && module.demoteParticipants) ? module : null },
|
53
53
|
{ id: "WidFactory", conditions: (module) => (module.isWidlike && module.createWid && module.createWidFromWidLike) ? module : null },
|
54
54
|
{ id: "Base", conditions: (module) => (module.setSubProtocol && module.binSend && module.actionNode) ? module : null },
|
55
|
-
{ id: "Versions", conditions: (module) => (module.loadProtoVersions && module.default["15"] && module.default["16"] && module.default["17"]) ? module : null },
|
55
|
+
{ id: "Versions", conditions: (module) => (module.loadProtoVersions && module.default && module.default["15"] && module.default["16"] && module.default["17"]) ? module : null },
|
56
56
|
{ id: "Sticker", conditions: (module) => (module.default && module.default.Sticker) ? module.default.Sticker : null },
|
57
57
|
{ id: "MediaUpload", conditions: (module) => (module.default && module.default.mediaUpload) ? module.default : null },
|
58
58
|
{ id: "UploadUtils", conditions: (module) => (module.default && module.default.encryptAndUpload) ? module.default : null }
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@open-wa/wa-automate",
|
3
|
-
"version": "4.23.
|
3
|
+
"version": "4.23.6",
|
4
4
|
"licenseCheckUrl": "https://openwa.dev/license-check",
|
5
5
|
"brokenMethodReportUrl": "https://openwa.dev/report-bm",
|
6
6
|
"patches": "https://cdn.openwa.dev/patches.json",
|
@@ -81,7 +81,7 @@
|
|
81
81
|
"ava": "^3.13.0",
|
82
82
|
"changelog-parser": "^2.8.0",
|
83
83
|
"command-line-args": "^5.1.1",
|
84
|
-
"eslint": "^
|
84
|
+
"eslint": "^8.1.0",
|
85
85
|
"husky": "^7.0.0",
|
86
86
|
"line-reader": "^0.4.0",
|
87
87
|
"marked": "^3.0.0",
|