@yuku123/z-team-component 0.2.80 → 0.2.83

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.
Files changed (51) hide show
  1. package/dist/ChangeLogView-_bRZ55Yi.js +542 -0
  2. package/dist/ComponentDoc-BFoF51we.js +3998 -0
  3. package/dist/InvitationManagementPage-CTPCZXHu.js +495 -0
  4. package/dist/OnboardingPage-DwtuTL61.js +393 -0
  5. package/dist/ScheduledTasks-yeTm2bOY.js +9407 -0
  6. package/dist/SystemShell-D9OzKxL-.js +689 -0
  7. package/dist/_commonjsHelpers-B52_cu2H.js +26 -0
  8. package/dist/api-CIhVblfa.js +2155 -0
  9. package/dist/api-DXLNhtCX.js +20 -0
  10. package/dist/browser-jb_PFvU3.js +1538 -0
  11. package/dist/createWorkspaceWsHandler-BWP5S5X3.js +12951 -0
  12. package/dist/ctc-sso-DtJHC-2M.js +117 -0
  13. package/dist/echarts-B1OU1xr4.js +16 -0
  14. package/dist/history-BlrA1eaW.js +41 -0
  15. package/dist/index-BCp5EtqR.js +914 -0
  16. package/dist/index-BHrMl3Jq.js +9585 -0
  17. package/dist/index-BP7WTzVH.js +137 -0
  18. package/dist/index-B_LJRFsK.js +339 -0
  19. package/dist/index-BgIheStI.js +133 -0
  20. package/dist/index-BohoJQPr.js +7631 -0
  21. package/dist/index-BydWNuk5.js +1229 -0
  22. package/dist/index-C815hPWS.js +430 -0
  23. package/dist/index-CBQMS6rx.js +178 -0
  24. package/dist/index-CESmMALI.js +242 -0
  25. package/dist/index-CUVdeb8y.js +638 -0
  26. package/dist/index-CijskN6t.js +316 -0
  27. package/dist/index-CoBZZQBy.js +112 -0
  28. package/dist/index-Co_0idJY.js +2936 -0
  29. package/dist/index-Cvx6rrxD.js +956 -0
  30. package/dist/index-Cwr5Slv1.js +480 -0
  31. package/dist/index-CxFAICql.js +42050 -0
  32. package/dist/index-DK70mOTz.js +143 -0
  33. package/dist/index-DT80Pwa_.js +5893 -0
  34. package/dist/index-DWsfQMp8.js +208 -0
  35. package/dist/index-DhDdFRHC.js +279 -0
  36. package/dist/index-Dm3wmB0K.js +435 -0
  37. package/dist/index-DzS6-D3M.js +1640 -0
  38. package/dist/index-PKkV63Sw.js +1143 -0
  39. package/dist/index-SbMjh8t4.js +574 -0
  40. package/dist/index-cdB5K3gx.js +814 -0
  41. package/dist/index-mnWs_wA3.js +93 -0
  42. package/dist/index-nU-V276i.js +170 -0
  43. package/dist/index-nW0ikV2R.js +2700 -0
  44. package/dist/index-uF04Ucsi.js +8 -0
  45. package/dist/index-x_7Rmav9.js +118 -0
  46. package/dist/index.js +10 -0
  47. package/dist/index.module-CAa-2T7m.js +72 -0
  48. package/dist/index.module-UI0iz8K0.js +42 -0
  49. package/dist/{menuPermission-D9NGpBZP.js → menuPermission-DHUqvHfu.js} +1 -1
  50. package/dist/pages.js +1 -1
  51. package/package.json +1 -1
