@hkyhy/marsun-components-core 0.1.124 → 0.1.125

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 (27) hide show
  1. package/dist/_virtual/index.js +5 -5
  2. package/dist/_virtual/index2.js +5 -5
  3. package/dist/components/Tools/Inbox/InboxBell/InboxBell.d.ts +43 -3
  4. package/dist/components/Tools/Inbox/InboxBell/InboxBell.js +345 -130
  5. package/dist/components/Tools/Inbox/InboxBell/InboxBell.js.map +1 -1
  6. package/dist/components/Tools/Inbox/InboxBell/emphasizeQuoted.d.ts +3 -0
  7. package/dist/components/Tools/Inbox/InboxBell/emphasizeQuoted.js +13 -0
  8. package/dist/components/Tools/Inbox/InboxBell/emphasizeQuoted.js.map +1 -0
  9. package/dist/components/Tools/Inbox/InboxBell/inboxItemActions.d.ts +37 -0
  10. package/dist/components/Tools/Inbox/InboxBell/inboxItemActions.js +97 -0
  11. package/dist/components/Tools/Inbox/InboxBell/inboxItemActions.js.map +1 -0
  12. package/dist/components/Tools/Inbox/InboxBell/index.d.ts +2 -0
  13. package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js +58 -26
  14. package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js.map +1 -1
  15. package/dist/components/Tools/Inbox/InboxBell/toastPrefs.d.ts +10 -0
  16. package/dist/components/Tools/Inbox/InboxBell/toastPrefs.js +46 -0
  17. package/dist/components/Tools/Inbox/InboxBell/toastPrefs.js.map +1 -0
  18. package/dist/components/Tools/Inbox/index.d.ts +2 -0
  19. package/dist/components/Tools/index.d.ts +2 -1
  20. package/dist/index.js +223 -216
  21. package/dist/index.js.map +1 -1
  22. package/dist/marsun-components-core.css +1 -1
  23. package/dist/node_modules/@antv/g-lite/dist/index.esm.js +1 -1
  24. package/dist/node_modules/@antv/g2/esm/data/kde.js +1 -1
  25. package/dist/node_modules/eventemitter3/index.js +1 -1
  26. package/dist/styles/global.css +1 -1
  27. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- import { getDefaultExportFromCjs as t } from "./_commonjsHelpers.js";
2
- import { __require as e } from "../node_modules/eventemitter3/index2.js";
3
- var r = e();
4
- const i = /* @__PURE__ */ t(r);
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as o } from "../node_modules/pdfast/src/index.js";
3
+ var t = o();
4
+ const s = /* @__PURE__ */ r(t);
5
5
  export {
6
- i as default
6
+ s as default
7
7
  };
8
8
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as o } from "../node_modules/pdfast/src/index.js";
3
- var t = o();
4
- const s = /* @__PURE__ */ r(t);
1
+ import { getDefaultExportFromCjs as t } from "./_commonjsHelpers.js";
2
+ import { __require as e } from "../node_modules/eventemitter3/index2.js";
3
+ var r = e();
4
+ const i = /* @__PURE__ */ t(r);
5
5
  export {
6
- s as default
6
+ i as default
7
7
  };
8
8
  //# sourceMappingURL=index2.js.map
@@ -1,3 +1,4 @@
1
+ import { InboxItemActionKind } from './inboxItemActions';
1
2
  export type InboxBellMessageType = 'alert' | 'action' | 'remind' | string;
