@iflyrpa/actions 1.2.5-beta.3 → 1.2.5

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.
package/dist/index.mjs CHANGED
@@ -198,24 +198,6 @@ async function copyHtmlToClipboard(page, html, options = {
198
198
  }, html);
199
199
  }
200
200
  }
201
- function PopupListener(page, popupSelector, popKey, buttonSelector, options = {}) {
202
- const { checkInterval = 1000, stopAfterClick = false } = options;
203
- const popup = page.locator(popupSelector);
204
- const button = page.locator(buttonSelector);
205
- const intervalId = setInterval(async ()=>{
206
- try {
207
- if (await popup.count() > 0 && await popup.isVisible() && (await popup.textContent() || "").includes(popKey)) {
208
- await button.click({
209
- force: true
210
- });
211
- if (stopAfterClick) clearInterval(intervalId);
212
- }
213
- } catch (err) {}
214
- }, checkInterval);
215
- return ()=>{
216
- clearInterval(intervalId);
217
- };
218
- }
219
201
  const parseUrlQueryString = (url)=>{
220
202
  const queryStringObject = {};
221
203
  if (!url || !url.includes("?")) return queryStringObject;
@@ -1119,25 +1101,13 @@ const QuotaType = {
1119
1101
  Normal: "kQuotaTypeMassSendNormal",
1120
1102
  ProductActivity: "kQuotaTypeMassSendProductActivity"
1121
1103
  };
1122
- const GET_QRCODE_DEFAULT_ERROR = "二维码获取异常,请稍后重试。";
1104
+ const GET_QRCODE_DEFAULT_ERROR = "二维码获取异常,请稍后重试发布。";
1123
1105
  const weixinPublish_mock_errnoMap = {
1124
- 200003: "微信公众号号登录状态失效,请重新绑定账号后重试。",
1125
- 420001: "封面图不支持GIF,请更换后重试。",
1126
- 200002: "上传图片参数错误,请检查后重试。",
1127
- 200039: "上传图片高度(像素)与宽度(像素)的乘积不能超过600万,请更换后重试。",
1128
- 153201: "不支持发布审核中或转码中的视频",
1129
- 200007: "登陆失败,请重新登陆账户后重试。",
1130
- 64703: "摘要超出120字长度限制,请修改摘要后重试。",
1131
- "-4": "不支持发布审核中或转码中的视频"
1106
+ 200003: "微信公众号号登录状态失效,请重新绑定账号后重试。"
1132
1107
  };
1133
1108
  const ignoreErrno = [
1134
1109
  154019
1135
1110
  ];
1136
- const userTypeMap = {
1137
- 所有用户: 1,
1138
- 已关注的用户: 2,
1139
- 已关注7天及以上的用户: 3
1140
- };
1141
1111
  const generatorFormData = (data)=>{
1142
1112
  const formData = new URLSearchParams();
1143
1113
  for (const [key, value] of Object.entries(data))formData.append(key, String(value));
@@ -1245,223 +1215,6 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
1245
1215
  const coverRes = await uploadImages([
1246
1216
  params.settingInfo.wxCover
1247
1217
  ]);
1248
- let oriWhitelist = null;
1249
- if (params.settingInfo?.wxCopyright && params.settingInfo?.wxWhitelist) {
1250
- const _oriWhitelist = params.settingInfo.wxWhitelist;
1251
- if (_oriWhitelist && _oriWhitelist.length > 0) {
1252
- const white_list = [];
1253
- const white_list_user = {
1254
- nickname: "",
1255
- title: "可修改文章",
1256
- openid: "",
1257
- wx_name: "",
1258
- username: "",
1259
- avatar: "",
1260
- can_modify: "1",
1261
- can_hide_source: "0",
1262
- can_reward: "0"
1263
- };
1264
- for (const _user of _oriWhitelist){
1265
- const userInfo_res = await http.api({
1266
- method: "post",
1267
- url: "https://mp.weixin.qq.com/cgi-bin/appmsgcopyright?action=searchacct",
1268
- params: {
1269
- action: "searchacct"
1270
- },
1271
- data: generatorFormData({
1272
- lang: "zh_CN",
1273
- f: "json",
1274
- ajax: 1,
1275
- token: params.token,
1276
- random: Math.random().toString(),
1277
- username: _user
1278
- }),
1279
- defaultErrorMsg: "搜索用户信息失败"
1280
- });
1281
- if (!(userInfo_res.search_list.length > 0)) return {
1282
- code: 200,
1283
- message: `白名单用户:${_user} 未搜索到,请确定输入是否正确!`,
1284
- data: ''
1285
- };
1286
- {
1287
- let userInfo_resJson = userInfo_res.search_list[0];
1288
- white_list_user.nickname = userInfo_resJson.nickname;
1289
- white_list_user.openid = userInfo_resJson.openid;
1290
- white_list_user.avatar = userInfo_resJson.pic_url;
1291
- white_list_user.username = userInfo_resJson.username;
1292
- white_list_user.wx_name = userInfo_resJson.wx_name;
1293
- white_list.push({
1294
- ...white_list_user
1295
- });
1296
- }
1297
- }
1298
- oriWhitelist = white_list.length > 0 ? JSON.stringify({
1299
- white_list: white_list
1300
- }) : "";
1301
- }
1302
- }
1303
- let writerid = null;
1304
- let reply_id = null;
1305
- if (params.settingInfo.wxCopyright && params.settingInfo.wxRewardTarget) {
1306
- async function getWriterList() {
1307
- const res = await http.api({
1308
- method: "get",
1309
- url: 'https://mp.weixin.qq.com/acct/writermgr',
1310
- params: {
1311
- action: 'get_writer_list',
1312
- fingerprint,
1313
- token: params.token,
1314
- lang: "zh_CN",
1315
- f: "json",
1316
- ajax: 1
1317
- }
1318
- });
1319
- return res.pageinfo.writerlist || [];
1320
- }
1321
- async function getRewardText() {
1322
- const res = await http.api({
1323
- method: "get",
1324
- url: 'https://mp.weixin.qq.com/merchant/reward',
1325
- params: {
1326
- action: 'getautoreply',
1327
- fingerprint,
1328
- token: params.token,
1329
- lang: "zh_CN",
1330
- f: "json",
1331
- ajax: 1
1332
- }
1333
- });
1334
- return res.reply_infos;
1335
- }
1336
- for(var _type in params.settingInfo.wxRewardTarget)if ("author" === _type) {
1337
- if (0 == (await getWriterList()).length) {
1338
- const rewardbind = await http.api({
1339
- method: "get",
1340
- url: "https://mp.weixin.qq.com/acct/writermgr",
1341
- params: {
1342
- action: "get_rewardbind_qrcode",
1343
- random: Math.random().toString(),
1344
- fingerprint,
1345
- token: params.token,
1346
- lang: "zh_CN",
1347
- f: "json",
1348
- ajax: 1
1349
- },
1350
- defaultErrorMsg: GET_QRCODE_DEFAULT_ERROR
1351
- });
1352
- const rewardBuffer = Buffer.from(rewardbind.qrcode_base64, 'base64');
1353
- const rewardFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, "weixin_reward.jpg");
1354
- __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].writeFileSync(rewardFilePath, new Uint8Array(rewardBuffer));
1355
- params.safeQrcodeCallback?.(rewardFilePath);
1356
- const task_id = rewardbind.task_id;
1357
- let code = null;
1358
- for(let i = 0; i < scanRetryMaxCount; i++){
1359
- await (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.sleep)(2000);
1360
- const checkScanResult = await http.api({
1361
- method: "get",
1362
- url: "https://mp.weixin.qq.com/acct/writermgr",
1363
- params: {
1364
- action: "query_rewardbind_qrcode_status",
1365
- task_id: task_id,
1366
- fingerprint,
1367
- lang: "zh_CN",
1368
- f: "json",
1369
- ajax: 1,
1370
- token: params.token,
1371
- timespam: Date.now()
1372
- }
1373
- });
1374
- code = checkScanResult.qrcode_status;
1375
- if (2 == code && (await getWriterList()).length > 0) break;
1376
- if (i === scanRetryMaxCount - 1) return {
1377
- code: 200,
1378
- message: "二维码已过期,请重试绑定。",
1379
- data: ""
1380
- };
1381
- }
1382
- }
1383
- let _writer = await getWriterList();
1384
- for (var _writer_item of _writer)if (_writer_item.nickname === params.settingInfo.wxRewardTarget[_type]) writerid = _writer_item.writerid;
1385
- if (!writerid) return {
1386
- code: 200,
1387
- message: "未匹配到赞赏绑定用户,请确认用户名与绑定是否正常!",
1388
- data: ""
1389
- };
1390
- if (params.settingInfo?.wxRewardText) {
1391
- let rewardList = await getRewardText();
1392
- let matchdID = rewardList.find((reward)=>reward.text === params.settingInfo.wxRewardText)?.reply_id ?? null;
1393
- if (0 != rewardList.length && matchdID) reply_id = matchdID;
1394
- else await http.api({
1395
- method: "post",
1396
- url: 'https://mp.weixin.qq.com/merchant/reward',
1397
- params: {
1398
- action: 'addautoreply'
1399
- },
1400
- data: generatorFormData({
1401
- type: 1,
1402
- fingerprint,
1403
- token: params.token,
1404
- lang: "zh_CN",
1405
- f: "json",
1406
- ajax: 1,
1407
- text: params.settingInfo.wxRewardText
1408
- })
1409
- });
1410
- if (!matchdID) {
1411
- for (var _reply_item of (await getRewardText()))reply_id = (await getRewardText()).find((reward)=>reward.text === params.settingInfo.wxRewardText)?.reply_id;
1412
- if (!reply_id) return {
1413
- code: 200,
1414
- message: "赞赏文案添加失败,请重新检查",
1415
- data: ""
1416
- };
1417
- }
1418
- }
1419
- }
1420
- }
1421
- const wxInteractionInfo = (()=>{
1422
- const _wxInteraction = {
1423
- need_open_comment0: 0,
1424
- only_fans_can_comment0: 0,
1425
- only_fans_days_can_comment0: 0,
1426
- reply_flag0: 2,
1427
- auto_elect_comment0: 0,
1428
- auto_elect_reply0: 1,
1429
- open_fansmsg0: 0
1430
- };
1431
- const type = params?.settingInfo?.wxInteraction?.Type ?? "";
1432
- if ("public" === type) {
1433
- const _opt = params?.settingInfo?.wxInteraction?.Option;
1434
- if (!_opt || !_opt.Comment || !_opt.reply || null == _opt.elect_comment || null == _opt.elect_reply) return null;
1435
- const commentType = userTypeMap[_opt.Comment];
1436
- const replyType = userTypeMap[_opt.reply] + 1;
1437
- _wxInteraction.need_open_comment0 = 1;
1438
- switch(commentType){
1439
- case 1:
1440
- _wxInteraction.only_fans_can_comment0 = 0;
1441
- _wxInteraction.only_fans_days_can_comment0 = 0;
1442
- break;
1443
- case 2:
1444
- _wxInteraction.only_fans_can_comment0 = 1;
1445
- _wxInteraction.only_fans_days_can_comment0 = 0;
1446
- break;
1447
- case 3:
1448
- _wxInteraction.only_fans_can_comment0 = 0;
1449
- _wxInteraction.only_fans_days_can_comment0 = 1;
1450
- break;
1451
- }
1452
- _wxInteraction.reply_flag0 = replyType;
1453
- _wxInteraction.auto_elect_comment0 = _opt.elect_comment ? userTypeMap[_opt.Comment] : 0;
1454
- _wxInteraction.auto_elect_reply0 = _opt.elect_reply ? userTypeMap[_opt.reply] : 1;
1455
- return _wxInteraction;
1456
- }
1457
- if ("private" === type) _wxInteraction.open_fansmsg0 = 1;
1458
- return _wxInteraction;
1459
- })();
1460
- if (!wxInteractionInfo) return {
1461
- code: 200,
1462
- message: "互动参数设置错误,请检查参数设置!",
1463
- data: ""
1464
- };
1465
1218
  const draftData = {
1466
1219
  lang: "zh_CN",
1467
1220
  f: "json",
@@ -1474,19 +1227,16 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
1474
1227
  is_finder_video0: 0,
1475
1228
  finder_draft_id0: 0,
1476
1229
  applyori0: 0,
1477
- can_reward0: writerid ? 1 : 0,
1230
+ can_reward0: 0,
1478
1231
  pay_gifts_count0: 0,
1479
1232
  is_video_recommend0: -1,
1480
- writerid0: writerid ? writerid : 0,
1233
+ writerid0: 0,
1481
1234
  auto_gen_digest0: 0,
1482
1235
  last_choose_cover_from0: 0,
1483
- need_open_comment0: wxInteractionInfo.need_open_comment0,
1484
- only_fans_can_comment0: wxInteractionInfo.only_fans_can_comment0,
1485
- only_fans_days_can_comment0: wxInteractionInfo.only_fans_days_can_comment0,
1486
- reply_flag0: wxInteractionInfo.reply_flag0,
1487
- auto_elect_comment0: wxInteractionInfo.auto_elect_comment0,
1488
- auto_elect_reply0: wxInteractionInfo.auto_elect_reply0,
1489
- reward_reply_id0: params.settingInfo?.wxRewardText ? reply_id ? reply_id : 0 : 0,
1236
+ need_open_comment0: 0,
1237
+ only_fans_can_comment0: 0,
1238
+ only_fans_days_can_comment0: 0,
1239
+ reply_flag0: 0,
1490
1240
  not_pay_can_comment0: 0,
1491
1241
  data_seq: 0,
1492
1242
  msg_index_id0: "",
@@ -1498,11 +1248,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
1498
1248
  content0: content || "",
1499
1249
  sourceurl0: params?.settingInfo?.wxOriginalText || "",
1500
1250
  cdn_url0: coverRes[0].cdn_url || "",
1501
- copyright_type0: params?.settingInfo?.wxCopyright ? 1 : 0,
1502
- allow_reprint0: params?.settingInfo?.wxCopyright ? 0 : '',
1503
- allow_reprint_modify0: params?.settingInfo?.wxCopyright ? 0 : '',
1504
- ori_white_list0: params?.settingInfo?.wxCopyright ? oriWhitelist : '',
1505
- open_fansmsg0: wxInteractionInfo.open_fansmsg0,
1251
+ open_fansmsg0: params?.settingInfo?.wxFansMsg ? 1 : 0,
1506
1252
  allow_fast_reprint0: params?.settingInfo?.wxQuickReprint ? 1 : 0,
1507
1253
  disable_recommend0: params?.settingInfo?.wxNotAllowRecommend ? 1 : 0,
1508
1254
  claim_source_type0: params?.settingInfo?.wxCreationSource?.[0] || "",
@@ -1853,81 +1599,6 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
1853
1599
  timestamp: Date.now(),
1854
1600
  appmsgid: params.appMsgId
1855
1601
  };