@@ -0,0 +1,480 @@
1
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
+ import { r as q, f as le } from "./ctc-sso-DtJHC-2M.js";
3
+ import { r as de, h as K, s as X } from "./sso-user-ZUKv4XMX.js";
4
+ import { ArrowLeftOutlined as ue, PlusOutlined as pe, LogoutOutlined as me, SearchOutlined as he } from "@ant-design/icons";
5
+ import { Spin as O, Button as D, Input as fe, Empty as J, Tag as ge, message as be } from "antd";
6
+ import Q from "query-string";
7
+ import { useState as y, useRef as E, useEffect as w, useMemo as Y, useCallback as B } from "react";
8
+ import { useLocation as ke } from "react-router-dom";
9
+ import { h as A } from "./history-BlrA1eaW.js";
10
+ import { c as we, C as Se } from "./createWorkspaceWsHandler-BWP5S5X3.js";
11
+ import { u as i, f as ye, T as ve } from "./useAppStore-BBr_Fwsz.js";
12
+ import { o as Te, q as Ne, v as je, w as Ce, e as ee } from "./api-CIhVblfa.js";
13
+ import { l as Pe, j as xe } from "./instance-CDmueqyu.js";
14
+ import { i as _e, s as Ee } from "./mobile-client-O3yr9h6t.js";
15
+ /* empty css */
16
+ import { s as Ae } from "./personal-Bn3RLYB8.js";
17
+ const re = 2e4;
18
+ function Ie(o, s = re, n = globalThis) {
19
+ let c = null;
20
+ return {
21
+ start() {
22
+ c == null && (c = n.setTimeout(() => {
23
+ c = null, o();
24
+ }, s));
25
+ },
26
+ stop() {
27
+ c != null && (n.clearTimeout(c), c = null);
28
+ }
29
+ };
30
+ }
31
+ function Le({ text: o, onRetry: s }) {
32
+ return /* @__PURE__ */ d("div", { style: { marginTop: 12, textAlign: "center" }, children: [
33
+ /* @__PURE__ */ t("div", { style: { marginBottom: 10 }, children: o }),
34
+ /* @__PURE__ */ t(
35
+ "button",
36
+ {
37
+ type: "button",
38
+ onClick: s,
39
+ style: {
40
+ padding: "6px 16px",
41
+ borderRadius: 6,
42
+ border: "1px solid #1677ff",
43
+ background: "#1677ff",
44
+ color: "#fff",
45
+ cursor: "pointer"
46
+ },
47
+ children: "重新登录"
48
+ }
49
+ )
50
+ ] });
51
+ }
52
+ const Me = "统一登录接入超时(可能是网络抖动或服务正在重启),请重新登录。";
53
+ function Oe({
54
+ loadingText: o,
55
+ timeoutText: s = Me,
56
+ onRetry: n,
57
+ timeoutMs: c = re,
58
+ className: a
59
+ }) {
60
+ const [N, h] = y(!1), g = E(n);
61
+ return g.current = n, w(() => {
62
+ const m = Ie(
63
+ () => h(!0),
64
+ c
65
+ );
66
+ return m.start(), () => m.stop();
67
+ }, [c]), N ? /* @__PURE__ */ d("div", { className: a, children: [
68
+ /* @__PURE__ */ t(O, { description: "" }),
69
+ /* @__PURE__ */ t(
70
+ Le,
71
+ {
72
+ text: s,
73
+ onRetry: () => g.current()
74
+ }
75
+ )
76
+ ] }) : /* @__PURE__ */ t("div", { className: a, children: /* @__PURE__ */ t(O, { description: o }) });
77
+ }
78
+ function Re(o, s) {
79
+ w(() => {
80
+ if (o == null)
81
+ return;
82
+ i.getState().setObserverStatus(null);
83
+ const n = () => {
84
+ const m = i.getState();
85
+ m.loadMessages().catch(() => {
86
+ }), m.loadRunningExecutions().catch(() => {
87
+ });
88
+ const f = m.activeTaskChat;
89
+ f != null && f.taskId && m.loadTaskMessages(f.taskId).catch(() => {
90
+ }), m.loadFileTree(void 0, !0).catch(() => {
91
+ });
92
+ }, c = Te((m) => {
93
+ i.getState().setWsState(m);
94
+ });
95
+ Ne(o, s, n), i.getState().loadRunningExecutions().catch(() => {
96
+ });
97
+ const a = i.getState(), { handler: N, dispose: h } = we({
98
+ projectId: o,
99
+ token: s,
100
+ updateExecution: a.updateExecution,
101
+ registerExecutionStart: a.registerExecutionStart,
102
+ clearExecution: a.clearExecution,
103
+ applyExecutionCancelled: a.applyExecutionCancelled,
104
+ addMessage: a.addMessage,
105
+ addTaskMessage: a.addTaskMessage,
106
+ deleteMessage: a.deleteMessage,
107
+ updateMessageReadStatus: a.updateMessageReadStatus,
108
+ loadFileTree: a.loadFileTree
109
+ }), g = je(N);
110
+ return () => {
111
+ g(), h(), Ce(), c(), i.getState().setObserverStatus(null);
112
+ };
113
+ }, [o, s]);
114
+ }
115
+ const We = `${window.publicPath ?? "/"}logo.svg`;
116
+ function te() {
117
+ const { pathname: o, search: s } = A.location, n = Q.parse(s);
118
+ if (!n.projectId && !n.project_id)
119
+ return;
120
+ delete n.projectId, delete n.project_id;
121
+ const c = Q.stringify(n);
122
+ A.replace({
123
+ pathname: o,
124
+ search: c ? `?${c}` : ""
125
+ });
126
+ }
127
+ function et() {
128
+ const o = ke(), [s, n] = y("list"), [c, a] = y("chat"), [N, h] = y("team"), [g, m] = y(""), [f, V] = y(!1), [ae, I] = y(!1), {
129
+ currentProject: v,
130
+ currentUser: R,
131
+ projects: L,
132
+ loading: ne,
133
+ members: W,
134
+ token: oe,
135
+ loadProjects: z,
136
+ expandProject: H,
137
+ updateCurrentUser: j,
138
+ requestChatScrollBottom: S
139
+ } = i(), k = Y(() => {
140
+ const e = Q.parse(o.search), r = String(e.projectId ?? e.project_id ?? "").trim();
141
+ if (!r)
142
+ return null;
143
+ const l = Number(r);
144
+ return Number.isFinite(l) && l > 0 ? l : null;
145
+ }, [o.search]), F = E(!1), C = E(!1), P = E(!1), Z = E(k);
146
+ Z.current = k, Re(v == null ? void 0 : v.id, oe), w(() => (document.body.classList.add("team-phone-workspace-route"), () => {
147
+ document.body.classList.remove("team-phone-workspace-route");
148
+ }), []), w(() => {
149
+ !_e(o.search) && Ee() || A.replace({
150
+ pathname: "/workspace",
151
+ search: o.search
152
+ });
153
+ }, [o.search]);
154
+ const se = B(
155
+ (e) => {
156
+ a("chat"), h(e), S(e, !0);
157
+ },
158
+ [S]
159
+ );
160
+ w(() => {
161
+ let e = !1, r = 0;
162
+ const l = 100;
163
+ let x = !1, U = 0;
164
+ const M = 3, T = (b) => {
165
+ const u = i.getState().token;
166
+ if (Z.current != null) {
167
+ e || (j(X(b)), V(!0)), ee().then((G) => {
168
+ e || j(G);
169
+ }).catch(() => {
170
+ !e && u && (localStorage.removeItem("z_team_token"), i.setState({ token: "" }));
171
+ });
172
+ return;
173
+ }
174
+ ee().then((G) => {
175
+ e || j(G);
176
+ }).catch(() => {
177
+ e || (u && (localStorage.removeItem("z_team_token"), i.setState({ token: "" })), j(X(b)));
178
+ }).finally(() => {
179
+ e || V(!0);
180
+ });
181
+ };
182
+ return (() => {
183
+ if (e)
184
+ return;
185
+ const b = async () => {
186
+ if (e)
187
+ return;
188
+ let u = de();
189
+ if ((!u || !K(u)) && !x) {
190
+ x = !0;
191
+ try {
192
+ const p = await le();
193
+ p.kind === "authenticated" ? u = p.user : p.kind === "unauthenticated" && (U += 1);
194
+ } catch {
195
+ } finally {
196
+ x = !1;
197
+ }
198
+ }
199
+ if (u && K(u)) {
200
+ T(u);
201
+ return;
202
+ }
203
+ if (U >= M) {
204
+ q();
205
+ return;
206
+ }
207
+ if (r += 1, r >= l) {
208
+ q();
209
+ return;
210
+ }
211
+ window.setTimeout(() => {
212
+ b();
213
+ }, 150);
214
+ };
215
+ b();
216
+ })(), () => {
217
+ e = !0;
218
+ };
219
+ }, [j]), w(() => {
220
+ R && z();
221
+ }, [R, z]), w(() => {
222
+ var l;
223
+ if (!f || k != null || s === "project" || P.current)
224
+ return;
225
+ const e = i.getState(), r = (l = e.currentProject) == null ? void 0 : l.id;
226
+ r == null || !e.expandedProjectIds.includes(String(r)) || (n("project"), a("chat"), h("team"), S("team", !0));
227
+ }, [f, k, s, S]);
228
+ const ce = B(
229
+ async (e) => {
230
+ P.current = !1, I(!0);
231
+ try {
232
+ await H(e), n("project"), a("chat"), h("team");
233
+ const r = i.getState();
234
+ r.currentProject && await r.refreshProjectPanels(
235
+ String(r.currentProject.id),
236
+ r.projectSwitchSeq,
237
+ !1
238
+ ), S("team", !0);
239
+ } finally {
240
+ I(!1);
241
+ }
242
+ },
243
+ [H, S]
244
+ );
245
+ w(() => {
246
+ var M;
247
+ if (!f || k == null || F.current || C.current)
248
+ return;
249
+ const e = k == null ? "" : String(k), r = i.getState();
250
+ if (String(((M = r.currentProject) == null ? void 0 : M.id) ?? "") === e && r.expandedProjectIds.includes(e)) {
251
+ F.current = !0, te(), P.current = !1, n("project"), a("chat"), h("team"), i.getState().loadMessages().catch(() => {
252
+ });
253
+ return;
254
+ }
255
+ let l = !1;
256
+ C.current = !0, I(!0);
257
+ const x = async () => {
258
+ const T = Date.now() + 4e3;
259
+ for (; Date.now() < T; ) {
260
+ if (l)
261
+ return;
262
+ const _ = i.getState();
263
+ if (!_.loading || _.projects.length > 0)
264
+ return;
265
+ await new Promise((b) => setTimeout(b, 50));
266
+ }
267
+ };
268
+ return (async () => {
269
+ try {
270
+ if (await x(), l)
271
+ return;
272
+ let {
273
+ token: T,
274
+ projects: _,
275
+ expandProject: b
276
+ } = i.getState(), u = _.find((p) => p.id === e);
277
+ if (!u) {
278
+ const p = await Pe(e, T);
279
+ if (l)
280
+ return;
281
+ if (p.status === "NOT_FOUND" || !p.scenarioInstance) {
282
+ be.info("无此工程");
283
+ return;
284
+ }
285
+ if (u = await xe(e, T), l)
286
+ return;
287
+ }
288
+ if (l || !u)
289
+ return;
290
+ if (F.current = !0, await b(u), !l) {
291
+ P.current = !1, n("project"), a("chat"), h("team"), te();
292
+ const p = i.getState();
293
+ p.currentProject && await p.refreshProjectPanels(
294
+ String(p.currentProject.id),
295
+ p.projectSwitchSeq,
296
+ !1
297
+ ), S("team", !0);
298
+ }
299
+ } catch {
300
+ } finally {
301
+ I(!1), C.current = !1, i.getState().loadProjects();
302
+ }
303
+ })(), () => {
304
+ l = !0, C.current && (C.current = !1);
305
+ };
306
+ }, [f, k]);
307
+ const $ = Y(() => {
308
+ const e = g.trim().toLowerCase();
309
+ return e ? L.filter(
310
+ (r) => r.name.toLowerCase().includes(e) || (r.scenario_name ?? "").toLowerCase().includes(e)
311
+ ) : L;
312
+ }, [g, L]), ie = B(() => {
313
+ P.current = !0, n("list"), a("chat");
314
+ }, []);
315
+ return !f || !R ? /* @__PURE__ */ t(
316
+ Oe,
317
+ {
318
+ className: "phone-workspace phone-workspace-loading",
319
+ loadingText: "正在接入 4A 统一登录…",
320
+ timeoutText: "4A 统一登录接入超时(可能是网络抖动或服务正在重启),请重新登录。",
321
+ onRetry: () => q()
322
+ }
323
+ ) : /* @__PURE__ */ d("div", { className: "phone-workspace", children: [
324
+ /* @__PURE__ */ d("header", { className: "phone-workspace-header", children: [
325
+ s === "project" ? /* @__PURE__ */ t(
326
+ D,
327
+ {
328
+ type: "text",
329
+ icon: /* @__PURE__ */ t(ue, {}),
330
+ className: "phone-workspace-back",
331
+ onClick: ie,
332
+ "aria-label": "返回项目列表"
333
+ }
334
+ ) : /* @__PURE__ */ t(
335
+ "img",
336
+ {
337
+ src: We,
338
+ alt: "Z-OPC",
339
+ className: "phone-workspace-logo",
340
+ onClick: () => A.push("/welcome"),
341
+ style: { cursor: "pointer" }
342
+ }
343
+ ),
344
+ /* @__PURE__ */ t("div", { className: "phone-workspace-header-title", children: s === "list" ? /* @__PURE__ */ t(
345
+ "span",
346
+ {
347
+ className: "phone-workspace-brand",
348
+ onClick: () => A.push("/welcome"),
349
+ style: { cursor: "pointer" },
350
+ children: "Z-OPC"
351
+ }
352
+ ) : /* @__PURE__ */ t("span", { className: "phone-workspace-project-name", children: (v == null ? void 0 : v.name) ?? "工程" }) }),
353
+ /* @__PURE__ */ d("div", { className: "phone-workspace-header-actions", children: [
354
+ s === "list" ? /* @__PURE__ */ t(
355
+ D,
356
+ {
357
+ type: "text",
358
+ icon: /* @__PURE__ */ t(pe, {}),
359
+ onClick: () => {
360
+ },
361
+ "aria-label": "新建"
362
+ }
363
+ ) : null,
364
+ /* @__PURE__ */ t(
365
+ D,
366
+ {
367
+ type: "text",
368
+ icon: /* @__PURE__ */ t(me, {}),
369
+ onClick: () => {
370
+ Ae();
371
+ },
372
+ "aria-label": "退出"
373
+ }
374
+ )
375
+ ] })
376
+ ] }),
377
+ /* @__PURE__ */ t("main", { className: "phone-workspace-main", children: s === "list" ? /* @__PURE__ */ d("div", { className: "phone-workspace-list", children: [
378
+ /* @__PURE__ */ t("div", { className: "phone-workspace-search", children: /* @__PURE__ */ t(
379
+ fe,
380
+ {
381
+ allowClear: !0,
382
+ prefix: /* @__PURE__ */ t(he, {}),
383
+ placeholder: "搜索项目",
384
+ value: g,
385
+ onChange: (e) => m(e.target.value)
386
+ }
387
+ ) }),
388
+ ne && L.length === 0 ? /* @__PURE__ */ t("div", { className: "phone-workspace-list-loading", children: /* @__PURE__ */ t(O, { description: "加载项目…" }) }) : $.length === 0 ? /* @__PURE__ */ t(
389
+ J,
390
+ {
391
+ description: g ? "无匹配项目" : "暂无项目",
392
+ className: "phone-workspace-empty"
393
+ }
394
+ ) : /* @__PURE__ */ t("ul", { className: "phone-project-list", children: $.map((e) => {
395
+ const r = ye(
396
+ e.created_at
397
+ );
398
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ d(
399
+ "button",
400
+ {
401
+ type: "button",
402
+ className: "phone-project-item",
403
+ onClick: () => {
404
+ ce(e);
405
+ },
406
+ children: [
407
+ /* @__PURE__ */ d("div", { className: "phone-project-item-main", children: [
408
+ /* @__PURE__ */ t("span", { className: "phone-project-item-name", children: e.name }),
409
+ e.scenario_name || r ? /* @__PURE__ */ d("div", { className: "phone-project-item-meta", children: [
410
+ e.scenario_name ? /* @__PURE__ */ t("span", { className: "phone-project-item-scenario", children: e.scenario_name }) : null,
411
+ r ? /* @__PURE__ */ t("span", { className: "phone-project-item-time", children: r }) : null
412
+ ] }) : null
413
+ ] }),
414
+ /* @__PURE__ */ t(
415
+ ge,
416
+ {
417
+ color: e.role === "ADMIN" ? "blue" : "default",
418
+ className: "phone-project-item-tag",
419
+ children: e.role === "ADMIN" ? "我创建" : "参与"
420
+ }
421
+ )
422
+ ]
423
+ }
424
+ ) }, e.id);
425
+ }) })
426
+ ] }) : /* @__PURE__ */ d("div", { className: "phone-workspace-detail", children: [
427
+ /* @__PURE__ */ d("div", { className: "phone-project-toolbar", children: [
428
+ /* @__PURE__ */ t("div", { className: "phone-project-toolbar-main", children: /* @__PURE__ */ t(
429
+ "button",
430
+ {
431
+ type: "button",
432
+ className: c === "chat" ? "phone-toolbar-tab phone-toolbar-active" : "phone-toolbar-tab",
433
+ onClick: () => se("team"),
434
+ children: "协作"
435
+ }
436
+ ) }),
437
+ /* @__PURE__ */ d(
438
+ "button",
439
+ {
440
+ type: "button",
441
+ className: c === "members" ? "phone-toolbar-tab phone-toolbar-members phone-toolbar-active" : "phone-toolbar-tab phone-toolbar-members",
442
+ onClick: () => a("members"),
443
+ children: [
444
+ "成员 (",
445
+ W.length,
446
+ ")"
447
+ ]
448
+ }
449
+ )
450
+ ] }),
451
+ /* @__PURE__ */ t("div", { className: "phone-workspace-detail-body", children: c === "members" ? /* @__PURE__ */ t("ul", { className: "phone-member-list", children: W.length === 0 ? /* @__PURE__ */ t(J, { description: "暂无成员" }) : W.map((e) => /* @__PURE__ */ d("li", { className: "phone-member-item", children: [
452
+ /* @__PURE__ */ t("span", { className: "phone-member-avatar", children: e.member_type === "AGENT" ? "🤖" : "👤" }),
453
+ /* @__PURE__ */ d("div", { className: "phone-member-info", children: [
454
+ /* @__PURE__ */ t("span", { className: "phone-member-name", children: e.display_name }),
455
+ /* @__PURE__ */ d("span", { className: "phone-member-meta", children: [
456
+ e.member_type === "AGENT" ? "Agent" : "成员",
457
+ " ·",
458
+ " ",
459
+ e.role
460
+ ] })
461
+ ] })
462
+ ] }, e.id)) }) : /* @__PURE__ */ t("div", { className: "phone-chat-host", children: /* @__PURE__ */ t(
463
+ Se,
464
+ {
465
+ hideTabs: !0,
466
+ activeTab: N,
467
+ onActiveTabChange: (e) => (
468
+ // @ts-expect-error phase1 宽松化:tab 类型比 chatTab="team" 宽,业务代码未启用 content 模式
469
+ h(e)
470
+ )
471
+ }
472
+ ) }) })
473
+ ] }) }),
474
+ ae ? /* @__PURE__ */ t("div", { className: "phone-workspace-overlay", children: /* @__PURE__ */ t(O, { description: "正在打开工程…" }) }) : null,
475
+ /* @__PURE__ */ t(ve, {})
476
+ ] });
477
+ }
478
+ export {
479
+ et as default
480
+ };