2
3
  export type InboxBellItem = {
3
4
  id: string;
@@ -11,6 +12,28 @@ export type InboxBellItem = {
11
12
  href?: string;
12
13
  createdAt?: string;
13
14
  level?: string;
15
+ /** 级别展示名(业务仓从已有维表/工具函数填;空则回落 level) */
16
+ levelLabel?: string;
17
+ /**
18
+ * 级别 Tag 色:业务仓传入预警级别设置色(如 QA `ALERT_LEVEL_COLORS.*.accent`)。
19
+ * 支持 SemanticColor 键或 `#hex`;core 不自造级别色表。
20
+ */
21
+ levelColor?: string;
22
+ category?: string;
23
+ scene?: string;
24
+ eventKey?: string;
25
+ categoryLabel?: string;
26
+ alertId?: string | null;
27
+ actionId?: string | null;
28
+ claimed?: boolean;
29
+ started?: boolean;
30
+ /** 行动当前状态(enrich / contextJson);终态时底栏只保留查看任务 */
31
+ actionStatus?: string;
32
+ factory?: string;
33
+ variety?: string;
34
+ metric?: string;
35
+ /** 业务日/月份(如 2026-07-31);预警深链 date 用 */
36
+ month?: string;
14
37
  };
15
38
  export type InboxBellListResult = {
16
39
  itemList: InboxBellItem[];
@@ -46,14 +69,31 @@ export type InboxBellProps = {
46
69
  className?: string;
47
70
  /** Drawer 标题 */
48
71
  title?: string;
72
+ /**
73
+ * 同源 SSE 路径(默认 `/api/v1/msg-center/inbox/stream`)。
74
+ * 传 `false` 关闭。须配合 `getAccessToken`(EventSource 用 `access_token` 查询参数传 JWT)。
75
+ * 失败回落写后刷新 / 焦点刷新,不定时轮询冒充。
76
+ */
77
+ streamPath?: string | false;
78
+ /** 返回当前 JWT;空则不开 SSE */
79
+ getAccessToken?: () => string | null | undefined;
80
+ /**
81
+ * 卡片底栏动作(认领/去执行等)。不传则底栏按钮一律走 onNavigate / href。
82
+ * 业务仓拦截 claim_alert / start_action / create_task。
83
+ */
84
+ onItemAction?: (kind: InboxItemActionKind, item: InboxBellItem) => void | Promise<void>;
49
85
  };
50
86
  export type InboxBellHandle = {
51
87
  refreshBadge: () => Promise<void>;
52
88
  };
53
89
  /**
54
- * 通用站内信铃铛:列表 / 已读 / Tab / 角标。
55
- * 不含认领、行动等业务动作;由注入的 fetchInbox / markRead / onNavigate 对接消息服务。
56
- * 默认不定时轮询;有消息侧靠业务回调 / 路由 / 焦点再拉角标(真·SSE push 他窗)。
90
+ * 通用站内信铃铛:列表 / 已读 / Tab / 角标 / 卡片底栏动作 / 可选 SSE toast。
91
+ * 认领、去执行等业务动作由 `onItemAction` 注入;默认底栏按钮走 onNavigate / href。
92
+ * 默认不定时轮询;有消息侧靠业务回调 / 路由 / 焦点 / 可选 SSE 再拉角标。
57
93
  */
58
94
  declare const InboxBell: import('react').ForwardRefExoticComponent<InboxBellProps & import('react').RefAttributes<InboxBellHandle>>;
59
95
  export default InboxBell;
96
+ export { DEFAULT_INBOX_TOAST_PREFS, loadInboxToastPrefs, saveInboxToastPrefs, shouldToastForMessageType, } from './toastPrefs';
97
+ export type { InboxToastPrefs } from './toastPrefs';
98
+ export { resolveInboxItemActions, filterInboxActionsForHost, normalizeInboxActions, inboxSceneLabel, isInboxButtonDriven, isTerminalActionStatus, } from './inboxItemActions';
99
+ export type { InboxItemActionKind, InboxItemQuickAction, InboxItemActionsResolved, } from './inboxItemActions';
@@ -1,165 +1,286 @@
1
- import { jsxs as p, jsx as n } from "react/jsx-runtime";
2
- import { Badge as G, Button as V, Drawer as Y, Space as K, Tag as X, message as q } from "antd";
3
- import I from "classnames";
4
- import { forwardRef as J, useState as l, useRef as z, useCallback as H, useImperativeHandle as Q, useEffect as d, useMemo as Z } from "react";
5
- import { sanitizeInboxHtml as ee } from "../sanitizeInboxHtml.js";
6
- import { INBOX_BADGE_REFRESH_EVENT as M } from "../requestInboxBadgeRefresh.js";
7
- import r from "./style.module.scss.js";
8
- import { Bell as te } from "../../../Icons/Bell.js";
9
- import ne from "../../../StateBar/StateBar.js";
10
- import re from "../../../SegmentedRadio/SegmentedRadio.js";
11
- import ae from "../../../Layout/PageSpin/index.js";
12
- import se from "../../../Empty/Empty.js";
13
- const le = [
1
+ import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
+ import { Badge as Te, Button as B, Drawer as be, Space as ae, Checkbox as $, notification as oe, message as se } from "antd";
3
+ import j from "classnames";
4
+ import { forwardRef as we, useState as y, useRef as G, useCallback as ie, useImperativeHandle as Ne, useEffect as g, useMemo as Se } from "react";
5
+ import { sanitizeInboxHtml as Ee } from "../sanitizeInboxHtml.js";
6
+ import { INBOX_BADGE_REFRESH_EVENT as le } from "../requestInboxBadgeRefresh.js";
7
+ import { emphasizeQuoted as C } from "./emphasizeQuoted.js";
8
+ import { filterInboxActionsForHost as ke, resolveInboxItemActions as Le, isInboxButtonDriven as xe } from "./inboxItemActions.js";
9
+ import { inboxSceneLabel as it, isTerminalActionStatus as lt, normalizeInboxActions as ct } from "./inboxItemActions.js";
10
+ import { loadInboxToastPrefs as Be, shouldToastForMessageType as Ce, saveInboxToastPrefs as Pe } from "./toastPrefs.js";
11
+ import { DEFAULT_INBOX_TOAST_PREFS as mt } from "./toastPrefs.js";
12
+ import n from "./style.module.scss.js";
13
+ import { Bell as Ie } from "../../../Icons/Bell.js";
14
+ import Re from "../../../StateBar/StateBar.js";
15
+ import Ae from "../../../SegmentedRadio/SegmentedRadio.js";
16
+ import De from "../../../Layout/PageSpin/index.js";
17
+ import _e from "../../../Empty/Empty.js";
18
+ import P, { SEMANTIC_COLORS as S } from "../../../Tag/SemanticTag.js";
19
+ const Oe = [
14
20
  { key: "", label: "全部" },
15
21
  { key: "alert", label: "预警" },
16
22
  { key: "action", label: "行动" },
17
23
  { key: "remind", label: "提醒" }
18
- ], ie = {
24
+ ], ze = {
19
25
  alert: "预警",
20
26
  action: "行动",
21
27
  remind: "提醒"
22
- }, oe = 300;
23
- function de(T) {
24
- const s = String(T || "").trim().toLowerCase();
25
- return s ? ie[s] || s : "";
28
+ }, He = 300;
29
+ function ce(l) {
30
+ const r = String(l || "").trim().toLowerCase();
31
+ return r ? ze[r] || r : "";
26
32
  }
27
- const Ee = J(function({
28
- fetchInbox: s,
29
- markRead: P,
30
- onNavigate: E,
31
- pollMs: f = 0,
32
- locationKey: B,
33
- pageSize: N = 50,
34
- className: A,
35
- title: U = "站内信"
36
- }, D) {
37
- const [y, u] = l(!1), [S, L] = l(!1), [v, k] = l(""), [C, h] = l([]), [c, g] = l(0), [_, O] = l({}), [w, F] = l(""), [m, W] = l("all"), i = z(null), R = z(!1), x = H(async () => {
38
- L(!0), k("");
33
+ function K(l) {
34
+ const r = String(l || "").trim().toLowerCase();
35
+ return r === "alert" ? S.DANGER : r === "action" ? S.PRIMARY : r === "remind" ? S.WARNING : S.DEFAULT;
36
+ }
37
+ function Fe(l) {
38
+ return [l.factory, l.variety, l.metric].map((r) => String(r || "").trim()).filter(Boolean).join(" · ");
39
+ }
40
+ function Me(l) {
41
+ return String(l || "").trim() || S.DEFAULT;
42
+ }
43
+ function Ue(l) {
44
+ try {
45
+ const r = JSON.parse(l);
46
+ if (!r || typeof r != "object") return null;
47
+ const E = String(r.messageType || r.message_type || "").trim(), T = String(r.title || "").trim(), h = String(r.summary || "").trim();
48
+ return !E && !T && !h ? null : {
49
+ messageType: E || void 0,
50
+ title: T || void 0,
51
+ summary: h || void 0
52
+ };
53
+ } catch {
54
+ return null;
55
+ }
56
+ }
57
+ const at = we(function({
58
+ fetchInbox: r,
59
+ markRead: E,
60
+ onNavigate: T,
61
+ pollMs: h = 0,
62
+ locationKey: W,
63
+ pageSize: Y = 50,
64
+ className: de,
65
+ title: me = "站内信",
66
+ streamPath: I = "/api/v1/msg-center/inbox/stream",
67
+ getAccessToken: R,
68
+ onItemAction: A
69
+ }, ue) {
70
+ const [D, b] = y(!1), [Q, V] = y(!1), [_, X] = y(""), [J, O] = y([]), [w, z] = y(0), [q, Z] = y({}), [H, pe] = y(""), [k, fe] = y("all"), [N, ye] = y(() => Be()), v = G(null), ee = G(!1), te = G(N);
71
+ te.current = N;
72
+ const F = ie(async () => {
73
+ V(!0), X("");
39
74
  try {
40
- const e = await s({
75
+ const e = await r({
41
76
  currentPage: 1,
42
- pageSize: N,
43
- messageType: w || void 0,
44
- unreadOnly: m === "unread" || void 0,
45
- readOnly: m === "read" || void 0
77
+ pageSize: Y,
78
+ messageType: H || void 0,
79
+ unreadOnly: k === "unread" || void 0,
80
+ readOnly: k === "read" || void 0
46
81
  });
47
- h((e == null ? void 0 : e.itemList) || []), g(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), O((e == null ? void 0 : e.unreadByMessageType) || {});
82
+ O((e == null ? void 0 : e.itemList) || []), z(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), Z((e == null ? void 0 : e.unreadByMessageType) || {});
48
83
  } catch (e) {
49
- h([]), k(e instanceof Error ? e.message : String(e));
84
+ O([]), X(e instanceof Error ? e.message : String(e));
50
85
  } finally {
51
- L(!1);
86
+ V(!1);
52
87
  }
53
- }, [s, w, N, m]), a = H(async () => {
88
+ }, [r, H, Y, k]), i = ie(async () => {
54
89
  try {
55
- const e = await s({ currentPage: 1, pageSize: 1 });
56
- g(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), O((e == null ? void 0 : e.unreadByMessageType) || {});
90
+ const e = await r({ currentPage: 1, pageSize: 1 });
91
+ z(typeof (e == null ? void 0 : e.unreadTotal) == "number" ? e.unreadTotal : 0), Z((e == null ? void 0 : e.unreadByMessageType) || {});
57
92
  } catch {
58
93
  }
59
- }, [s]);
60
- Q(D, () => ({ refreshBadge: a }), [a]), d(() => {
61
- a();
62
- }, [a]), d(() => {
63
- if (B !== void 0) {
64
- if (!R.current) {
65
- R.current = !0;
94
+ }, [r]);
95
+ Ne(ue, () => ({ refreshBadge: i }), [i]), g(() => {
96
+ i();
97
+ }, [i]), g(() => {
98
+ if (W !== void 0) {
99
+ if (!ee.current) {
100
+ ee.current = !0;
66
101
  return;
67
102
  }
68
- a();
103
+ i();
69
104
  }
70
- }, [B, a]), d(() => {
71
- if (f <= 0) return;
105
+ }, [W, i]), g(() => {
106
+ if (h <= 0) return;
72
107
  const e = window.setInterval(() => {
73
- a();
74
- }, f);
108
+ i();
109
+ }, h);
75
110
  return () => window.clearInterval(e);
76
- }, [f, a]), d(() => {
111
+ }, [h, i]), g(() => {
77
112
  const e = () => {
78
- i.current != null && window.clearTimeout(i.current), i.current = window.setTimeout(() => {
79
- i.current = null, a();
80
- }, oe);
81
- }, t = () => {
113
+ v.current != null && window.clearTimeout(v.current), v.current = window.setTimeout(() => {
114
+ v.current = null, i();
115
+ }, He);
116
+ }, s = () => {
82
117
  document.visibilityState === "visible" && e();
83
118
  };
84
- return window.addEventListener("focus", e), document.addEventListener("visibilitychange", t), () => {
85
- window.removeEventListener("focus", e), document.removeEventListener("visibilitychange", t), i.current != null && (window.clearTimeout(i.current), i.current = null);
119
+ return window.addEventListener("focus", e), document.addEventListener("visibilitychange", s), () => {
120
+ window.removeEventListener("focus", e), document.removeEventListener("visibilitychange", s), v.current != null && (window.clearTimeout(v.current), v.current = null);
86
121
  };
87
- }, [a]), d(() => {
122
+ }, [i]), g(() => {
88
123
  const e = () => {
89
- a();
124
+ i();
125
+ };
126
+ return window.addEventListener(le, e), () => window.removeEventListener(le, e);
127
+ }, [i]), g(() => {
128
+ if (I === !1 || typeof R != "function" || typeof window > "u" || typeof EventSource > "u") return;
129
+ const e = String(R() || "").trim();
130
+ if (!e) return;
131
+ const s = String(I || "/api/v1/msg-center/inbox/stream").trim(), o = new URL(s, window.location.origin);
132
+ o.searchParams.set("access_token", e);
133
+ let a;
134
+ try {
135
+ a = new EventSource(o.toString());
136
+ } catch {
137
+ return;
138
+ }
139
+ const c = (f) => {
140
+ i();
141
+ const u = f, d = typeof (u == null ? void 0 : u.data) == "string" ? Ue(u.data) : null;
142
+ if (!d || !Ce(te.current, d.messageType)) return;
143
+ const L = d.title || "新站内信", p = d.summary || "", x = ce(d.messageType), re = () => {
144
+ oe.destroy(), b(!0);
145
+ }, ge = `inbox-badge-${d.messageType || "msg"}-${Date.now()}`;
146
+ oe.open({
147
+ key: ge,
148
+ className: j("marsun-inbox-toast", n.toastNotice),
149
+ closable: !0,
150
+ title: /* @__PURE__ */ m("div", { className: n.toastHead, children: [
151
+ /* @__PURE__ */ t("span", { className: n.toastTitle, children: C(L) }),
152
+ x ? /* @__PURE__ */ t(
153
+ P,
154
+ {
155
+ color: K(d.messageType),
156
+ className: n.typeTag,
157
+ children: x
158
+ }
159
+ ) : null
160
+ ] }),
161
+ message: /* @__PURE__ */ m("div", { className: n.toastHead, children: [
162
+ /* @__PURE__ */ t("span", { className: n.toastTitle, children: C(L) }),
163
+ x ? /* @__PURE__ */ t(
164
+ P,
165
+ {
166
+ color: K(d.messageType),
167
+ className: n.typeTag,
168
+ children: x
169
+ }
170
+ ) : null
171
+ ] }),
172
+ description: /* @__PURE__ */ m("div", { className: n.toastBody, children: [
173
+ p ? /* @__PURE__ */ t("div", { className: n.toastDesc, children: C(p) }) : null,
174
+ /* @__PURE__ */ t("div", { className: n.toastActions, children: /* @__PURE__ */ t(
175
+ B,
176
+ {
177
+ type: "primary",
178
+ size: "small",
179
+ onClick: (he) => {
180
+ he.stopPropagation(), re();
181
+ },
182
+ children: "查看"
183
+ }
184
+ ) })
185
+ ] }),
186
+ placement: "topRight",
187
+ duration: 6,
188
+ onClick: re
189
+ });
190
+ };
191
+ return a.addEventListener("badge", c), a.addEventListener("inbox", c), a.onerror = () => {
192
+ a.close();
193
+ }, () => {
194
+ a.removeEventListener("badge", c), a.removeEventListener("inbox", c), a.close();
90
195
  };
91
- return window.addEventListener(M, e), () => window.removeEventListener(M, e);
92
- }, [a]), d(() => {
93
- y && x();
94
- }, [y, x]);
95
- const $ = Z(
96
- () => le.map((e) => {
97
- const t = e.key ? _[e.key] || 0 : c;
196
+ }, [I, R, i]), g(() => {
197
+ D && F();
198
+ }, [D, F]);
199
+ const ve = Se(
200
+ () => Oe.map((e) => {
201
+ const s = e.key ? q[e.key] || 0 : w;
98
202
  return {
99
203
  key: e.key || "all",
100
- label: t > 0 ? `${e.label} (${t})` : e.label
204
+ label: s > 0 ? `${e.label} (${s})` : e.label
101
205
  };
102
206
  }),
103
- [_, c]
104
- ), j = async (e) => {
207
+ [q, w]
208
+ ), M = (e, s) => {
209
+ ye((o) => {
210
+ const a = { ...o, [e]: s };
211
+ return Pe(a), a;
212
+ });
213
+ }, U = async (e, s) => {
105
214
  if (!e.read)
106
215
  try {
107
- await P(e.id), h((o) => o.map((b) => b.id === e.id ? { ...b, read: !0 } : b)), g((o) => Math.max(0, o - 1));
108
- } catch (o) {
109
- q.error(o instanceof Error ? o.message : "标记已读失败");
216
+ await E(e.id), O((a) => a.map((c) => c.id === e.id ? { ...c, read: !0 } : c)), z((a) => Math.max(0, a - 1));
217
+ } catch (a) {
218
+ se.error(a instanceof Error ? a.message : "标记已读失败");
110
219
  return;
111
220
  }
112
- const t = String(e.href || "").trim();
113
- if (t) {
114
- if (E) {
115
- E(t, e), u(!1);
221
+ const o = String(e.href || "").trim();
222
+ if (o) {
223
+ if (T) {
224
+ T(o, e), b(!1);
225
+ return;
226
+ }
227
+ o.startsWith("http://") || o.startsWith("https://") ? window.open(o, "_blank", "noopener,noreferrer") : window.location.assign(o), b(!1);
228
+ }
229
+ }, ne = async (e, s) => {
230
+ if (!s.disabled) {
231
+ if (A) {
232
+ try {
233
+ await A(s.kind, e), F(), i();
234
+ } catch (o) {
235
+ se.error(o instanceof Error ? o.message : "操作失败");
236
+ }
116
237
  return;
117
238
  }
118
- t.startsWith("http://") || t.startsWith("https://") ? window.open(t, "_blank", "noopener,noreferrer") : window.location.assign(t), u(!1);
239
+ await U(e);
119
240
  }
120
241
  };
121
- return /* @__PURE__ */ p("div", { className: I(r.bellWrap, A), children: [
122
- /* @__PURE__ */ n(G, { count: c, size: "small", overflowCount: 99, offset: [-4, 4], children: /* @__PURE__ */ n(
123
- V,
242
+ return /* @__PURE__ */ m("div", { className: j(n.bellWrap, de), children: [
243
+ /* @__PURE__ */ t(Te, { count: w, size: "small", overflowCount: 99, offset: [-4, 4], children: /* @__PURE__ */ t(
244
+ B,
124
245
  {
125
246
  type: "text",
126
- className: r.bellBtn,
127
- icon: /* @__PURE__ */ n(te, { size: 16, "aria-hidden": !0 }),
128
- "aria-label": c > 0 ? `站内信,${c} 条未读` : "站内信",
129
- onClick: () => u(!0)
247
+ className: n.bellBtn,
248
+ icon: /* @__PURE__ */ t(Ie, { size: 16, "aria-hidden": !0 }),
249
+ "aria-label": w > 0 ? `站内信,${w} 条未读` : "站内信",
250
+ onClick: () => b(!0)
130
251
  }
131
252
  ) }),
132
- /* @__PURE__ */ p(
133
- Y,
253
+ /* @__PURE__ */ m(
254
+ be,
134
255
  {
135
- title: U,
136
- open: y,
137
- onClose: () => u(!1),
256
+ title: me,
257
+ open: D,
258
+ onClose: () => b(!1),
138
259
  size: 420,
139
260
  destroyOnClose: !1,
140
- className: r.drawer,
261
+ className: n.drawer,
141
262
  styles: {
142
263
  header: { padding: "12px 16px" },
143
264
  body: { padding: "12px 16px" }
144
265
  },
145
266
  children: [
146
- /* @__PURE__ */ n(
147
- ne,
267
+ /* @__PURE__ */ t(
268
+ Re,
148
269
  {
149
- className: r.typeTabs,
270
+ className: n.typeTabs,
150
271
  size: "small",
151
- activeKey: w || "all",
152
- onChange: (e) => F(e === "all" ? "" : e),
153
- stateOption: $,
272
+ activeKey: H || "all",
273
+ onChange: (e) => pe(e === "all" ? "" : e),
274
+ stateOption: ve,
154
275
  isInner: !0
155
276
  }
156
277
  ),
157
- /* @__PURE__ */ n("div", { className: r.filterRow, children: /* @__PURE__ */ n(
158
- re,
278
+ /* @__PURE__ */ t("div", { className: n.filterRow, children: /* @__PURE__ */ t(
279
+ Ae,
159
280
  {
160
281
  size: "small",
161
- value: m,
162
- onChange: (e) => W(e),
282
+ value: k,
283
+ onChange: (e) => fe(e),
163
284
  options: [
164
285
  { value: "all", label: "全部" },
165
286
  { value: "unread", label: "未读" },
@@ -167,41 +288,135 @@ const Ee = J(function({
167
288
  ]
168
289
  }
169
290
  ) }),
170
- v ? /* @__PURE__ */ n("p", { className: r.error, children: v }) : null,
171
- /* @__PURE__ */ n(ae, { spinning: S, children: !S && !v && C.length === 0 ? /* @__PURE__ */ n(se, { description: "暂无站内信" }) : /* @__PURE__ */ n("ul", { className: r.list, children: C.map((e) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
172
- "button",
173
- {
174
- type: "button",
175
- className: I(r.item, !e.read && r.itemUnread),
176
- onClick: () => void j(e),
177
- children: /* @__PURE__ */ p(K, { orientation: "vertical", size: 2, style: { width: "100%" }, children: [
178
- /* @__PURE__ */ n("span", { className: r.itemTitle, children: e.title || "(无标题)" }),
179
- (() => {
180
- const t = ee(e.bodyHtml);
181
- return t ? /* @__PURE__ */ n(
291
+ /* @__PURE__ */ m("div", { className: n.toastPrefs, "data-testid": "inbox-toast-prefs", children: [
292
+ /* @__PURE__ */ t("div", { className: n.toastPrefsTitle, children: "消息提示" }),
293
+ /* @__PURE__ */ t("p", { className: n.toastPrefsHint, children: "本机浏览器偏好,非租户策略" }),
294
+ /* @__PURE__ */ m(ae, { size: 12, wrap: !0, children: [
295
+ /* @__PURE__ */ t(
296
+ $,
297
+ {
298
+ checked: N.alert,
299
+ onChange: (e) => M("alert", e.target.checked),
300
+ children: "预警弹出"
301
+ }
302
+ ),
303
+ /* @__PURE__ */ t(
304
+ $,
305
+ {
306
+ checked: N.action,
307
+ onChange: (e) => M("action", e.target.checked),
308
+ children: "行动弹出"
309
+ }
310
+ ),
311
+ /* @__PURE__ */ t(
312
+ $,
313
+ {
314
+ checked: N.remind,
315
+ onChange: (e) => M("remind", e.target.checked),
316
+ children: "提醒弹出"
317
+ }
318
+ )
319
+ ] })
320
+ ] }),
321
+ _ ? /* @__PURE__ */ t("p", { className: n.error, children: _ }) : null,
322
+ /* @__PURE__ */ t(De, { spinning: Q, children: !Q && !_ && J.length === 0 ? /* @__PURE__ */ t(_e, { description: "暂无站内信" }) : /* @__PURE__ */ t("ul", { className: n.list, children: J.map((e) => {
323
+ const s = ce(e.messageType), o = String(e.levelLabel || e.level || "").trim(), a = !!o, c = Ee(e.bodyHtml), f = ke(
324
+ Le(e),
325
+ !!A
326
+ ), u = xe(e), d = Fe(e), L = !!f.primary;
327
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ m(
328
+ "div",
329
+ {
330
+ className: j(
331
+ n.item,
332
+ !e.read && n.itemUnread,
333
+ u && n.itemStatic
334
+ ),
335
+ role: u ? void 0 : "button",
336
+ tabIndex: u ? void 0 : 0,
337
+ onClick: u ? void 0 : () => void U(e),
338
+ onKeyDown: u ? void 0 : (p) => {
339
+ (p.key === "Enter" || p.key === " ") && (p.preventDefault(), U(e));
340
+ },
341
+ children: [
342
+ /* @__PURE__ */ m("div", { className: n.itemHeader, children: [
343
+ /* @__PURE__ */ m("span", { className: n.itemHeaderLeft, children: [
344
+ /* @__PURE__ */ t("span", { className: n.itemTitle, title: e.title || "(无标题)", children: e.title || "(无标题)" }),
345
+ s ? /* @__PURE__ */ t(
346
+ P,
347
+ {
348
+ color: K(e.messageType),
349
+ className: n.typeTag,
350
+ children: s
351
+ }
352
+ ) : null
353
+ ] }),
354
+ /* @__PURE__ */ t("span", { className: n.itemTime, children: e.createdAt || "" })
355
+ ] }),
356
+ /* @__PURE__ */ t("div", { className: n.itemBody, children: c ? /* @__PURE__ */ t(
182
357
  "div",
183
358
  {
184
- className: r.itemBodyHtml,
185
- dangerouslySetInnerHTML: { __html: t }
359
+ className: n.itemBodyHtml,
360
+ dangerouslySetInnerHTML: { __html: c }
186
361
  }
187
- ) : e.summary ? /* @__PURE__ */ n("span", { className: r.itemSummary, children: e.summary }) : null;
188
- })(),
189
- (() => {
190
- const t = de(e.messageType);
191
- return /* @__PURE__ */ p("span", { className: r.itemMeta, children: [
192
- t ? /* @__PURE__ */ n(X, { className: r.typeTag, children: t }) : null,
193
- e.createdAt || (t ? "" : "—")
194
- ] });
195
- })()
196
- ] })
197
- }
198
- ) }, e.id)) }) })
362
+ ) : e.summary ? /* @__PURE__ */ t("span", { className: n.itemSummary, children: C(e.summary) }) : null }),
363
+ d ? /* @__PURE__ */ t("span", { className: n.itemMeta, children: d }) : null,
364
+ a ? /* @__PURE__ */ t("div", { className: n.itemFooterTags, children: /* @__PURE__ */ t(
365
+ P,
366
+ {
367
+ color: Me(e.levelColor),
368
+ className: n.typeTag,
369
+ children: o
370
+ }
371
+ ) }) : null,
372
+ L && f.primary ? /* @__PURE__ */ t(
373
+ "div",
374
+ {
375
+ className: n.itemActions,
376
+ onClick: (p) => p.stopPropagation(),
377
+ onKeyDown: (p) => p.stopPropagation(),
378
+ children: /* @__PURE__ */ m(ae, { size: 8, wrap: !0, children: [
379
+ /* @__PURE__ */ t(
380
+ B,
381
+ {
382
+ size: "small",
383
+ type: "primary",
384
+ onClick: () => void ne(e, f.primary),
385
+ children: f.primary.label
386
+ }
387
+ ),
388
+ f.secondary ? /* @__PURE__ */ t(
389
+ B,
390
+ {
391
+ size: "small",
392
+ type: "link",
393
+ onClick: () => void ne(e, f.secondary),
394
+ children: f.secondary.label
395
+ }
396
+ ) : null
397
+ ] })
398
+ }
399
+ ) : null
400
+ ]
401
+ }
402
+ ) }, e.id);
403
+ }) }) })
199
404
  ]
200
405
  }
201
406
  )
202
407
  ] });
203
408
  });
204
409
  export {
205
- Ee as default
410
+ mt as DEFAULT_INBOX_TOAST_PREFS,
411
+ at as default,
412
+ ke as filterInboxActionsForHost,
413
+ it as inboxSceneLabel,
414
+ xe as isInboxButtonDriven,
415
+ lt as isTerminalActionStatus,
416
+ Be as loadInboxToastPrefs,
417
+ ct as normalizeInboxActions,
418
+ Le as resolveInboxItemActions,
419
+ Pe as saveInboxToastPrefs,
420
+ Ce as shouldToastForMessageType
206
421
  };
207
422
  //# sourceMappingURL=InboxBell.js.map