@open-wa/wa-automate 4.23.5 → 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.
@@ -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
  *
@@ -718,6 +718,16 @@ class Client {
718
718
  return this.registerListener(events_2.SimpleListener.Order, fn);
719
719
  });
720
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
+ }
721
731
  /**
722
732
  * [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
723
733
  *
@@ -81,5 +81,10 @@ export declare enum SimpleListener {
81
81
  * Requires licence
82
82
  * Represents [[onContactAdded]]
83
83
  */
84
- Order = "onOrder"
84
+ Order = "onOrder",
85
+ /**
86
+ * Requires licence
87
+ * Represents [[onNewProduct]]
88
+ */
89
+ NewProduct = "onNewProduct"
85
90
  }
@@ -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 = {}));
@@ -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.5",
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": "^7.20.0",
84
+ "eslint": "^8.1.0",
85
85
  "husky": "^7.0.0",
86
86
  "line-reader": "^0.4.0",
87
87
  "marked": "^3.0.0",