@open-wa/wa-automate 4.62.0 → 4.62.1

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.
@@ -73,19 +73,23 @@ function initPage(sessionId, config, qrManager, customUserAgent, spinner, _page,
73
73
  browser = yield initBrowser(sessionId, config, spinner);
74
74
  spinner === null || spinner === void 0 ? void 0 : spinner.info(`Browser launched: ${((0, tools_1.now)() - startBrowser).toFixed(0)}ms`);
75
75
  waPage = yield getWAPage(browser);
76
- readline.emitKeypressEvents(process.stdin);
77
- process.stdin.setRawMode(true);
78
- console.log('Press "s" to trigger an event. Press "Ctrl+C" to quit.');
79
- process.stdin.on('keypress', (str, key) => __awaiter(this, void 0, void 0, function* () {
80
- if (key.name === 's') {
81
- const path = `./screenshot_${config.sessionId || "session"}_${Date.now()}.png`;
82
- console.log(`Taking screenshot: ${path} ...`);
83
- yield waPage.screenshot({ path });
84
- }
85
- if (key.ctrl && key.name === 'c') {
86
- process.exit();
87
- }
88
- }));
76
+ if (process.stdin.setRawMode && typeof process.stdin.setRawMode == "function") {
77
+ readline.emitKeypressEvents(process.stdin);
78
+ process.stdin.setRawMode(true);
79
+ console.log('Press "s" to take a screenshot. Press "Ctrl+C" to quit.');
80
+ process.stdin.on('keypress', (str, key) => __awaiter(this, void 0, void 0, function* () {
81
+ if (key.name === 's') {
82
+ const path = `./screenshot_${config.sessionId || "session"}_${Date.now()}.png`;
83
+ console.log(`Taking screenshot: ${path} ...`);
84
+ yield waPage.screenshot({ path });
85
+ }
86
+ if (key.ctrl && key.name === 'c') {
87
+ process.exit();
88
+ }
89
+ }));
90
+ }
91
+ else
92
+ console.log("Unable to set raw mode on stdin. Keypress events will not be emitted. You cannot take a screenshot by pressing 's' during launch.");
89
93
  }
90
94
  //@ts-ignore
91
95
  yield (typeof waPage._client === 'function' && waPage._client() || waPage._client).send('Network.setBypassServiceWorker', { bypass: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.62.0",
3
+ "version": "4.62.1",
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",