@open-wa/wa-automate 4.31.9 → 4.31.12

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,6 +40,7 @@ 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 boxen_1 = __importDefault(require("boxen"));
43
44
  /**
44
45
  * isAuthenticated
45
46
  * Validates if client is authenticated
@@ -121,13 +122,14 @@ class QRManager {
121
122
  this._internalQrPngLoaded = false;
122
123
  this.qrCheck = `document.querySelector("canvas[aria-label='Scan me!']")?document.querySelector("canvas[aria-label='Scan me!']").parentElement.getAttribute("data-ref"):false`;
123
124
  this.config = config;
125
+ this.setConfig(this.config);
124
126
  }
125
127
  setConfig(config) {
126
128
  this.config = config;
127
129
  this.qrEvF(this.config);
128
130
  }
129
131
  qrEvF(config = this.config) {
130
- return new events_1.EvEmitter(config.sessionId || 'session', 'qr');
132
+ // return new EvEmitter(config.sessionId || 'session', 'qr');
131
133
  if (!this.qrEv)
132
134
  this.qrEv = new events_1.EvEmitter(config.sessionId || 'session', 'qr');
133
135
  return this.qrEv;
@@ -144,8 +146,11 @@ class QRManager {
144
146
  spinner.info(`First QR: ${Date.now() - browser_1.BROWSER_START_TS} ms`);
145
147
  if (qrData) {
146
148
  qrEv.emit(qrData, `qrData`);
147
- if (!config.qrLogSkip)
148
- qrcode.generate(qrData, { small: true });
149
+ if (!config.qrLogSkip) {
150
+ qrcode.generate(qrData, { small: true }, terminalQrCode => {
151
+ console.log((0, boxen_1.default)(terminalQrCode, { title: config.sessionId, padding: 1, titleAlignment: 'center' }));
152
+ });
153
+ }
149
154
  else {
150
155
  console.log(`New QR Code generated. Not printing in console because qrLogSkip is set to true`);
151
156
  logging_1.log.info(`New QR Code generated. Not printing in console because qrLogSkip is set to true`);
@@ -52,7 +52,7 @@ function initPage(sessionId, config, qrManager, customUserAgent, spinner, _page,
52
52
  var _a, _b, _c, _d, _e;
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
54
  const setupPromises = [];
55
- script_preloader_1.scriptLoader.loadScripts();
55
+ yield script_preloader_1.scriptLoader.loadScripts();
56
56
  if ((config === null || config === void 0 ? void 0 : config.resizable) === undefined || !(config === null || config === void 0 ? void 0 : config.resizable) == false)
57
57
  config.defaultViewport = null;
58
58
  if (config === null || config === void 0 ? void 0 : config.useStealth) {
@@ -338,7 +338,7 @@ function injectWapi(page, spinner, force = false) {
338
338
  if (initCheck)
339
339
  return;
340
340
  logging_1.log.info(`WAPI CHECK: ${initCheck}`);
341
- if (!check)
341
+ if (!initCheck)
342
342
  force = true;
343
343
  if (wapiInjected && !force)
344
344
  return page;
@@ -66,8 +66,10 @@ class ScriptLoader {
66
66
  return __awaiter(this, void 0, void 0, function* () {
67
67
  if (!this.contentRegistry[scriptName]) {
68
68
  this.contentRegistry[scriptName] = yield read(scriptName);
69
- logging_1.log.info("SCRIPT READY: " + scriptName);
69
+ logging_1.log.info(`SCRIPT READY: ${scriptName} ${this.contentRegistry[scriptName].length}`);
70
70
  }
71
+ else
72
+ logging_1.log.info(`GET SCRIPT: ${scriptName} ${this.contentRegistry[scriptName].length}`);
71
73
  return this.contentRegistry[scriptName];
72
74
  });
73
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.31.9",
3
+ "version": "4.31.12",
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",