1856
- if (params.settingInfo?.wxRewardTarget) {
1857
- const urlRewardParams = {
1858
- action: "inviteauthor",
1859
- token: params.token,
1860
- lang: "zh_CN"
1861
- };
1862
- const wxRewardPage = await task.createPage({
1863
- show: task.debug,
1864
- url: params.url || `https://mp.weixin.qq.com/cgi-bin/safecenterstatus?${Object.entries(urlRewardParams).map((it)=>it.join("=")).join("&")}`,
1865
- cookies: params.cookies?.map((it)=>({
1866
- ...commonCookies,
1867
- ...it
1868
- })) || []
1869
- });
1870
- const reward_page = wxRewardPage.locator("#app");
1871
- const isAddRewarder = reward_page.locator('.author_card_bd.weui-desktop-vm_primary').filter({
1872
- hasText: params.settingInfo.wxRewardTarget.author
1873
- }).count();
1874
- if (await isAddRewarder == 0) {
1875
- await reward_page.locator('.weui-desktop-panel__hd-right').click();
1876
- try {
1877
- try {
1878
- await wxRewardPage.waitForSelector('.invite-qrcode', {
1879
- state: 'visible',
1880
- timeout: 20000
1881
- });
1882
- const qrcodeSrc = await reward_page.locator(".invite-qrcode").getAttribute('src');
1883
- if (qrcodeSrc) {
1884
- const rewardBuffer = Buffer.from(qrcodeSrc.replace(/^data:image\/\w+;base64,/, ''), 'base64');
1885
- const rewardFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, "weixin_reward.jpg");
1886
- __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].writeFileSync(rewardFilePath, new Uint8Array(rewardBuffer));
1887
- params.safeQrcodeCallback?.(rewardFilePath);
1888
- }
1889
- } catch (error) {
1890
- throw new Error("二维码已过期,请重试绑定。");
1891
- }
1892
- for(let i = 0; i < scanRetryMaxCount; i++){
1893
- await Promise.all([
1894
- wxRewardPage.reload(),
1895
- wxRewardPage.waitForLoadState('domcontentloaded')
1896
- ]);
1897
- try {
1898
- await wxRewardPage.waitForSelector(`.author_card_bd.weui-desktop-vm_primary:has-text("${params.settingInfo.wxRewardTarget?.author}")`, {
1899
- timeout: 1000
1900
- });
1901
- break;
1902
- } catch (error) {}
1903
- if (i === scanRetryMaxCount - 1) throw new Error("未确认绑定账户,请在手机端确认绑定并重试");
1904
- }
1905
- } catch (error) {
1906
- let errorMessage = "发生未知错误";
1907
- if (error instanceof Error) errorMessage = error.message;
1908
- else if ("string" == typeof error) errorMessage = error;
1909
- await wxRewardPage.close();
1910
- return {
1911
- code: 200,
1912
- message: errorMessage,
1913
- data: ""
1914
- };
1915
- }
1916
- }
1917
- if (params.settingInfo.wxRewardText) {
1918
- await wxRewardPage.locator('[href="/merchant/reward?action=getautoreply"]').click();
1919
- await wxRewardPage.waitForLoadState('networkidle');
1920
- const isAddWord = reward_page.locator(".auto-reply__list.edit .auto-reply__hd .auto-reply__text").filter({
1921
- hasText: new RegExp(`^${params.settingInfo.wxRewardText}$`)
1922
- }).count();
1923
- if (await isAddWord == 0) {
1924
- await reward_page.locator(".emotion_editor .edit_area").fill(params.settingInfo.wxRewardText);
1925
- await reward_page.locator(".emotion_editor .edit_area").click();
1926
- await reward_page.locator(".editor_toolbar .weui-desktop-btn.weui-desktop-btn_primary").click();
1927
- }
1928
- }
1929
- await wxRewardPage.close();
1930
- }
1931
1602
  const page = await task.createPage({
1932
1603
  show: task.debug,
1933
1604
  url: params.url || `https://mp.weixin.qq.com/cgi-bin/appmsg?${Object.entries(urlParams).map((it)=>it.join("=")).join("&")}`,
@@ -1950,10 +1621,6 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
1950
1621
  await page.waitForSelector("#editor_pannel", {
1951
1622
  state: "visible"
1952
1623
  });
1953
- PopupListener(page, '[v-transfer-dom="#vue_app"] .weui-desktop-dialog', "更新", '[v-transfer-dom="#vue_app"] .weui-desktop-icon-btn.weui-desktop-dialog__close-btn', {
1954
- checkInterval: 1000,
1955
- stopAfterClick: false
1956
- });
1957
1624
  const titleInstance = page.locator("#js_title_main textarea#title");
1958
1625
  await titleInstance.click();
1959
1626
  await titleInstance.fill(params.title);
@@ -1995,15 +1662,7 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
1995
1662
  await page.waitForSelector(".weui-desktop-img-picker__list .weui-desktop-img-picker__item.selected", {
1996
1663
  state: "visible"
1997
1664
  });
1998
- await page.waitForSelector('.weui-desktop-upload__file__progress', {
1999
- state: 'detached'
2000
- });
2001
- const pic_msg = page.locator('.weui-desktop-img-picker__list .weui-desktop-img-picker__item.selected .weui-desktop-upload__file__msg');
2002
- if (await pic_msg.count() > 0) return {
2003
- code: 200,
2004
- message: "图片上传错误:" + (await pic_msg.textContent() || "未知错误,请重试!"),
2005
- data: ""
2006
- };
1665
+ await page.waitForTimeout(1000);
2007
1666
  await dialog.locator(".weui-desktop-dialog__ft .weui-desktop-btn:not(.weui-desktop-btn_disabled)").filter({
2008
1667
  hasText: "下一步"
2009
1668
  }).click();
@@ -2016,124 +1675,6 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
2016
1675
  hasText: "确认"
2017
1676
  }).click();
