@open-wa/wa-automate 4.61.1 → 4.61.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -517,6 +517,12 @@ export interface ConfigObject {
517
517
  * @default `false`
518
518
  */
519
519
  killProcessOnTimeout?: boolean;
520
+ /**
521
+ * If set to true, the system will kill the whole node process when a "TEMPORARY BAN" is detected. This is useful to prevent hanging processes.
522
+ * It is `true` by default because it is a very rare event and it is better to kill the process than to leave it hanging.
523
+ * @default `true`
524
+ */
525
+ killProcessOnBan?: boolean;
520
526
  /**
521
527
  * Setting this to true will bypass web security. DO NOT DO THIS IF YOU DO NOT HAVE TO. CORS issue may arise when using a proxy.
522
528
  * @default `false`
@@ -85,7 +85,7 @@ const isTosBlocked = (waPage) => {
85
85
  };
86
86
  const waitForRipeSession = (waPage) => __awaiter(void 0, void 0, void 0, function* () {
87
87
  try {
88
- yield waPage.waitForFunction(`window.checkRipeSession()`, { timeout: 0, polling: 500 });
88
+ yield waPage.waitForFunction(`window.isRipeSession()`, { timeout: 0, polling: 'mutation' });
89
89
  return true;
90
90
  }
91
91
  catch (error) {
@@ -263,7 +263,7 @@ function initPage(sessionId, config, qrManager, customUserAgent, spinner, _page,
263
263
  yield waPage.exposeFunction("CriticalInternalMessage", ({ value, text }) => __awaiter(this, void 0, void 0, function* () {
264
264
  spinner === null || spinner === void 0 ? void 0 : spinner.info(`${text}`);
265
265
  spinner === null || spinner === void 0 ? void 0 : spinner.emit({ value, text }, "critical_internal_message");
266
- if (value === "TEMP_BAN")
266
+ if (value === "TEMP_BAN" && !(config.killProcessOnBan === false))
267
267
  yield (0, exports.kill)(waPage, undefined, true, undefined, "TEMP_BAN");
268
268
  }));
269
269
  yield (0, init_patch_1.injectProgObserver)(waPage);
@@ -1,4 +1,4 @@
1
- import { Page } from 'puppeteer';
1
+ import type { Page } from 'puppeteer';
2
2
  /**
3
3
  * @private
4
4
  */
@@ -7,3 +7,7 @@ export declare function injectInitPatch(page: Page): Promise<void>;
7
7
  * @private
8
8
  */
9
9
  export declare function injectProgObserver(page: Page): Promise<void>;
10
+ /**
11
+ * @private
12
+ */
13
+ export declare function injectInternalEventHandler(page: Page): Promise<void>;