@iflyrpa/actions 1.1.21 → 1.1.23

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.
@@ -1,2 +1,2 @@
1
- import type { PublishAction } from ".";
1
+ import { type PublishAction } from "./index";
2
2
  export declare const mockAction: PublishAction;
@@ -1,2 +1,2 @@
1
- import type { PublishAction } from "./index";
1
+ import { type PublishAction } from "./index";
2
2
  export declare const rpaAction: PublishAction;
@@ -0,0 +1 @@
1
+ export declare const scanRetryMaxCount = 30;
package/dist/bundle.js CHANGED
@@ -14000,8 +14000,8 @@ var __webpack_exports__ = {};
14000
14000
  if ("mockApi" === params.actionType) return weitoutiaoPublish_mock_mockAction(task, params);
14001
14001
  return executeAction(weitoutiaoPublish_mock_mockAction, weitoutiaoPublish_rpa_rpaAction)(task, params);
14002
14002
  };
14003
- const GET_QRCODE_DEFAULT_ERROR = "群发二维码获取异常,请稍后重试发布。";
14004
14003
  const scanRetryMaxCount = 30;
14004
+ const GET_QRCODE_DEFAULT_ERROR = "群发二维码获取异常,请稍后重试发布。";
14005
14005
  const weixinPublish_mock_errnoMap = {
14006
14006
  200003: "微信公众号号登录状态失效,请重新绑定账号后重试。"
14007
14007
  };
@@ -14317,6 +14317,7 @@ var __webpack_exports__ = {};
14317
14317
  task.logger.info("微信公众号发布完成。");
14318
14318
  return success(appMsgId, "微信公众号发布完成。");
14319
14319
  };
14320
+ const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
14320
14321
  const weixinPublish_rpa_rpaAction = async (task, params)=>{
14321
14322
  const tmpCachePath = task.getTmpPath();
14322
14323
  const commonCookies = {
@@ -14448,13 +14449,57 @@ var __webpack_exports__ = {};
14448
14449
  state: "visible"
14449
14450
  });
14450
14451
  await page.locator(".new_mass_send_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
14452
+ await page.waitForSelector('.double_check_dialog .weui-desktop-dialog__wrp:not([style*="display: none"])', {
14453
+ state: "visible"
14454
+ });
14455
+ await page.locator(".double_check_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
14456
+ try {
14457
+ const startTime = Date.now();
14458
+ await new Promise(async (resolve, reject)=>{
14459
+ const handleResponse = async (response)=>{
14460
+ if (response.url().includes("/safe/safeuuid")) {
14461
+ const jsonResponse = await response.json();
14462
+ if (405 === jsonResponse.errcode) {
14463
+ resolve();
14464
+ page.off("response", handleResponse);
14465
+ } else if (Date.now() - startTime > waitQrcodeResultMaxTime) {
14466
+ reject();
14467
+ page.off("response", handleResponse);
14468
+ }
14469
+ }
14470
+ };
14471
+ page.on("response", handleResponse);
14472
+ await page.waitForSelector('.dialog .js_wxchecks.safe_check img.qrcode.js_qrcode', {
14473
+ state: "visible"
14474
+ });
14475
+ const qrcodeSrc = await page.locator('.dialog .js_wxchecks.safe_check img.qrcode.js_qrcode').first().getAttribute('src');
14476
+ const imgUrl = new URL(qrcodeSrc, page.url()).href;
14477
+ const response = await lib_axios({
14478
+ method: 'get',
14479
+ url: imgUrl,
14480
+ responseType: 'arraybuffer'
14481
+ });
14482
+ const qrcodeFilePath = external_node_path_default().join(tmpCachePath, "weixin_qrcode.jpg");
14483
+ external_node_fs_default().writeFileSync(qrcodeFilePath, response.data);
14484
+ params.safeQrcodeCallback?.(qrcodeFilePath);
14485
+ });
14486
+ } catch (error) {
14487
+ await page.close();
14488
+ return {
14489
+ code: 500,
14490
+ message: "群发二维码已过期,请重试发布。",
14491
+ data: ""
14492
+ };
14493
+ }
14494
+ await page.waitForTimeout(4000);
14495
+ await page.close();
14451
14496
  return success(articleId);
14452
14497
  };
14453
14498
  const weixinPublish = async (task, params)=>{
14454
14499
  task.logger.info("开始微信公众号发布");
14455
14500
  if ("rpa" === params.actionType) return weixinPublish_rpa_rpaAction(task, params);
14456
14501
  if ("mockApi" === params.actionType) return weixinPublish_mock_mockAction(task, params);
14457
- return executeAction(weixinPublish_mock_mockAction, weixinPublish_rpa_rpaAction)(task, params);
14502
+ return executeAction(weixinPublish_rpa_rpaAction, weixinPublish_mock_mockAction)(task, params);
14458
14503
  };
14459
14504
  const mock_saveDraft = (http, params, data)=>{
14460
14505
  const formData = new (form_data_default())();
@@ -15052,7 +15097,7 @@ var __webpack_exports__ = {};
15052
15097
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
15053
15098
  };
15054
15099
  var package_namespaceObject = {
15055
- i8: "1.1.20"
15100
+ i8: "1.1.22"
15056
15101
  };
15057
15102
  class Action {
15058
15103
  constructor(task){