@blade-hq/agent-react 2612.0.0-beta.56 → 2612.0.0-beta.57
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/README.md +2 -2
- package/dist/{chunk-BQ6CUOP7.js → chunk-ARX4JV5T.js} +235 -151
- package/dist/chunk-ARX4JV5T.js.map +1 -0
- package/dist/{chunk-IQMQB6Y6.js → chunk-ILB77TUM.js} +2 -2
- package/dist/components/ConnectorAuthorizationProgress.d.ts +6 -0
- package/dist/components/FeishuPermissionStatus.d.ts +5 -0
- package/dist/connectors.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal.js +2 -2
- package/dist/rich-input.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-BQ6CUOP7.js.map +0 -1
- /package/dist/{chunk-IQMQB6Y6.js.map → chunk-ILB77TUM.js.map} +0 -0
|
@@ -1258,10 +1258,10 @@ function FeishuCapabilitySelection({ capabilities, permissions = [], domains = [
|
|
|
1258
1258
|
groups.set(key, [...groups.get(key) ?? [], item]);
|
|
1259
1259
|
}
|
|
1260
1260
|
return /* @__PURE__ */ jsxs3("div", { className: "space-y-4", children: [
|
|
1261
|
-
/* @__PURE__ */ jsx3("p", { className: "text-sm", children: "
|
|
1262
|
-
/* @__PURE__ */ jsx3("p", { className: "text-xs opacity-70", children: "\
|
|
1261
|
+
/* @__PURE__ */ jsx3("p", { className: "text-sm", children: "\u521D\u6B21\u8FDE\u63A5\u91C7\u7528\u98DE\u4E66\u5E73\u53F0\u9ED8\u8BA4\u6A21\u677F\u53CA\u5B98\u65B9\u63A8\u8350\u6743\u9650\u3002\u5728\u98DE\u4E66\u9875\u9762\u786E\u8BA4\uFF0C\u514D\u5BA1\u548C\u5BA1\u6838\u8981\u6C42\u4EE5\u6240\u5728\u4F01\u4E1A\u89C4\u5219\u4E3A\u51C6\u3002" }),
|
|
1262
|
+
/* @__PURE__ */ jsx3("p", { className: "text-xs opacity-70", children: "\u9996\u6B21\u53EF\u80FD\u9700\u8981\u4E24\u6B21\u626B\u7801\uFF1A\u5148\u5173\u8054\u5E94\u7528\uFF0C\u518D\u786E\u8BA4\u672C\u4EBA\u6388\u6743\u3002\u90E8\u5206\u6743\u9650\u672A\u5F00\u901A\u65F6\uFF0C\u5DF2\u5F00\u901A\u6743\u9650\u4ECD\u53EF\u4F7F\u7528\u3002" }),
|
|
1263
1263
|
/* @__PURE__ */ jsxs3("details", { className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
|
|
1264
|
-
/* @__PURE__ */ jsx3("summary", { className: "cursor-pointer", children: "\u67E5\u770B\
|
|
1264
|
+
/* @__PURE__ */ jsx3("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u5F53\u524D\u53EF\u7528\u7684\u5DE5\u4F5C\u80FD\u529B" }),
|
|
1265
1265
|
/* @__PURE__ */ jsx3("div", { className: "mt-3 grid gap-3 sm:grid-cols-2", children: [...groups].map(([id, items]) => /* @__PURE__ */ jsxs3("section", { className: "space-y-2", children: [
|
|
1266
1266
|
/* @__PURE__ */ jsx3("h4", { className: "font-medium", children: domains.find((domain) => domain.id === id)?.name || items[0]?.category_name || "\u5176\u4ED6\u5DE5\u4F5C\u80FD\u529B" }),
|
|
1267
1267
|
items.map((item) => /* @__PURE__ */ jsxs3("details", { className: "text-xs", children: [
|
|
@@ -1282,8 +1282,64 @@ function FeishuCapabilitySelection({ capabilities, permissions = [], domains = [
|
|
|
1282
1282
|
] });
|
|
1283
1283
|
}
|
|
1284
1284
|
|
|
1285
|
-
// src/components/
|
|
1285
|
+
// src/components/ConnectorAuthorizationProgress.tsx
|
|
1286
1286
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1287
|
+
function ConnectorAuthorizationProgress({ result, onCheck, busy }) {
|
|
1288
|
+
if (!result || result.status === "complete" || result.status === "waiting") return null;
|
|
1289
|
+
let manualURL;
|
|
1290
|
+
try {
|
|
1291
|
+
const url = new URL(result.manual_url || "");
|
|
1292
|
+
if (url.protocol === "https:" && url.hostname === "open.feishu.cn" && !url.username && !url.password && !url.port && /^\/app(?:\/[^/]+\/auth)?$/.test(url.pathname)) manualURL = url.href;
|
|
1293
|
+
} catch {
|
|
1294
|
+
}
|
|
1295
|
+
return /* @__PURE__ */ jsxs4("output", { className: "block space-y-2 rounded-lg border p-4 text-sm", children: [
|
|
1296
|
+
/* @__PURE__ */ jsx4("span", { className: "block", children: result.status === "partial" ? "\u90E8\u5206\u6743\u9650\u5DF2\u751F\u6548\uFF0C\u672C\u6B21\u64CD\u4F5C\u6240\u9700\u6743\u9650\u5C1A\u672A\u8865\u9F50" : "\u672C\u6B21\u64CD\u4F5C\u6240\u9700\u6743\u9650\u5C1A\u672A\u751F\u6548" }),
|
|
1297
|
+
/* @__PURE__ */ jsx4("span", { className: "block", children: result.next_action }),
|
|
1298
|
+
result.missing_permissions.map((item) => /* @__PURE__ */ jsxs4("span", { className: "block break-all text-xs", children: [
|
|
1299
|
+
item.identity === "bot" ? "\u5E94\u7528\u8EAB\u4EFD" : "\u672C\u4EBA\u8EAB\u4EFD",
|
|
1300
|
+
" \xB7 ",
|
|
1301
|
+
item.scope
|
|
1302
|
+
] }, `${item.identity}:${item.scope}`)),
|
|
1303
|
+
result.mode === "manual" && manualURL && /* @__PURE__ */ jsx4("a", { className: "block underline", href: manualURL, target: "_blank", rel: "noopener noreferrer", children: "\u6253\u5F00\u98DE\u4E66\u6743\u9650\u7BA1\u7406" }),
|
|
1304
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "underline disabled:opacity-50", disabled: busy, onClick: onCheck, children: "\u6211\u5DF2\u5904\u7406\uFF0C\u91CD\u65B0\u6838\u9A8C" })
|
|
1305
|
+
] });
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
// src/components/FeishuPermissionStatus.tsx
|
|
1309
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1310
|
+
function FeishuPermissionStatus({ permissions, template }) {
|
|
1311
|
+
if (!template && !permissions.some((item) => item.app_status)) return null;
|
|
1312
|
+
const listed = template ? permissions.filter((item) => item.template) : permissions;
|
|
1313
|
+
const missingApp = listed.filter((item) => item.app_status === "missing");
|
|
1314
|
+
const missingUser = listed.filter((item) => item.identity === "user" && item.app_status === "granted" && item.user_status === "not_granted");
|
|
1315
|
+
const unknown = listed.filter((item) => !item.app_status || item.app_status === "unknown");
|
|
1316
|
+
return /* @__PURE__ */ jsxs5("details", { className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
|
|
1317
|
+
/* @__PURE__ */ jsxs5("summary", { className: "cursor-pointer", children: [
|
|
1318
|
+
template ? "\u98DE\u4E66\u5B98\u65B9\u63A8\u8350\u6743\u9650" : "\u98DE\u4E66\u6743\u9650\u72B6\u6001",
|
|
1319
|
+
" \xB7 ",
|
|
1320
|
+
missingApp.length,
|
|
1321
|
+
" \u9879\u5E94\u7528\u672A\u5F00\u901A \xB7 ",
|
|
1322
|
+
missingUser.length,
|
|
1323
|
+
" \u9879\u5F85\u672C\u4EBA\u6388\u6743",
|
|
1324
|
+
unknown.length ? ` \xB7 ${unknown.length} \u9879\u5F85\u6838\u9A8C` : ""
|
|
1325
|
+
] }),
|
|
1326
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-3 text-xs opacity-70", children: "\u4F01\u4E1A\u51B3\u5B9A\u54EA\u4E9B\u6743\u9650\u514D\u5BA1\u3001\u54EA\u4E9B\u9700\u8981\u5BA1\u6279\u3002\u5E94\u7528\u5DF2\u5F00\u901A\u548C\u672C\u4EBA\u5DF2\u6388\u6743\u5206\u522B\u6838\u9A8C\uFF1B\u5F85\u6838\u9A8C\u4E0D\u4EE3\u8868\u4F01\u4E1A\u62D2\u7EDD\u3002\u672A\u5F00\u901A\u9879\u76EE\u4E0D\u5F71\u54CD\u5176\u4ED6\u5DF2\u83B7\u6388\u6743\u7684\u64CD\u4F5C\u3002" }),
|
|
1327
|
+
/* @__PURE__ */ jsx5("div", { className: "mt-3 max-h-72 space-y-3 overflow-y-auto", children: listed.map((item) => /* @__PURE__ */ jsxs5("div", { className: "text-xs", children: [
|
|
1328
|
+
/* @__PURE__ */ jsxs5("p", { children: [
|
|
1329
|
+
item.category_name ? `${item.category_name} \xB7 ` : "",
|
|
1330
|
+
item.name
|
|
1331
|
+
] }),
|
|
1332
|
+
item.name !== item.scope && /* @__PURE__ */ jsx5("p", { className: "break-all opacity-70", children: item.scope }),
|
|
1333
|
+
/* @__PURE__ */ jsxs5("p", { children: [
|
|
1334
|
+
item.app_status === "granted" ? "\u5E94\u7528\u5DF2\u5F00\u901A" : item.app_status === "missing" ? "\u5E94\u7528\u672A\u5F00\u901A\uFF0C\u8BF7\u5728\u98DE\u4E66\u786E\u8BA4\u4F01\u4E1A\u5BA1\u6279\u6216\u53D1\u5E03\u8981\u6C42" : "\u5E94\u7528\u5F00\u901A\u60C5\u51B5\u5F85\u6838\u9A8C",
|
|
1335
|
+
item.identity === "user" ? item.user_status === "granted" ? "\uFF1B\u672C\u4EBA\u5DF2\u6388\u6743" : "\uFF1B\u672C\u4EBA\u5C1A\u672A\u6388\u6743" : ""
|
|
1336
|
+
] })
|
|
1337
|
+
] }, `${item.identity}:${item.scope}`)) })
|
|
1338
|
+
] });
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
// src/components/ConnectorRuntimeDiagnostics.tsx
|
|
1342
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1287
1343
|
var channelLabels = {
|
|
1288
1344
|
"channel.connecting": "\u5F00\u59CB\u8FDE\u63A5\u98DE\u4E66",
|
|
1289
1345
|
"channel.connected": "\u98DE\u4E66\u8FDE\u63A5\u5DF2\u5EFA\u7ACB",
|
|
@@ -1309,92 +1365,92 @@ var time = (value) => value > 0 ? new Date(value).toLocaleString() : "\u6682\u65
|
|
|
1309
1365
|
var channelLabel = (value) => channelLabels[value] ?? (value ? "\u5C1A\u672A\u8BC6\u522B\u7684\u901A\u9053\u8BB0\u5F55" : "\u5C1A\u65E0\u901A\u9053\u8BB0\u5F55");
|
|
1310
1366
|
var deliveryLabel = (value) => deliveryLabels[value] ?? "\u5C1A\u672A\u8BC6\u522B\u7684\u6295\u9012\u72B6\u6001";
|
|
1311
1367
|
function ConnectorRuntimeDiagnostics({ runtime }) {
|
|
1312
|
-
return /* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1368
|
+
return /* @__PURE__ */ jsxs6("section", { "aria-label": "\u6D88\u606F\u63A5\u6536\u4E0E\u6295\u9012\u8BB0\u5F55", className: "space-y-3 rounded-lg border p-3 text-xs", children: [
|
|
1369
|
+
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: "\u6D88\u606F\u63A5\u6536\u4E0E\u6295\u9012\u8BB0\u5F55" }),
|
|
1370
|
+
/* @__PURE__ */ jsxs6("p", { children: [
|
|
1315
1371
|
"\u901A\u9053\u6700\u8FD1\u8BB0\u5F55\uFF1A",
|
|
1316
1372
|
channelLabel(runtime.channel_state)
|
|
1317
1373
|
] }),
|
|
1318
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ jsxs6("p", { children: [
|
|
1319
1375
|
"\u6700\u8FD1\u6536\u5230\u4E8B\u4EF6\uFF1A",
|
|
1320
1376
|
time(runtime.last_event_at_ms)
|
|
1321
1377
|
] }),
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1378
|
+
/* @__PURE__ */ jsx6("p", { children: "\u4EE5\u4E0B\u662F SuperWork \u4FDD\u5B58\u7684\u8BB0\u5F55\uFF1B\u6CA1\u6709\u6295\u9012\u8BB0\u5F55\u65F6\uFF0C\u5C1A\u4E0D\u80FD\u786E\u8BA4\u6D88\u606F\u5DF2\u9001\u8FBE\u52A9\u624B\u3002" }),
|
|
1379
|
+
/* @__PURE__ */ jsxs6("details", { children: [
|
|
1380
|
+
/* @__PURE__ */ jsxs6("summary", { className: "cursor-pointer", children: [
|
|
1325
1381
|
"\u63A5\u6536\u901A\u9053\u8BB0\u5F55\uFF08",
|
|
1326
1382
|
runtime.channel_events.length,
|
|
1327
1383
|
"\uFF09"
|
|
1328
1384
|
] }),
|
|
1329
|
-
runtime.channel_events.length ? /* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */
|
|
1385
|
+
runtime.channel_events.length ? /* @__PURE__ */ jsx6("ol", { className: "space-y-2 pt-2", children: runtime.channel_events.map((event) => /* @__PURE__ */ jsxs6("li", { className: "space-y-1", children: [
|
|
1386
|
+
/* @__PURE__ */ jsxs6("p", { children: [
|
|
1331
1387
|
channelLabel(event.type),
|
|
1332
1388
|
" \xB7 ",
|
|
1333
1389
|
time(event.at_ms)
|
|
1334
1390
|
] }),
|
|
1335
|
-
/* @__PURE__ */
|
|
1391
|
+
/* @__PURE__ */ jsxs6("p", { className: "break-all", children: [
|
|
1336
1392
|
"\u6392\u67E5\u7F16\u53F7\uFF1A",
|
|
1337
1393
|
event.trace_id
|
|
1338
1394
|
] })
|
|
1339
|
-
] }, event.trace_id)) }) : /* @__PURE__ */
|
|
1395
|
+
] }, event.trace_id)) }) : /* @__PURE__ */ jsx6("p", { children: "\u6682\u65E0\u63A5\u6536\u901A\u9053\u8BB0\u5F55\u3002" })
|
|
1340
1396
|
] }),
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
/* @__PURE__ */
|
|
1397
|
+
/* @__PURE__ */ jsxs6("details", { children: [
|
|
1398
|
+
/* @__PURE__ */ jsxs6("summary", { className: "cursor-pointer", children: [
|
|
1343
1399
|
"\u6D88\u606F\u6295\u9012\u8BB0\u5F55\uFF08",
|
|
1344
1400
|
runtime.deliveries.length,
|
|
1345
1401
|
"\uFF09"
|
|
1346
1402
|
] }),
|
|
1347
|
-
runtime.deliveries.length ? /* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1403
|
+
runtime.deliveries.length ? /* @__PURE__ */ jsx6("ol", { className: "space-y-2 pt-2", children: runtime.deliveries.map((delivery) => /* @__PURE__ */ jsxs6("li", { className: "space-y-1", children: [
|
|
1404
|
+
/* @__PURE__ */ jsxs6("p", { children: [
|
|
1349
1405
|
deliveryLabel(delivery.status),
|
|
1350
1406
|
" \xB7 \u5DF2\u5C1D\u8BD5 ",
|
|
1351
1407
|
delivery.attempt,
|
|
1352
1408
|
" \u6B21"
|
|
1353
1409
|
] }),
|
|
1354
|
-
/* @__PURE__ */
|
|
1410
|
+
/* @__PURE__ */ jsxs6("p", { className: "break-all", children: [
|
|
1355
1411
|
"\u6295\u9012\u7F16\u53F7\uFF1A",
|
|
1356
1412
|
delivery.delivery_id
|
|
1357
1413
|
] }),
|
|
1358
|
-
/* @__PURE__ */
|
|
1414
|
+
/* @__PURE__ */ jsxs6("p", { children: [
|
|
1359
1415
|
"\u521B\u5EFA\u65F6\u95F4\uFF1A",
|
|
1360
1416
|
time(delivery.created_at_ms)
|
|
1361
1417
|
] }),
|
|
1362
|
-
["ready", "retry_wait", "waiting_condition"].includes(delivery.status) && delivery.next_at_ms > 0 && /* @__PURE__ */
|
|
1418
|
+
["ready", "retry_wait", "waiting_condition"].includes(delivery.status) && delivery.next_at_ms > 0 && /* @__PURE__ */ jsxs6("p", { children: [
|
|
1363
1419
|
"\u4E0B\u6B21\u5904\u7406\u65F6\u95F4\uFF1A",
|
|
1364
1420
|
time(delivery.next_at_ms)
|
|
1365
1421
|
] })
|
|
1366
|
-
] }, delivery.delivery_id)) }) : /* @__PURE__ */
|
|
1422
|
+
] }, delivery.delivery_id)) }) : /* @__PURE__ */ jsx6("p", { children: "\u6682\u65E0\u6D88\u606F\u6295\u9012\u8BB0\u5F55\u3002" })
|
|
1367
1423
|
] }),
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1424
|
+
/* @__PURE__ */ jsxs6("details", { children: [
|
|
1425
|
+
/* @__PURE__ */ jsxs6("summary", { className: "cursor-pointer", children: [
|
|
1370
1426
|
"\u9010\u6B21\u6295\u9012\u5C1D\u8BD5\uFF08",
|
|
1371
1427
|
runtime.delivery_attempts.length,
|
|
1372
1428
|
"\uFF09"
|
|
1373
1429
|
] }),
|
|
1374
|
-
runtime.delivery_attempts.length ? /* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1430
|
+
runtime.delivery_attempts.length ? /* @__PURE__ */ jsx6("ol", { className: "space-y-2 pt-2", children: runtime.delivery_attempts.map((attempt) => /* @__PURE__ */ jsxs6("li", { className: "space-y-1", children: [
|
|
1431
|
+
/* @__PURE__ */ jsxs6("p", { children: [
|
|
1376
1432
|
"\u7B2C ",
|
|
1377
1433
|
attempt.attempt,
|
|
1378
1434
|
" \u6B21 \xB7 ",
|
|
1379
1435
|
deliveryLabel(attempt.status)
|
|
1380
1436
|
] }),
|
|
1381
|
-
/* @__PURE__ */
|
|
1437
|
+
/* @__PURE__ */ jsxs6("p", { className: "break-all", children: [
|
|
1382
1438
|
"\u6295\u9012\u7F16\u53F7\uFF1A",
|
|
1383
1439
|
attempt.delivery_id
|
|
1384
1440
|
] }),
|
|
1385
|
-
/* @__PURE__ */
|
|
1441
|
+
/* @__PURE__ */ jsxs6("p", { children: [
|
|
1386
1442
|
"\u5F00\u59CB\uFF1A",
|
|
1387
1443
|
time(attempt.started_at_ms),
|
|
1388
1444
|
"\uFF1B\u7ED3\u675F\uFF1A",
|
|
1389
1445
|
time(attempt.finished_at_ms)
|
|
1390
1446
|
] })
|
|
1391
|
-
] }, attempt.id)) }) : /* @__PURE__ */
|
|
1447
|
+
] }, attempt.id)) }) : /* @__PURE__ */ jsx6("p", { children: "\u6682\u65E0\u6295\u9012\u5C1D\u8BD5\u8BB0\u5F55\u3002" })
|
|
1392
1448
|
] })
|
|
1393
1449
|
] });
|
|
1394
1450
|
}
|
|
1395
1451
|
|
|
1396
1452
|
// src/components/DeviceConnection.tsx
|
|
1397
|
-
import { Fragment, jsx as
|
|
1453
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1398
1454
|
var statusLabels = {
|
|
1399
1455
|
available: "\u53EF\u7528",
|
|
1400
1456
|
not_selected: "\u672A\u9009\u62E9",
|
|
@@ -1471,6 +1527,10 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
|
|
|
1471
1527
|
if (!activationKnown) newConnection.current = !value.app_id;
|
|
1472
1528
|
linking.current = value.phase === "app";
|
|
1473
1529
|
if (["app", "user", "permissions"].includes(value.phase) && value.authorization_url || value.current_step?.state === "verifying" && value.current_step.action === "poll") flow.current = { enable: newConnection.current || value.enabled !== false, capabilities: value.selected_capabilities ?? [], focus: value.selected_capabilities ?? [] };
|
|
1530
|
+
if (!flow.current && matchesRequestedAuthorization(value) && value.app_id && value.authorization_result && value.authorization_result.status !== "complete" && value.authorization_result.capabilities.length) {
|
|
1531
|
+
const focus = value.authorization_result.capabilities;
|
|
1532
|
+
flow.current = { enable: newConnection.current || value.enabled !== false, capabilities: [.../* @__PURE__ */ new Set([...value.selected_capabilities ?? [], ...focus])], focus };
|
|
1533
|
+
}
|
|
1474
1534
|
if (!value.app_id) setPage("select");
|
|
1475
1535
|
}
|
|
1476
1536
|
}
|
|
@@ -1485,8 +1545,10 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
|
|
|
1485
1545
|
live.current = false;
|
|
1486
1546
|
};
|
|
1487
1547
|
}, []);
|
|
1548
|
+
const matchesRequestedAuthorization = (value) => !authorizationCapabilities?.length || !!value.authorization_result && [...value.authorization_result.capabilities].sort().join(" ") === [...authorizationCapabilities].sort().join(" ");
|
|
1549
|
+
const canCompleteInitial = (value) => value.activation_pending === true && !authorizationCapabilities?.length && !!value.app_id && !value.error && (value.capabilities ?? []).some((item) => (value.selected_capabilities ?? []).includes(item.id) && item.status === "available");
|
|
1488
1550
|
const canReceive = (value) => (value.capabilities ?? []).some((item) => (value.selected_capabilities ?? selected).includes(item.id) && item.id.startsWith("bot_receive_") && (item.status === "available" || item.status === "unknown" && item.evidence === "platform_scope_query"));
|
|
1489
|
-
const isWaiting = (value) => ["app", "user", "permissions"].includes(value.phase) && Boolean(value.authorization_url) || value.current_step?.state === "verifying" && value.current_step.action === "poll";
|
|
1551
|
+
const isWaiting = (value) => matchesRequestedAuthorization(value) && (["app", "user", "permissions"].includes(value.phase) && Boolean(value.authorization_url) || value.current_step?.state === "verifying" && value.current_step.action === "poll");
|
|
1490
1552
|
async function changed() {
|
|
1491
1553
|
try {
|
|
1492
1554
|
await callbacks.current.onChanged();
|
|
@@ -1514,8 +1576,18 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
|
|
|
1514
1576
|
setSelected(defaultCapabilities(value.capabilities ?? []));
|
|
1515
1577
|
setPage("select");
|
|
1516
1578
|
}
|
|
1517
|
-
if (!value.error && ((action === "authorize" || action === "poll") && !isWaiting(value) || action === "finish") && value.app_id && flow.current) {
|
|
1579
|
+
if (!value.error && ((action === "authorize" || action === "poll" || action === "check" && (value.authorization_result?.status === "complete" || canCompleteInitial(value))) && !isWaiting(value) || action === "finish") && value.app_id && flow.current) {
|
|
1518
1580
|
const target = flow.current;
|
|
1581
|
+
if (!matchesRequestedAuthorization(value)) {
|
|
1582
|
+
setError("\u65E0\u6CD5\u6838\u5B9E\u5F53\u524D\u6388\u6743\u5BF9\u5E94\u7684\u6743\u9650\uFF0C\u6682\u4E0D\u5C55\u793A\u4E8C\u7EF4\u7801\u3002\u8BF7\u91CD\u65B0\u68C0\u67E5\u672C\u6B21\u64CD\u4F5C\u3002");
|
|
1583
|
+
await changed();
|
|
1584
|
+
return;
|
|
1585
|
+
}
|
|
1586
|
+
if (action !== "finish" && value.authorization_result && value.authorization_result.status !== "complete" && !canCompleteInitial(value)) {
|
|
1587
|
+
setPage("connection");
|
|
1588
|
+
await changed();
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1519
1591
|
if (action !== "finish") value = await callbacks.current.act("finish", { capabilities: target.capabilities, enable: target.enable });
|
|
1520
1592
|
if (!live.current) return;
|
|
1521
1593
|
accept(value);
|
|
@@ -1576,8 +1648,17 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
|
|
|
1576
1648
|
useEffect(() => {
|
|
1577
1649
|
if (!authorizationCapabilities?.length && !autoAuthorize || !view || automaticStarted.current) return;
|
|
1578
1650
|
automaticStarted.current = true;
|
|
1579
|
-
if (!isWaiting(view)) start(authorizationCapabilities);
|
|
1651
|
+
if (!isWaiting(view) && !(matchesRequestedAuthorization(view) && view.authorization_result?.mode === "manual")) start(authorizationCapabilities);
|
|
1580
1652
|
}, [view, authorizationCapabilities, autoAuthorize]);
|
|
1653
|
+
const initialCompletionStarted = useRef(false);
|
|
1654
|
+
useEffect(() => {
|
|
1655
|
+
if (!view || !view.authorization_result || isWaiting(view) || busy || error || initialCompletionStarted.current || !canCompleteInitial(view)) return;
|
|
1656
|
+
initialCompletionStarted.current = true;
|
|
1657
|
+
automaticStarted.current = true;
|
|
1658
|
+
const capabilities2 = view.selected_capabilities ?? [];
|
|
1659
|
+
flow.current = { enable: true, capabilities: capabilities2, focus: capabilities2 };
|
|
1660
|
+
void run("finish", { capabilities: capabilities2, enable: true });
|
|
1661
|
+
}, [view, busy, error, authorizationCapabilities]);
|
|
1581
1662
|
async function addCapabilities() {
|
|
1582
1663
|
start();
|
|
1583
1664
|
}
|
|
@@ -1673,87 +1754,90 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
|
|
|
1673
1754
|
void run("finish", { capabilities: target.capabilities, enable: target.enable });
|
|
1674
1755
|
};
|
|
1675
1756
|
const preserveDisabled = Boolean(view?.app_id && view.enabled === false && !newConnection.current);
|
|
1676
|
-
const back = /* @__PURE__ */
|
|
1677
|
-
return /* @__PURE__ */
|
|
1678
|
-
/* @__PURE__ */
|
|
1679
|
-
/* @__PURE__ */
|
|
1680
|
-
/* @__PURE__ */
|
|
1757
|
+
const back = /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline opacity-70", disabled: busy, onClick: () => setPage(view?.app_id ? "connection" : "select"), children: "\u8FD4\u56DE\u98DE\u4E66" });
|
|
1758
|
+
return /* @__PURE__ */ jsxs7("section", { "aria-label": "\u98DE\u4E66\u6388\u6743", "aria-busy": busy, className: "space-y-5 py-3 text-left", children: [
|
|
1759
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
1760
|
+
/* @__PURE__ */ jsx7("h3", { className: "text-lg font-medium", children: page === "manage" ? "\u7BA1\u7406\u98DE\u4E66\u8FDE\u63A5" : page === "help" ? "\u8FDE\u63A5\u5E2E\u52A9" : page === "select" ? "\u8FDE\u63A5\u98DE\u4E66" : "\u98DE\u4E66" }),
|
|
1761
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-1 text-xs opacity-70", children: "\u6309\u98DE\u4E66\u5B98\u65B9\u63A8\u8350\u6743\u9650\u8FDE\u63A5\uFF0C\u5177\u4F53\u5F00\u901A\u7ED3\u679C\u7531\u4F01\u4E1A\u89C4\u5219\u548C\u672C\u4EBA\u6388\u6743\u51B3\u5B9A\u3002" })
|
|
1681
1762
|
] }),
|
|
1682
|
-
notice && /* @__PURE__ */
|
|
1683
|
-
error && /* @__PURE__ */
|
|
1684
|
-
view?.error && /* @__PURE__ */
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
view.error.next_action && /* @__PURE__ */
|
|
1687
|
-
!waiting && view.app_id && /* @__PURE__ */
|
|
1688
|
-
/* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1763
|
+
notice && /* @__PURE__ */ jsx7("output", { className: "block rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: notice }),
|
|
1764
|
+
error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: error }),
|
|
1765
|
+
view?.error && /* @__PURE__ */ jsxs7("div", { role: "alert", className: "space-y-1 rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: [
|
|
1766
|
+
/* @__PURE__ */ jsx7("p", { children: view.error.message }),
|
|
1767
|
+
view.error.next_action && /* @__PURE__ */ jsx7("p", { children: view.error.next_action }),
|
|
1768
|
+
!waiting && view.app_id && /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-3", children: [
|
|
1769
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: retryCurrent, children: "\u91CD\u8BD5\u5F53\u524D\u6388\u6743" }),
|
|
1770
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" })
|
|
1690
1771
|
] })
|
|
1691
1772
|
] }),
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1773
|
+
view && !waiting && matchesRequestedAuthorization(view) && /* @__PURE__ */ jsx7(ConnectorAuthorizationProgress, { result: view.authorization_result, onCheck: () => void run("check"), busy }),
|
|
1774
|
+
view && !waiting && page !== "help" && /* @__PURE__ */ jsx7(FeishuPermissionStatus, { permissions: view.permissions ?? [], template: view.permission_template }),
|
|
1775
|
+
!view && !error && /* @__PURE__ */ jsx7("output", { className: "block text-sm", children: "\u6B63\u5728\u8BFB\u53D6\u98DE\u4E66\u8FDE\u63A5\u2026" }),
|
|
1776
|
+
!view && error && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void refresh(), children: "\u91CD\u65B0\u8BFB\u53D6\u8FDE\u63A5" }),
|
|
1777
|
+
(autoAuthorize || authorizationCapabilities?.length) && busy && !waiting && !error && !view?.error ? /* @__PURE__ */ jsx7("output", { className: "block text-sm", children: "\u6B63\u5728\u5904\u7406\u98DE\u4E66\u6388\u6743\u2026" }) : waiting ? /* @__PURE__ */ jsxs7("div", { className: "space-y-4 rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-5 text-center", children: [
|
|
1778
|
+
/* @__PURE__ */ jsx7("h4", { className: "font-medium", children: view?.phase === "app" ? "\u5728\u98DE\u4E66\u9009\u62E9\u6216\u521B\u5EFA\u5E94\u7528" : view?.phase === "permissions" ? "\u5728\u98DE\u4E66\u786E\u8BA4\u5E76\u5F00\u901A\u6743\u9650" : "\u8BF7\u5728\u98DE\u4E66\u786E\u8BA4\u672C\u6B21\u6388\u6743" }),
|
|
1779
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: view?.current_step?.message || "\u5B8C\u6210\u5F53\u524D\u6B65\u9AA4\u540E\u81EA\u52A8\u7EE7\u7EED\uFF0C\u5DF2\u6709\u80FD\u529B\u59CB\u7EC8\u4FDD\u7559\u3002" }),
|
|
1780
|
+
url ? /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1781
|
+
new TextEncoder().encode(url).length <= 2200 ? /* @__PURE__ */ jsx7(QRCodeSVG, { value: url, size: 180, marginSize: 4, title: "\u98DE\u4E66\u6388\u6743\u4E8C\u7EF4\u7801", className: "mx-auto rounded-lg bg-white" }) : /* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u6388\u6743\u9879\u76EE\u8F83\u591A\uFF0C\u8BF7\u6253\u5F00\u98DE\u4E66\u6388\u6743\u9875\u9762\u7EE7\u7EED\u3002" }),
|
|
1782
|
+
/* @__PURE__ */ jsx7("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "block text-sm underline", children: "\u6253\u5F00\u98DE\u4E66\u6388\u6743\u9875\u9762" })
|
|
1783
|
+
] }) : verifying ? /* @__PURE__ */ jsx7("output", { className: "block text-sm", children: view?.error ? "\u6838\u9A8C\u6682\u672A\u5B8C\u6210\uFF0C\u8BF7\u70B9\u51FB\u201C\u6211\u5DF2\u5B8C\u6210\u6388\u6743\u201D\u91CD\u8BD5\u3002" : "\u6B63\u5728\u6838\u9A8C\u6388\u6743\u7ED3\u679C\uFF0C\u8BF7\u7A0D\u5019\u3002" }) : /* @__PURE__ */ jsx7("p", { role: "alert", className: "text-sm", children: "\u5F53\u524D\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\u6216\u65E0\u6CD5\u9A8C\u8BC1\uFF0C\u8BF7\u91CD\u8BD5\u672C\u6B21\u6388\u6743\u3002" }),
|
|
1784
|
+
view?.expires_at && /* @__PURE__ */ jsxs7("p", { className: "text-xs opacity-70", children: [
|
|
1702
1785
|
"\u6709\u6548\u81F3 ",
|
|
1703
1786
|
new Date(view.expires_at * 1e3).toLocaleTimeString()
|
|
1704
1787
|
] }),
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
!url && !verifying && /* @__PURE__ */
|
|
1788
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap justify-center gap-3", children: [
|
|
1789
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("poll", view?.attempt_id ? { attempt_id: view.attempt_id } : {}), children: busy ? "\u6B63\u5728\u786E\u8BA4\u2026" : "\u6211\u5DF2\u5B8C\u6210\u6388\u6743" }),
|
|
1790
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("cancel", view?.attempt_id ? { attempt_id: view.attempt_id } : {}), children: "\u6682\u65F6\u53D6\u6D88" }),
|
|
1791
|
+
!url && !verifying && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: retryCurrent, children: "\u91CD\u8BD5\u672C\u6B21\u6388\u6743" })
|
|
1709
1792
|
] }),
|
|
1710
|
-
view?.phase === "permissions" && /* @__PURE__ */
|
|
1711
|
-
] }) : view && page === "select" ? /* @__PURE__ */
|
|
1712
|
-
view.app_id ? back : /* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
view.catalog_unavailable && /* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
1793
|
+
view?.phase === "permissions" && /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" })
|
|
1794
|
+
] }) : view && page === "select" ? /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1795
|
+
view.app_id ? back : /* @__PURE__ */ jsx7("p", { className: "text-sm", children: "\u626B\u7801\u5173\u8054\u98DE\u4E66\u5E94\u7528\uFF0C\u5728\u98DE\u4E66\u5B98\u65B9\u9875\u9762\u786E\u8BA4\u6743\u9650\u3002" }),
|
|
1796
|
+
/* @__PURE__ */ jsx7(FeishuCapabilitySelection, { capabilities, permissions: view.permissions, operations: view.operations, domains: view.domains, selected, onChange: setSelected, disabled: busy }),
|
|
1797
|
+
view.catalog_unavailable && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void refresh(), children: "\u91CD\u65B0\u8BFB\u53D6\u5DE5\u4F5C\u80FD\u529B" }),
|
|
1798
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-3 border-t border-[color-mix(in_srgb,currentColor_18%,transparent)] pt-4", children: [
|
|
1799
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u6743\u9650\u7531\u98DE\u4E66\u5B98\u65B9\u9875\u9762\u7EDF\u4E00\u9009\u62E9\uFF0C\u5DF2\u6709\u6388\u6743\u7EE7\u7EED\u4FDD\u7559\u3002" }),
|
|
1800
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: `${button} border-blue-600 bg-blue-600 text-white`, disabled: busy || Boolean(view.app_id) && !selected.length, onClick: () => start(), children: busy ? "\u6B63\u5728\u51C6\u5907\u6388\u6743\u2026" : view.app_id ? preserveDisabled ? "\u8865\u5145\u6388\u6743\u5E76\u4FDD\u5B58" : "\u524D\u5F80\u98DE\u4E66\u6388\u6743" : "\u8FDE\u63A5\u98DE\u4E66" })
|
|
1718
1801
|
] }),
|
|
1719
|
-
preserveDisabled && /* @__PURE__ */
|
|
1720
|
-
] }) : view && page === "connection" ? /* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1802
|
+
preserveDisabled && /* @__PURE__ */ jsx7("p", { className: "text-xs", children: "\u6B64\u52A9\u624B\u5F53\u524D\u505C\u7528\uFF0C\u65B0\u589E\u6388\u6743\u4E0D\u4F1A\u81EA\u52A8\u542F\u7528\u3002\u9700\u8981\u65F6\u53EF\u5728\u7BA1\u7406\u8FDE\u63A5\u4E2D\u91CD\u65B0\u542F\u7528\u3002" })
|
|
1803
|
+
] }) : view && page === "connection" ? /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1804
|
+
/* @__PURE__ */ jsxs7("div", { className: "rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4", children: [
|
|
1805
|
+
/* @__PURE__ */ jsxs7("p", { className: "font-medium", children: [
|
|
1723
1806
|
view.activation_pending === true ? "\u8FDE\u63A5\u5C1A\u672A\u5B8C\u6210" : view.enabled === false && view.app_id ? "\u5DF2\u5728\u6B64\u52A9\u624B\u4E2D\u505C\u7528" : active.length ? "\u98DE\u4E66\u5DF2\u53EF\u4EE5\u4F7F\u7528" : "\u8FD8\u6709\u9879\u76EE\u9700\u8981\u5904\u7406",
|
|
1724
1807
|
view.label ? ` \xB7 ${view.label}` : ""
|
|
1725
1808
|
] }),
|
|
1726
|
-
/* @__PURE__ */
|
|
1809
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-1 text-xs opacity-70", children: view.activation_pending === true ? "\u5B8C\u6210\u6388\u6743\u540E\u5373\u53EF\u5F00\u59CB\u4F7F\u7528" : view.enabled === false ? "\u5DF2\u6709\u6388\u6743\u4E0E SuperWork \u63A5\u6536\u8BBE\u7F6E\u4FDD\u7559\u3002" : "\u53EF\u4EE5\u8BA9\u52A9\u624B\u5904\u7406\u5DF2\u5F00\u901A\u7684\u98DE\u4E66\u5DE5\u4F5C\u3002" })
|
|
1727
1810
|
] }),
|
|
1728
|
-
|
|
1729
|
-
|
|
1811
|
+
view.activation_pending === true && active.length > 0 && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: finishExisting, children: "\u5148\u4F7F\u7528\u5DF2\u5F00\u901A\u80FD\u529B\uFF0C\u5176\u4ED6\u7A0D\u540E\u5904\u7406" }),
|
|
1812
|
+
pending.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "space-y-2 rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
|
|
1813
|
+
/* @__PURE__ */ jsxs7("p", { children: [
|
|
1730
1814
|
pending.length,
|
|
1731
1815
|
" \u9879\u5C1A\u672A\u5B8C\u6210\uFF0C\u5176\u4ED6\u5DF2\u5F00\u901A\u80FD\u529B\u7EE7\u7EED\u4FDD\u7559\u3002"
|
|
1732
1816
|
] }),
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ jsxs7("details", { className: "text-xs", children: [
|
|
1818
|
+
/* @__PURE__ */ jsx7("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u672A\u5B8C\u6210\u9879\u76EE" }),
|
|
1819
|
+
/* @__PURE__ */ jsx7("div", { className: "mt-2 max-h-60 space-y-2 overflow-y-auto", children: pending.map((item) => /* @__PURE__ */ jsxs7("p", { children: [
|
|
1736
1820
|
item.name,
|
|
1737
1821
|
"\uFF1A",
|
|
1738
1822
|
item.reason || item.next_action || statusLabels[item.status]
|
|
1739
1823
|
] }, item.id)) })
|
|
1740
1824
|
] }),
|
|
1741
|
-
receptionNeedsTest && /* @__PURE__ */
|
|
1742
|
-
pendingPermissions.length > 0 && /* @__PURE__ */
|
|
1743
|
-
failedUser.length > 0 && /* @__PURE__ */
|
|
1825
|
+
receptionNeedsTest && /* @__PURE__ */ jsx7("p", { className: "text-xs", children: "\u63A5\u6536\u6743\u9650\u5DF2\u7ECF\u751F\u6548\uFF0C\u4ECD\u9700\u5411\u673A\u5668\u4EBA\u53D1\u9001\u6D4B\u8BD5\u6D88\u606F\u4EE5\u786E\u8BA4\u5B9E\u9645\u63A5\u6536\u3002" }),
|
|
1826
|
+
pendingPermissions.length > 0 && /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: () => start(pendingPermissions.map((item) => item.id)), children: "\u7EE7\u7EED\u5F00\u901A\u672A\u5B8C\u6210\u7684\u6743\u9650" }),
|
|
1827
|
+
failedUser.length > 0 && /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline", disabled: busy, onClick: () => start(failedUser.map((item) => item.id)), children: "\u4EC5\u8865\u5145\u672A\u5B8C\u6210\u7684\u672C\u4EBA\u6388\u6743" })
|
|
1744
1828
|
] }),
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1829
|
+
/* @__PURE__ */ jsxs7("dl", { className: "divide-y divide-[color-mix(in_srgb,currentColor_18%,transparent)] rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] px-4 text-sm", children: [
|
|
1830
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex justify-between gap-3 py-4", children: [
|
|
1831
|
+
/* @__PURE__ */ jsx7("dt", { children: "\u53D1\u9001\u6D88\u606F" }),
|
|
1832
|
+
/* @__PURE__ */ jsx7("dd", { children: "\u673A\u5668\u4EBA\u8EAB\u4EFD" })
|
|
1749
1833
|
] }),
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex justify-between gap-3 py-4", children: [
|
|
1835
|
+
/* @__PURE__ */ jsx7("dt", { children: "\u63A5\u6536\u98DE\u4E66\u6D88\u606F" }),
|
|
1836
|
+
/* @__PURE__ */ jsx7("dd", { children: subscription === "enabled" ? "\u5DF2\u63A5\u5165\u52A9\u624B" : subscription === "paused" ? "\u5411\u52A9\u624B\u63A8\u9001\u5DF2\u6682\u505C" : "\u5C1A\u672A\u63A5\u5165\u52A9\u624B" })
|
|
1753
1837
|
] }),
|
|
1754
|
-
/* @__PURE__ */
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex justify-between gap-3 py-4", children: [
|
|
1839
|
+
/* @__PURE__ */ jsx7("dt", { children: "\u5DF2\u5F00\u901A\u7684\u5DE5\u4F5C\u80FD\u529B" }),
|
|
1840
|
+
/* @__PURE__ */ jsxs7("dd", { children: [
|
|
1757
1841
|
categories.length,
|
|
1758
1842
|
" \u7C7B \xB7 ",
|
|
1759
1843
|
active.length,
|
|
@@ -1761,24 +1845,24 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
|
|
|
1761
1845
|
] })
|
|
1762
1846
|
] })
|
|
1763
1847
|
] }),
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1848
|
+
/* @__PURE__ */ jsx7("div", { className: "flex flex-wrap gap-2", children: categories.map((name) => /* @__PURE__ */ jsx7("span", { className: "rounded-md border border-[color-mix(in_srgb,currentColor_18%,transparent)] px-2 py-1 text-xs", children: name }, name)) }),
|
|
1849
|
+
/* @__PURE__ */ jsxs7("details", { className: "text-sm", children: [
|
|
1850
|
+
/* @__PURE__ */ jsx7("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u6743\u9650\u4E0E\u80FD\u529B\u72B6\u6001" }),
|
|
1851
|
+
/* @__PURE__ */ jsx7(FeishuCapabilitySelection, { capabilities, permissions: view.permissions, operations: view.operations, domains: view.domains, selected, onChange: setSelected, disabled: busy })
|
|
1768
1852
|
] }),
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
1853
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-3 border-t border-[color-mix(in_srgb,currentColor_18%,transparent)] pt-4", children: [
|
|
1854
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: `${button} bg-blue-600 text-white`, disabled: busy, onClick: () => void addCapabilities(), children: busy ? "\u6B63\u5728\u68C0\u67E5\u2026" : "\u8865\u5145\u6388\u6743" }),
|
|
1855
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => setPage("manage"), children: "\u7BA1\u7406\u8FDE\u63A5" })
|
|
1772
1856
|
] })
|
|
1773
|
-
] }) : view && page === "manage" ? /* @__PURE__ */
|
|
1857
|
+
] }) : view && page === "manage" ? /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1774
1858
|
back,
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1859
|
+
/* @__PURE__ */ jsxs7("div", { className: "space-y-5 divide-y divide-[color-mix(in_srgb,currentColor_18%,transparent)] rounded-xl border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-4 text-sm", children: [
|
|
1860
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-4", children: [
|
|
1861
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
1862
|
+
/* @__PURE__ */ jsx7("p", { children: "\u5728\u6B64\u52A9\u624B\u4E2D\u4F7F\u7528\u98DE\u4E66" }),
|
|
1863
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-1 text-xs opacity-70", children: "\u505C\u7528\u53EA\u5F71\u54CD\u6B64\u52A9\u624B\uFF0CSuperWork \u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u4FDD\u7559\u3002" })
|
|
1780
1864
|
] }),
|
|
1781
|
-
view.enabled === false ? /* @__PURE__ */
|
|
1865
|
+
view.enabled === false ? /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("finish", { capabilities: view.selected_capabilities ?? selected, enable: true }), children: "\u91CD\u65B0\u542F\u7528" }) : onDisable ? /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: async () => {
|
|
1782
1866
|
if (inFlight.current) return;
|
|
1783
1867
|
inFlight.current = true;
|
|
1784
1868
|
setBusy(true);
|
|
@@ -1793,86 +1877,86 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
|
|
|
1793
1877
|
inFlight.current = false;
|
|
1794
1878
|
if (live.current) setBusy(false);
|
|
1795
1879
|
}
|
|
1796
|
-
}, children: "\u505C\u7528\u6B64\u52A9\u624B\u8FDE\u63A5" }) : /* @__PURE__ */
|
|
1880
|
+
}, children: "\u505C\u7528\u6B64\u52A9\u624B\u8FDE\u63A5" }) : /* @__PURE__ */ jsx7("span", { className: "text-xs", children: "\u5DF2\u542F\u7528" })
|
|
1797
1881
|
] }),
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
["enabled", "paused"].includes(subscription) && /* @__PURE__ */
|
|
1802
|
-
bindDelivery && canReceive(view) && subscription !== "paused" && /* @__PURE__ */
|
|
1803
|
-
receptionNeedsTest && /* @__PURE__ */
|
|
1882
|
+
/* @__PURE__ */ jsxs7("div", { className: "space-y-2 pt-4", children: [
|
|
1883
|
+
/* @__PURE__ */ jsx7("p", { children: "\u5411\u52A9\u624B\u63A8\u9001\u98DE\u4E66\u6D88\u606F" }),
|
|
1884
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u4E0E\u6B64\u52A9\u624B\u4F7F\u7528\u6743\u9650\u5206\u522B\u7BA1\u7406\uFF1B\u6682\u505C\u63A8\u9001\u4ECD\u4FDD\u7559 SuperWork \u4E2D\u7684\u6388\u6743\u548C\u6D88\u606F\u63A5\u6536\u3002" }),
|
|
1885
|
+
["enabled", "paused"].includes(subscription) && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run(subscription === "paused" ? "resume" : "pause"), children: subscription === "paused" ? "\u6062\u590D\u5411\u52A9\u624B\u63A8\u9001" : "\u6682\u505C\u5411\u52A9\u624B\u63A8\u9001" }),
|
|
1886
|
+
bindDelivery && canReceive(view) && subscription !== "paused" && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("bind"), children: subscription === "enabled" ? "\u66F4\u65B0\u52A9\u624B\u63A5\u6536\u5730\u5740" : "\u91CD\u65B0\u63A5\u5165\u52A9\u624B\u6D88\u606F" }),
|
|
1887
|
+
receptionNeedsTest && /* @__PURE__ */ jsx7("p", { className: "text-xs", children: "\u63A5\u6536\u6743\u9650\u5DF2\u6838\u9A8C\uFF0C\u4E8B\u4EF6\u8BA2\u9605\u5C1A\u5F85\u6D4B\u8BD5\u3002\u8BF7\u5411\u673A\u5668\u4EBA\u53D1\u9001\u6D4B\u8BD5\u6D88\u606F\u540E\u5728\u8FDE\u63A5\u5E2E\u52A9\u4E2D\u67E5\u770B\u8BB0\u5F55\u3002" })
|
|
1804
1888
|
] }),
|
|
1805
|
-
/* @__PURE__ */
|
|
1806
|
-
/* @__PURE__ */
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
1889
|
+
/* @__PURE__ */ jsxs7("div", { className: "pt-4", children: [
|
|
1890
|
+
/* @__PURE__ */ jsx7("p", { children: view.label || "\u98DE\u4E66\u8D26\u53F7" }),
|
|
1891
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u5DF2\u5F00\u901A\u80FD\u529B\u4E0E\u65B0\u589E\u6388\u6743\u5747\u53D7\u98DE\u4E66\u5E94\u7528\u53EF\u7528\u8303\u56F4\u548C\u6570\u636E\u6743\u9650\u9650\u5236\u3002" }),
|
|
1892
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mt-2 text-xs underline", disabled: busy, onClick: () => void addCapabilities(), children: "\u67E5\u770B\u4E0E\u6DFB\u52A0\u5DE5\u4F5C\u80FD\u529B" })
|
|
1809
1893
|
] })
|
|
1810
1894
|
] }),
|
|
1811
|
-
view.connection_id && /* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1895
|
+
view.connection_id && /* @__PURE__ */ jsxs7("div", { className: "space-y-3 rounded-xl border border-red-600/30 p-4 text-sm", children: [
|
|
1896
|
+
/* @__PURE__ */ jsx7("p", { className: "font-medium", children: "\u79FB\u9664\u65E7\u8FDE\u63A5\uFF0C\u91CD\u65B0\u5F00\u59CB" }),
|
|
1897
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs opacity-70", children: "\u8FD9\u4F1A\u79FB\u9664 SuperWork \u4E2D\u6B64\u8FDE\u63A5\u7684\u51ED\u636E\u5E76\u505C\u6B62\u63A5\u6536\u548C\u8F6C\u53D1\u6D88\u606F\uFF0C\u5176\u4ED6\u4F9D\u8D56\u6B64\u8FDE\u63A5\u7684\u52A9\u624B\u4E5F\u4F1A\u53D7\u5230\u5F71\u54CD\u3002\u5386\u53F2\u6D88\u606F\u4E0E\u6392\u67E5\u65E5\u5FD7\u4FDD\u7559\uFF0C\u98DE\u4E66\u540E\u53F0\u5E94\u7528\u4E0D\u4F1A\u5220\u9664\u3002" }),
|
|
1898
|
+
/* @__PURE__ */ jsxs7(AlertDialog, { open: removingConnectionID !== null, onOpenChange: (open) => {
|
|
1815
1899
|
if (!open) setRemovingConnectionID(null);
|
|
1816
1900
|
}, children: [
|
|
1817
|
-
/* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
/* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1901
|
+
/* @__PURE__ */ jsx7(AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx7("button", { type: "button", className: `${button} border-red-600/40 text-red-600`, disabled: busy, onClick: () => setRemovingConnectionID(view.connection_id ?? null), children: "\u79FB\u9664\u8FDE\u63A5\u5E76\u91CD\u65B0\u8FDE\u63A5" }) }),
|
|
1902
|
+
/* @__PURE__ */ jsxs7(AlertDialogContent, { className: "z-[60] w-[calc(100%_-_32px)] max-w-md p-5 sm:max-w-md", overlayClassName: "z-[60] bg-black/40", style: { backgroundColor: "var(--color-canvas, hsl(var(--popover, 0 0% 100%)))", color: "var(--color-copy, hsl(var(--foreground, 0 0% 10%)))" }, children: [
|
|
1903
|
+
/* @__PURE__ */ jsx7(AlertDialogTitle, { children: "\u786E\u8BA4\u79FB\u9664\u5F53\u524D\u98DE\u4E66\u8FDE\u63A5\uFF1F" }),
|
|
1904
|
+
/* @__PURE__ */ jsx7(AlertDialogDescription, { children: "SuperWork \u4E2D\u6B64\u8FDE\u63A5\u7684\u51ED\u636E\u5C06\u88AB\u79FB\u9664\uFF0C\u6D88\u606F\u63A5\u6536\u548C\u8F6C\u53D1\u5C06\u505C\u6B62\uFF0C\u5176\u4ED6\u4F9D\u8D56\u6B64\u8FDE\u63A5\u7684\u52A9\u624B\u4E5F\u4F1A\u53D7\u5F71\u54CD\u3002\u5386\u53F2\u6D88\u606F\u4E0E\u6392\u67E5\u65E5\u5FD7\u4F1A\u4FDD\u7559\uFF0C\u98DE\u4E66\u540E\u53F0\u5E94\u7528\u4E0D\u4F1A\u5220\u9664\u3002\u79FB\u9664\u540E\uFF0C\u7531\u4F60\u518D\u6B21\u70B9\u51FB\u201C\u8FDE\u63A5\u98DE\u4E66\u201D\u83B7\u53D6\u65B0\u4E8C\u7EF4\u7801\u3002" }),
|
|
1905
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap justify-end gap-3", children: [
|
|
1906
|
+
/* @__PURE__ */ jsx7(AlertDialogCancel, { asChild: true, children: /* @__PURE__ */ jsx7("button", { type: "button", className: button, children: "\u53D6\u6D88" }) }),
|
|
1907
|
+
/* @__PURE__ */ jsx7(AlertDialogAction, { asChild: true, children: /* @__PURE__ */ jsx7("button", { type: "button", className: `${button} border-red-600 bg-red-600 text-white`, onClick: () => {
|
|
1824
1908
|
if (removingConnectionID) void removeConnection(removingConnectionID);
|
|
1825
1909
|
}, children: "\u786E\u8BA4\u79FB\u9664\u8FDE\u63A5" }) })
|
|
1826
1910
|
] })
|
|
1827
1911
|
] })
|
|
1828
1912
|
] })
|
|
1829
1913
|
] })
|
|
1830
|
-
] }) : view && page === "help" ? /* @__PURE__ */
|
|
1914
|
+
] }) : view && page === "help" ? /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1831
1915
|
back,
|
|
1832
|
-
/* @__PURE__ */
|
|
1833
|
-
pending.map((item) => /* @__PURE__ */
|
|
1834
|
-
/* @__PURE__ */
|
|
1835
|
-
/* @__PURE__ */
|
|
1916
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm", children: "\u53EA\u5904\u7406\u672A\u5B8C\u6210\u7684\u9879\u76EE\uFF0C\u5DF2\u7ECF\u5F00\u901A\u7684\u80FD\u529B\u4E0D\u9700\u8981\u91CD\u65B0\u7533\u8BF7\u3002" }),
|
|
1917
|
+
pending.map((item) => /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-sm", children: [
|
|
1918
|
+
/* @__PURE__ */ jsx7("p", { children: item.name }),
|
|
1919
|
+
/* @__PURE__ */ jsxs7("p", { className: "text-xs", children: [
|
|
1836
1920
|
item.reason || item.next_action || statusLabels[item.status],
|
|
1837
1921
|
item.actor ? ` \xB7 \u7531${item.actor}\u5904\u7406` : ""
|
|
1838
1922
|
] })
|
|
1839
1923
|
] }, item.id)),
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
view.app_id && /* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
1924
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void run("check"), children: "\u91CD\u65B0\u68C0\u67E5\u8FDE\u63A5" }),
|
|
1925
|
+
view.app_id && /* @__PURE__ */ jsx7("a", { className: "block text-xs underline", href: `https://open.feishu.cn/app/${encodeURIComponent(view.app_id)}/auth`, target: "_blank", rel: "noopener noreferrer", children: "\u5728\u98DE\u4E66\u67E5\u770B\u6743\u9650\u3001\u53D1\u5E03\u4E0E\u53EF\u7528\u8303\u56F4" }),
|
|
1926
|
+
/* @__PURE__ */ jsxs7("details", { className: "rounded-lg border border-[color-mix(in_srgb,currentColor_18%,transparent)] p-3 text-xs", children: [
|
|
1927
|
+
/* @__PURE__ */ jsx7("summary", { className: "cursor-pointer", children: "\u9AD8\u7EA7\u6392\u67E5\u4FE1\u606F" }),
|
|
1928
|
+
/* @__PURE__ */ jsxs7("div", { className: "space-y-3 pt-3", children: [
|
|
1929
|
+
/* @__PURE__ */ jsxs7("p", { children: [
|
|
1846
1930
|
"\u8FDE\u63A5\u7F16\u53F7\uFF1A",
|
|
1847
1931
|
view.connection_id || "\u5C1A\u672A\u521B\u5EFA"
|
|
1848
1932
|
] }),
|
|
1849
|
-
/* @__PURE__ */
|
|
1933
|
+
/* @__PURE__ */ jsxs7("p", { children: [
|
|
1850
1934
|
"\u6392\u67E5\u7F16\u53F7\uFF1A",
|
|
1851
1935
|
view.error?.trace_id || view.trace_id || "\u6682\u65E0\u8BB0\u5F55"
|
|
1852
1936
|
] }),
|
|
1853
|
-
/* @__PURE__ */
|
|
1854
|
-
view.steps?.length ? /* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsx7("p", { children: "\u8BB0\u5F55\u4E0D\u5305\u542B\u51ED\u636E\u4E0E\u6D88\u606F\u6B63\u6587\u3002" }),
|
|
1938
|
+
view.steps?.length ? /* @__PURE__ */ jsx7("ol", { className: "space-y-2", children: view.steps.map((step, index) => /* @__PURE__ */ jsxs7("li", { children: [
|
|
1855
1939
|
stateLabels[step.state] ?? step.state,
|
|
1856
1940
|
"\uFF1A",
|
|
1857
1941
|
step.message
|
|
1858
1942
|
] }, `${step.id}:${index}`)) }) : null,
|
|
1859
|
-
diagnostics && /* @__PURE__ */
|
|
1860
|
-
diagnosticView?.runtime && /* @__PURE__ */
|
|
1861
|
-
diagnosticView && /* @__PURE__ */
|
|
1943
|
+
diagnostics && /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: busy, onClick: () => void inspect(), children: "\u8BFB\u53D6\u6392\u67E5\u8BB0\u5F55" }),
|
|
1944
|
+
diagnosticView?.runtime && /* @__PURE__ */ jsx7(ConnectorRuntimeDiagnostics, { runtime: diagnosticView.runtime }),
|
|
1945
|
+
diagnosticView && /* @__PURE__ */ jsx7("ol", { className: "space-y-3", children: diagnosticView.audit_events.map((event, index) => /* @__PURE__ */ jsxs7("li", { children: [
|
|
1862
1946
|
event.message ?? auditLabels[event.type ?? ""] ?? "\u8FDE\u63A5\u72B6\u6001\u8BB0\u5F55",
|
|
1863
|
-
event.code && /* @__PURE__ */
|
|
1947
|
+
event.code && /* @__PURE__ */ jsxs7("p", { children: [
|
|
1864
1948
|
"\u539F\u56E0\u7F16\u53F7\uFF1A",
|
|
1865
1949
|
event.code
|
|
1866
1950
|
] }),
|
|
1867
|
-
event.platform_code && /* @__PURE__ */
|
|
1951
|
+
event.platform_code && /* @__PURE__ */ jsxs7("p", { children: [
|
|
1868
1952
|
"\u98DE\u4E66\u9519\u8BEF\u7801\uFF1A",
|
|
1869
1953
|
event.platform_code
|
|
1870
1954
|
] }),
|
|
1871
|
-
event.platform_request_id && /* @__PURE__ */
|
|
1955
|
+
event.platform_request_id && /* @__PURE__ */ jsxs7("p", { children: [
|
|
1872
1956
|
"\u98DE\u4E66\u8BF7\u6C42\u7F16\u53F7\uFF1A",
|
|
1873
1957
|
event.platform_request_id
|
|
1874
1958
|
] }),
|
|
1875
|
-
event.trace_id && /* @__PURE__ */
|
|
1959
|
+
event.trace_id && /* @__PURE__ */ jsxs7("p", { children: [
|
|
1876
1960
|
"\u6392\u67E5\u7F16\u53F7\uFF1A",
|
|
1877
1961
|
event.trace_id
|
|
1878
1962
|
] })
|
|
@@ -1880,7 +1964,7 @@ function DeviceConnection({ read, act, diagnostics, onChanged, bindDelivery = fa
|
|
|
1880
1964
|
] })
|
|
1881
1965
|
] })
|
|
1882
1966
|
] }) : null,
|
|
1883
|
-
!waiting && page !== "help" && /* @__PURE__ */
|
|
1967
|
+
!waiting && page !== "help" && /* @__PURE__ */ jsx7("button", { type: "button", className: "text-xs underline opacity-70", disabled: busy, onClick: () => setPage("help"), children: "\u9047\u5230\u95EE\u9898\uFF1F" })
|
|
1884
1968
|
] });
|
|
1885
1969
|
}
|
|
1886
1970
|
|
|
@@ -1901,4 +1985,4 @@ qrcode.react/lib/esm/index.js:
|
|
|
1901
1985
|
* SPDX-License-Identifier: ISC
|
|
1902
1986
|
*)
|
|
1903
1987
|
*/
|
|
1904
|
-
//# sourceMappingURL=chunk-
|
|
1988
|
+
//# sourceMappingURL=chunk-ARX4JV5T.js.map
|