@open-wa/wa-automate 4.28.3 → 4.28.4

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.
@@ -40,7 +40,6 @@ const tools_1 = require("../utils/tools");
40
40
  const browser_1 = require("./browser");
41
41
  const axios_1 = __importDefault(require("axios"));
42
42
  const logging_1 = require("../logging/logging");
43
- const timeout = ms => new Promise(resolve => setTimeout(resolve, ms, 'timeout'));
44
43
  /**
45
44
  * Validates if client is authenticated
46
45
  * @returns true if is authenticated, false otherwise
@@ -132,7 +131,6 @@ function smartQr(waPage, config, spinner) {
132
131
  (0, tools_1.processSend)('ready');
133
132
  if (config.qrMax && qrNum >= config.qrMax) {
134
133
  spinner.info('QR Code limit reached, exiting...');
135
- yield timeout(3000);
136
134
  yield (0, browser_1.kill)(waPage, null, true, null, "QR_LIMIT_REACHED");
137
135
  }
138
136
  if (config.ezqr || config.inDocker) {
@@ -169,7 +167,7 @@ function smartQr(waPage, config, spinner) {
169
167
  const _hasDefaultStateYet = yield waPage.evaluate("!!(window.Store && window.Store.State && window.Store.State.Socket)");
170
168
  if (!_hasDefaultStateYet) {
171
169
  //expecting issue, take a screenshot then wait a few seconds before continuing
172
- yield timeout(2000);
170
+ yield (0, tools_1.timeout)(2000);
173
171
  }
174
172
  return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
175
173
  const funcName = '_smartQr';
@@ -380,9 +380,9 @@ function getWAPage(browser) {
380
380
  */
381
381
  const kill = (p, b, exit, pid, reason = "LAUNCH_KILL") => __awaiter(void 0, void 0, void 0, function* () {
382
382
  (0, tools_1.processSendData)({
383
- type: "close",
384
383
  reason
385
384
  });
385
+ (0, tools_1.timeout)(3000);
386
386
  const killBrowser = (browser) => __awaiter(void 0, void 0, void 0, function* () {
387
387
  if (!browser)
388
388
  return;
@@ -1,5 +1,6 @@
1
1
  import { DataURL } from '../api/model';
2
2
  import { AxiosRequestConfig } from 'axios';
3
+ export declare const timeout: (ms: any) => Promise<unknown>;
3
4
  /**
4
5
  * Use this to generate a more likely valid user agent. It makes sure it has the WA part and replaces any windows or linux os info with mac.
5
6
  * @param useragent Your custom user agent
@@ -25,4 +26,4 @@ export declare const getDUrl: (url: string, optionsOverride?: AxiosRequestConfig
25
26
  */
26
27
  export declare const base64MimeType: (dUrl: DataURL) => string;
27
28
  export declare const processSend: (message: string) => void;
28
- export declare const processSendData: (data?: any) => boolean;
29
+ export declare const processSendData: (data?: any) => void;
@@ -23,8 +23,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.processSendData = exports.processSend = exports.base64MimeType = exports.getDUrl = exports.isDataURL = exports.isBase64 = exports.camelize = exports.without = exports.getConfigFromProcessEnv = exports.smartUserAgent = void 0;
26
+ exports.processSendData = exports.processSend = exports.base64MimeType = exports.getDUrl = exports.isDataURL = exports.isBase64 = exports.camelize = exports.without = exports.getConfigFromProcessEnv = exports.smartUserAgent = exports.timeout = void 0;
27
27
  const axios_1 = __importDefault(require("axios"));
28
+ //@ts-ignore
29
+ process.send = process.send || function () { };
30
+ const timeout = ms => new Promise(resolve => setTimeout(resolve, ms, 'timeout'));
31
+ exports.timeout = timeout;
28
32
  /**
29
33
  * Use this to generate a more likely valid user agent. It makes sure it has the WA part and replaces any windows or linux os info with mac.
30
34
  * @param useragent Your custom user agent
@@ -134,9 +138,10 @@ const processSend = (message) => {
134
138
  };
135
139
  exports.processSend = processSend;
136
140
  const processSendData = (data = {}) => {
137
- return process.send({
141
+ process.send({
138
142
  type: 'process:msg',
139
143
  data
140
144
  });
145
+ return;
141
146
  };
142
147
  exports.processSendData = processSendData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.28.3",
3
+ "version": "4.28.4",
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",