@open-wa/wa-automate 4.45.0 → 4.46.0

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.
@@ -934,6 +934,11 @@ export declare class Client {
934
934
  * @returns
935
935
  */
936
936
  getLicenseType(): Promise<LicenseType | false>;
937
+ /**
938
+ * The EASY API uses this string to secure a subdomain on the openwa public tunnel service.
939
+ * @returns
940
+ */
941
+ getTunnelCode(): Promise<string>;
937
942
  /**
938
943
  * Get an array of chatIds with their respective last message's timestamp.
939
944
  *
@@ -2152,6 +2152,15 @@ class Client {
2152
2152
  return yield this.pup(() => WAPI.getLicenseType());
2153
2153
  });
2154
2154
  }
2155
+ /**
2156
+ * The EASY API uses this string to secure a subdomain on the openwa public tunnel service.
2157
+ * @returns
2158
+ */
2159
+ getTunnelCode() {
2160
+ return __awaiter(this, void 0, void 0, function* () {
2161
+ return yield this.pup(() => WAPI.getTunnelCode());
2162
+ });
2163
+ }
2155
2164
  /**
2156
2165
  * Get an array of chatIds with their respective last message's timestamp.
2157
2166
  *
package/dist/cli/index.js CHANGED
@@ -199,7 +199,11 @@ function start() {
199
199
  });
200
200
  if (cliConfig.tunnel) {
201
201
  spinner.info(`\n• Setting up external tunnel`);
202
- const tunnel = yield (0, localtunnel_1.default)({ port: PORT });
202
+ const tunnel = yield (0, localtunnel_1.default)({
203
+ port: PORT,
204
+ host: "https://public.openwa.cloud",
205
+ subdomain: yield client.getTunnelCode()
206
+ });
203
207
  cliConfig.apiHost = cliConfig.tunnel = tunnel.url;
204
208
  spinner.succeed(`\n\t${(0, terminal_link_1.default)('External address', tunnel.url)}`);
205
209
  }
@@ -212,7 +216,8 @@ function start() {
212
216
  const statsLink = (0, terminal_link_1.default)('API Stats', swaggerStatsUrl);
213
217
  spinner.succeed(`\n\t${statsLink}`);
214
218
  }
215
- yield (0, chatwoot_1.setupChatwootOutgoingMessageHandler)(cliConfig, client);
219
+ if (cliConfig === null || cliConfig === void 0 ? void 0 : cliConfig.chatwootUrl)
220
+ yield (0, chatwoot_1.setupChatwootOutgoingMessageHandler)(cliConfig, client);
216
221
  }
217
222
  yield ready(Object.assign(Object.assign(Object.assign(Object.assign({}, createConfig), cliConfig), client.getSessionInfo()), { hostAccountNumber: yield client.getHostNumber() }));
218
223
  if (cliConfig.emitUnread) {
@@ -233,7 +233,10 @@ function initPage(sessionId, config, qrManager, customUserAgent, spinner, _page,
233
233
  const WEB_START_TS = new Date().getTime();
234
234
  const webRes = yield waPage.goto(puppeteer_config_1.puppeteerConfig.WAUrl);
235
235
  const WEB_END_TS = new Date().getTime();
236
- yield waPage.exposeFunction("ProgressBarEvent", ({ value, text }) => spinner === null || spinner === void 0 ? void 0 : spinner.info(`${(value || value === 0) && `${value}%:\t`} ${text}`));
236
+ yield waPage.exposeFunction("ProgressBarEvent", ({ value, text }) => {
237
+ spinner === null || spinner === void 0 ? void 0 : spinner.info(`${(value || value === 0) && `${value}%:\t`} ${text}`);
238
+ spinner === null || spinner === void 0 ? void 0 : spinner.emit({ value, text }, "internal_launch_progress");
239
+ });
237
240
  yield (0, init_patch_1.injectProgObserver)(waPage);
238
241
  if (webRes == null) {
239
242
  spinner === null || spinner === void 0 ? void 0 : spinner.info(`Page loaded but something may have gone wrong: ${WEB_END_TS - WEB_START_TS}ms`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.45.0",
3
+ "version": "4.46.0",
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",