2018
1677
  }
2019
- if (params.settingInfo.wxCopyright) {
2020
- await page.locator('#js_original').click();
2021
- const ori_dialog = page.locator('.claim__original-dialog.original_dialog');
2022
- const ori_dialog_bd = ori_dialog.locator('.weui-desktop-dialog__bd');
2023
- const ori_dialog_ft = ori_dialog.locator('.weui-desktop-dialog__ft');
2024
- await ori_dialog_bd.locator('.weui-desktop-form__check-content').filter({
2025
- hasText: "文字原创"
2026
- }).click();
2027
- if (params.settingInfo?.wxWhitelist) for (var _target of params.settingInfo.wxWhitelist){
2028
- await ori_dialog_bd.locator('#js_article_whitelist_search').fill(_target);
2029
- await ori_dialog_bd.locator('.js_search').click();
2030
- const search_res = ori_dialog_bd.locator('#js_article_whitelist_search_result > div');
2031
- await page.waitForTimeout(1000);
2032
- if (await search_res.getAttribute('class') === 'search-result-title search-result-empty') return {
2033
- code: 200,
2034
- message: `白名单用户:${_target} 未搜索到,请确定输入是否正确!`,
2035
- data: ''
2036
- };
2037
- {
2038
- const search_res_name = await search_res.locator('.search-result-name-left').textContent() || void 0;
2039
- await search_res.click();
2040
- const whrite_list = ori_dialog_bd.locator('#js_article_whitelist_added tbody');
2041
- const white_td_isadd = await whrite_list.locator('.table-td-name').filter({
2042
- hasText: search_res_name
2043
- }).count();
2044
- if (!white_td_isadd) return {
2045
- code: 200,
2046
- message: '白名单添加失败,请重试!',
2047
- data: ''
2048
- };
2049
- }
2050
- }
2051
- if (params.settingInfo?.wxQuickReprint) {
2052
- const btn_isChecked = await ori_dialog_bd.locator('//span[@class="frm_tips"]').filter({
2053
- hasText: '已开启'
2054
- }).count() == 1;
2055
- if (!btn_isChecked) await ori_dialog_bd.locator('.weui-desktop-switch_loading .weui-desktop-switch__box').click();
2056
- }
2057
- const checkbox = ori_dialog_ft.locator('.weui-desktop-icon-checkbox');
2058
- if (!await checkbox.isChecked()) await checkbox.check();
2059
- await ori_dialog_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
2060
- if (params.settingInfo?.wxRewardTarget) {
2061
- await page.locator('#js_reward_setting_area').click();
2062
- const reward_setting = page.locator('.reward-setting-dialog');
2063
- const reward_setting_bd = reward_setting.locator('.weui-desktop-dialog__bd');
2064
- const reward_setting_ft = reward_setting.locator('.weui-desktop-dialog__ft');
2065
- for(var _type in params.settingInfo.wxRewardTarget)if ("author" === _type) {
2066
- let userName = params.settingInfo.wxRewardTarget[_type];
2067
- await reward_setting_bd.locator('.weui-desktop-form__check-label', {
2068
- hasText: '赞赏作者'
2069
- }).click();
2070
- await reward_setting_bd.locator('.weui-desktop-form__input').fill(userName);
2071
- if (params.settingInfo.wxRewardText) {
2072
- const reward_setting_replay = page.locator('.reward-reply-setting');
2073
- const switchAuto = reward_setting_replay.locator('.weui-desktop-switch__box');
2074
- const maxAttempts = 5;
2075
- const delayMs = 500;
2076
- let nowCheckTime = 0;
2077
- for(let attempt = 0; attempt < maxAttempts; attempt++){
2078
- const isDisabled = await switchAuto.isDisabled();
2079
- if (!isDisabled) {
2080
- await switchAuto.isChecked() && nowCheckTime++;
2081
- if (2 == nowCheckTime) break;
2082
- }
2083
- if (attempt === maxAttempts - 1) throw new Error('Checkbox did not become enabled within the timeout.');
2084
- await new Promise((resolve)=>setTimeout(resolve, delayMs));
2085
- }
2086
- const isOneReplay = await reward_setting_replay.locator('.reward-reply-select__wrp >.reward-reply-select__tips').textContent() == "添加新的回复";
2087
- const isCurrentReplay = await reward_setting_replay.locator('.reward-reply-select__wrp >.reward-reply-select__display .wording').filter({
2088
- hasText: new RegExp(`^${[
2089
- params.settingInfo.wxRewardText
2090
- ]}$`)
2091
- }).count() == 1;
2092
- if (!isOneReplay && !isCurrentReplay) {
2093
- await reward_setting_replay.locator('.reward-reply-select__wrp >.reward-reply-select__tips').click();
2094
- await reward_setting_replay.locator('.reward-reply-select__display.can-select .wording').filter({
2095
- hasText: new RegExp(`^${[
2096
- params.settingInfo.wxRewardText
2097
- ]}$`)
2098
- }).click();
2099
- }
2100
- } else await reward_setting_bd.locator('.reward-reply-setting .weui-desktop-switch__input').isChecked() && reward_setting_bd.locator('.reward-reply-setting .weui-desktop-switch__box').uncheck();
2101
- }
2102
- const checkbox = reward_setting_ft.locator('.weui-desktop-icon-checkbox');
2103
- if (!await checkbox.isChecked()) await checkbox.check();
2104
- await reward_setting_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
2105
- }
2106
- }
2107
- if (params.settingInfo?.wxInteraction) {
2108
- await page.locator('.appmsg-editor__setting-group.js_interaction_cell').click();
2109
- const wxInteraction_setting = page.locator('.interaction-dialog');
2110
- const wxInteraction_bd = wxInteraction_setting.locator('.weui-desktop-dialog__bd');
2111
- const wxInteraction_ft = wxInteraction_setting.locator('.weui-desktop-dialog__ft');
2112
- if ("public" == params.settingInfo.wxInteraction.Type) {
2113
- await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
2114
- hasText: '留言'
2115
- }).click();
2116
- const comment_area = wxInteraction_bd.locator('.comment-options-block.pt0');
2117
- const reply_area = wxInteraction_bd.locator('.comment-options-block.bb0.pb0');
2118
- const commont_rply_opt = page.locator('.weui-desktop-popper.options-popover[x-placement="bottom"]');
2119
- await comment_area.locator('.comment-options__selector-btn').click();
2120
- await commont_rply_opt.locator('.weui-desktop-form__check-label', {
2121
- hasText: params.settingInfo.wxInteraction.Option?.Comment
2122
- }).click();
2123
- if (params.settingInfo.wxInteraction.Option?.elect_comment) await comment_area.locator('.weui-desktop-switch__box').check();
2124
- else await comment_area.locator('.weui-desktop-switch__input').isChecked() && comment_area.locator('.weui-desktop-switch__box').uncheck();
2125
- await page.waitForTimeout(1000);
2126
- await reply_area.locator('.comment-options__selector-btn').click();
2127
- await commont_rply_opt.locator('.weui-desktop-form__check-label', {
2128
- hasText: params.settingInfo.wxInteraction.Option?.reply
2129
- }).click();
2130
- if (params.settingInfo.wxInteraction.Option?.elect_reply) await reply_area.locator('.weui-desktop-switch__box').check();
2131
- else await reply_area.locator('.weui-desktop-switch__input').isChecked() && reply_area.locator('.weui-desktop-switch__box').uncheck();
2132
- } else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
2133
- hasText: '快捷私信'
2134
- }).click();
2135
- await wxInteraction_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
2136
- }
2137
1678
  if (params.settingInfo.wxOriginalText) {
2138
1679
  await page.locator("#js_article_url_area .allow_click_opr").click();
2139
1680
  await page.waitForTimeout(200);
@@ -2868,7 +2409,9 @@ const xiaohongshuPublish = async (task, params)=>{
2868
2409
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
2869
2410
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
2870
2411
  };
2871
- var package_namespaceObject = JSON.parse('{"i8":"1.2.5-beta.2"}');
2412
+ var package_namespaceObject = {
2413
+ i8: "1.2.4"
2414
+ };
2872
2415
  class Action {
2873
2416
  constructor(task){
2874
2417
  this.task = task;