@open-wa/wa-automate 4.35.0 → 4.35.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { Page } from 'puppeteer';
3
- import { Chat, LiveLocationChangedEvent, ChatState, ChatMuteDuration, GroupChatCreationResponse } from './model/chat';
3
+ import { Chat, LiveLocationChangedEvent, ChatState, ChatMuteDuration, GroupChatCreationResponse, EphemeralDuration } from './model/chat';
4
4
  import { Contact, NumberCheck } from './model/contact';
5
5
  import { Message } from './model/message';
6
6
  import { AxiosRequestConfig } from 'axios';
@@ -1551,10 +1551,10 @@ export declare class Client {
1551
1551
  *
1552
1552
  * Turn the ephemeral setting in a chat to on or off
1553
1553
  * @param chatId The ID of the chat
1554
- * @param ephemeral `true` to turn on the ephemeral setting, `false` to turn off the ephemeral setting. Please note, if the setting is already on the requested setting, this method will return `true`.
1554
+ * @param ephemeral `true` to turn on the ephemeral setting to 1 day, `false` to turn off the ephemeral setting. Other options: `604800 | 7776000`
1555
1555
  * @returns `Promise<boolean>` true if the setting was set, `false` if the chat does not exist
1556
1556
  */
1557
- setChatEphemeral(chatId: ChatId, ephemeral: boolean): Promise<boolean>;
1557
+ setChatEphemeral(chatId: ChatId, ephemeral: EphemeralDuration | boolean): Promise<boolean>;
1558
1558
  /**
1559
1559
  * Send a giphy GIF as an animated sticker.
1560
1560
  * @param to ChatId
@@ -3203,7 +3203,7 @@ class Client {
3203
3203
  *
3204
3204
  * Turn the ephemeral setting in a chat to on or off
3205
3205
  * @param chatId The ID of the chat
3206
- * @param ephemeral `true` to turn on the ephemeral setting, `false` to turn off the ephemeral setting. Please note, if the setting is already on the requested setting, this method will return `true`.
3206
+ * @param ephemeral `true` to turn on the ephemeral setting to 1 day, `false` to turn off the ephemeral setting. Other options: `604800 | 7776000`
3207
3207
  * @returns `Promise<boolean>` true if the setting was set, `false` if the chat does not exist
3208
3208
  */
3209
3209
  setChatEphemeral(chatId, ephemeral) {
@@ -207,3 +207,7 @@ export interface GroupChatCreationResponse {
207
207
  ContactId?: GroupChatCreationParticipantAddResponse;
208
208
  }[];
209
209
  }
210
+ /**
211
+ * Ephemeral duration can be 1 day, 7 days or 90 days. The default is 1 day.
212
+ */
213
+ export declare type EphemeralDuration = 86400 | 604800 | 7776000;
@@ -314,7 +314,10 @@ function create(config = {}) {
314
314
  yield (0, exports.timeout)(5000);
315
315
  }
316
316
  //@ts-ignore
317
- const VALID_SESSION = yield waPage.waitForFunction(`window.Store && window.Store.Msg ? true : false`, { timeout: 9000, polling: 200 }).catch(e => false);
317
+ const VALID_SESSION = yield waPage.waitForFunction(`window.Store && window.Store.Msg ? true : false`, { timeout: 9000, polling: 200 }).catch((e) => __awaiter(this, void 0, void 0, function* () {
318
+ logging_1.log.error("Valid session check failed", e);
319
+ return false;
320
+ }));
318
321
  if (VALID_SESSION) {
319
322
  /**
320
323
  * Session is valid, attempt to preload patches
@@ -428,6 +431,8 @@ function create(config = {}) {
428
431
  return client;
429
432
  }
430
433
  else {
434
+ const storeKeys = yield waPage.evaluate(`Object.keys(window.Store || {})`);
435
+ logging_1.log.info("Store keys", storeKeys);
431
436
  spinner.fail('The session is invalid. Retrying');
432
437
  yield (0, browser_1.kill)(waPage);
433
438
  return yield create(config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.35.0",
3
+ "version": "4.35.3",
4
4
  "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",