@hkyhy/marsun-components-core 0.1.100 → 0.1.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Editor/VariablePicker.js +13 -13
- package/dist/components/Editor/VariablePicker.js.map +1 -1
- package/dist/components/FormInfo/RichTextField/index.js +46 -69
- package/dist/components/FormInfo/RichTextField/index.js.map +1 -1
- package/dist/components/FormInfo/VariableMentionInput/index.d.ts +1 -0
- package/dist/components/FormInfo/VariableMentionInput/index.js +53 -47
- package/dist/components/FormInfo/VariableMentionInput/index.js.map +1 -1
- package/dist/components/FormInfo/VariableMentionInput/style.module.scss.js +6 -5
- package/dist/components/FormInfo/VariableMentionInput/style.module.scss.js.map +1 -1
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.d.ts +3 -0
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js +59 -49
- package/dist/components/Tools/Inbox/InboxBell/InboxBell.js.map +1 -1
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js +20 -18
- package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js.map +1 -1
- package/dist/components/Tools/Inbox/index.d.ts +1 -0
- package/dist/components/Tools/Inbox/sanitizeInboxHtml.d.ts +5 -0
- package/dist/components/Tools/Inbox/sanitizeInboxHtml.js +14 -0
- package/dist/components/Tools/Inbox/sanitizeInboxHtml.js.map +1 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.d.ts +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.js +3 -3
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.js +160 -145
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js +100 -99
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/PushRulesPanel/index.d.ts +2 -2
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/PushRulesPanel/index.js +140 -129
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/PushRulesPanel/index.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/VariablesPanel/index.d.ts +2 -2
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/VariablesPanel/index.js +78 -78
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/VariablesPanel/index.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/index.d.ts +2 -2
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.d.ts +26 -0
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.js +47 -19
- package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.js.map +1 -1
- package/dist/components/Tools/MessageCenter/MsgCenterAppSwitcher/MsgCenterAppSwitcher.d.ts +22 -0
- package/dist/components/Tools/MessageCenter/MsgCenterAppSwitcher/MsgCenterAppSwitcher.js +64 -0
- package/dist/components/Tools/MessageCenter/MsgCenterAppSwitcher/MsgCenterAppSwitcher.js.map +1 -0
- package/dist/components/Tools/MessageCenter/MsgCenterAppSwitcher/index.d.ts +2 -0
- package/dist/components/Tools/MessageCenter/index.d.ts +7 -1
- package/dist/components/Tools/MessageCenter/msgCenterAppSwitch.d.ts +39 -0
- package/dist/components/Tools/MessageCenter/msgCenterAppSwitch.js +94 -0
- package/dist/components/Tools/MessageCenter/msgCenterAppSwitch.js.map +1 -0
- package/dist/components/Tools/MessageCenter/useMsgCenterAppKey.d.ts +2 -0
- package/dist/components/Tools/MessageCenter/useMsgCenterAppKey.js +18 -0
- package/dist/components/Tools/MessageCenter/useMsgCenterAppKey.js.map +1 -0
- package/dist/components/Tools/index.d.ts +3 -2
- package/dist/index.js +653 -636
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/node_modules/dompurify/dist/purify.es.js +908 -0
- package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -0
- package/dist/node_modules/isomorphic-dompurify/dist/browser.js +17 -0
- package/dist/node_modules/isomorphic-dompurify/dist/browser.js.map +1 -0
- package/dist/styles/global.css +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 消息中心运行时 appKey 切换(Phase B)。
|
|
3
|
+
* Hub 写入;各业务 App 铃铛/Admin 读取。跨页签用 sessionStorage + storage 事件。
|
|
4
|
+
* 禁 Hub=全 Agent;仅 catalog 可切换对。
|
|
5
|
+
*/
|
|
6
|
+
export declare const MSG_CENTER_APP_SWITCH_STORAGE_KEY = "marsun.msgCenter.currentAppKey";
|
|
7
|
+
/** SystemApp.code → mc catalog appKey(非中文表;仅 Quality 例外) */
|
|
8
|
+
export declare const SYSTEM_APP_TO_MSG_CENTER_APP_KEY: Readonly<Record<string, string>>;
|
|
9
|
+
/** 本期允许出现在切换器中的 mc appKey */
|
|
10
|
+
export declare const MSG_CENTER_SWITCHABLE_APP_KEYS: readonly ["equipment-agent", "s3-quality"];
|
|
11
|
+
export type MsgCenterSwitchableAppKey = (typeof MSG_CENTER_SWITCHABLE_APP_KEYS)[number];
|
|
12
|
+
export type MsgCenterAppSwitchState = {
|
|
13
|
+
currentAppKey: string;
|
|
14
|
+
currentSystemAppCode: string;
|
|
15
|
+
currentSystemAppName: string;
|
|
16
|
+
};
|
|
17
|
+
export type MsgCenterSwitchableApp = {
|
|
18
|
+
appKey: string;
|
|
19
|
+
systemAppCode: string;
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
type Listener = (appKey: string) => void;
|
|
23
|
+
/** 从 SystemApp.code 解析 mc appKey;未知则原样返回(调用方须再过滤) */
|
|
24
|
+
export declare function msgCenterAppKeyFromSystemAppCode(systemAppCode: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* 仅保留本期可切换且用户有权进入的项(禁全量 Agent)。
|
|
27
|
+
* `apps` 须已是「有权进入」子集(由 Hub 用 EP 过滤后再传入)。
|
|
28
|
+
*/
|
|
29
|
+
export declare function filterMsgCenterSwitchableApps(apps: Array<{
|
|
30
|
+
code: string;
|
|
31
|
+
name: string;
|
|
32
|
+
}>): MsgCenterSwitchableApp[];
|
|
33
|
+
export declare function getMsgCenterAppKey(fallbackAppKey: string): string;
|
|
34
|
+
export declare function setMsgCenterAppKey(appKey: string, allowed?: readonly string[]): void;
|
|
35
|
+
export declare function subscribeMsgCenterAppKey(listener: Listener): () => void;
|
|
36
|
+
/** 浏览器多页签:storage 事件(仅跨 tab;同页靠 subscribe) */
|
|
37
|
+
export declare function bindMsgCenterAppKeyStorageSync(): () => void;
|
|
38
|
+
export declare function resolveMsgCenterSwitchState(apps: MsgCenterSwitchableApp[], fallbackAppKey: string): MsgCenterAppSwitchState;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const c = "marsun.msgCenter.currentAppKey", S = {
|
|
2
|
+
"equipment-agent": "equipment-agent",
|
|
3
|
+
"s3-agent": "s3-quality"
|
|
4
|
+
}, g = ["equipment-agent", "s3-quality"], u = /* @__PURE__ */ new Set();
|
|
5
|
+
function m() {
|
|
6
|
+
if (typeof sessionStorage > "u") return "";
|
|
7
|
+
try {
|
|
8
|
+
return String(sessionStorage.getItem(c) || "").trim();
|
|
9
|
+
} catch {
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function y(t) {
|
|
14
|
+
if (!(typeof sessionStorage > "u"))
|
|
15
|
+
try {
|
|
16
|
+
sessionStorage.setItem(c, t);
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function p(t) {
|
|
21
|
+
u.forEach((e) => {
|
|
22
|
+
try {
|
|
23
|
+
e(t);
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function a(t) {
|
|
29
|
+
const e = String(t || "").trim();
|
|
30
|
+
return e ? S[e] || e : "";
|
|
31
|
+
}
|
|
32
|
+
function f(t) {
|
|
33
|
+
const e = [], o = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const r of t) {
|
|
35
|
+
const n = String((r == null ? void 0 : r.code) || "").trim(), i = String((r == null ? void 0 : r.name) || "").trim() || n;
|
|
36
|
+
if (!n) continue;
|
|
37
|
+
const s = a(n);
|
|
38
|
+
g.includes(s) && (o.has(s) || (o.add(s), e.push({ appKey: s, systemAppCode: n, name: i })));
|
|
39
|
+
}
|
|
40
|
+
return e;
|
|
41
|
+
}
|
|
42
|
+
function d(t) {
|
|
43
|
+
const e = m();
|
|
44
|
+
return e || String(t || "").trim();
|
|
45
|
+
}
|
|
46
|
+
function A(t, e) {
|
|
47
|
+
const o = String(t || "").trim();
|
|
48
|
+
if (o) {
|
|
49
|
+
if (e && e.length > 0 && !e.includes(o))
|
|
50
|
+
throw new Error(`appKey 不在可切换列表:${o}`);
|
|
51
|
+
y(o), p(o);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function C(t) {
|
|
55
|
+
return u.add(t), () => {
|
|
56
|
+
u.delete(t);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function E() {
|
|
60
|
+
if (typeof window > "u") return () => {
|
|
61
|
+
};
|
|
62
|
+
const t = (e) => {
|
|
63
|
+
e.storageArea === sessionStorage && e.key === c && p(String(e.newValue || "").trim());
|
|
64
|
+
};
|
|
65
|
+
return window.addEventListener("storage", t), () => window.removeEventListener("storage", t);
|
|
66
|
+
}
|
|
67
|
+
function _(t, e) {
|
|
68
|
+
const o = d(e), r = t.find((i) => i.appKey === o);
|
|
69
|
+
if (r)
|
|
70
|
+
return {
|
|
71
|
+
currentAppKey: r.appKey,
|
|
72
|
+
currentSystemAppCode: r.systemAppCode,
|
|
73
|
+
currentSystemAppName: r.name
|
|
74
|
+
};
|
|
75
|
+
const n = t.find((i) => i.appKey === e) || t[0];
|
|
76
|
+
return {
|
|
77
|
+
currentAppKey: (n == null ? void 0 : n.appKey) || e,
|
|
78
|
+
currentSystemAppCode: (n == null ? void 0 : n.systemAppCode) || e,
|
|
79
|
+
currentSystemAppName: (n == null ? void 0 : n.name) || e
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
c as MSG_CENTER_APP_SWITCH_STORAGE_KEY,
|
|
84
|
+
g as MSG_CENTER_SWITCHABLE_APP_KEYS,
|
|
85
|
+
S as SYSTEM_APP_TO_MSG_CENTER_APP_KEY,
|
|
86
|
+
E as bindMsgCenterAppKeyStorageSync,
|
|
87
|
+
f as filterMsgCenterSwitchableApps,
|
|
88
|
+
d as getMsgCenterAppKey,
|
|
89
|
+
a as msgCenterAppKeyFromSystemAppCode,
|
|
90
|
+
_ as resolveMsgCenterSwitchState,
|
|
91
|
+
A as setMsgCenterAppKey,
|
|
92
|
+
C as subscribeMsgCenterAppKey
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=msgCenterAppSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msgCenterAppSwitch.js","sources":["../../../../src/components/Tools/MessageCenter/msgCenterAppSwitch.ts"],"sourcesContent":["/**\n * 消息中心运行时 appKey 切换(Phase B)。\n * Hub 写入;各业务 App 铃铛/Admin 读取。跨页签用 sessionStorage + storage 事件。\n * 禁 Hub=全 Agent;仅 catalog 可切换对。\n */\n\nexport const MSG_CENTER_APP_SWITCH_STORAGE_KEY = 'marsun.msgCenter.currentAppKey';\n\n/** SystemApp.code → mc catalog appKey(非中文表;仅 Quality 例外) */\nexport const SYSTEM_APP_TO_MSG_CENTER_APP_KEY: Readonly<Record<string, string>> = {\n 'equipment-agent': 'equipment-agent',\n 's3-agent': 's3-quality',\n};\n\n/** 本期允许出现在切换器中的 mc appKey */\nexport const MSG_CENTER_SWITCHABLE_APP_KEYS = ['equipment-agent', 's3-quality'] as const;\n\nexport type MsgCenterSwitchableAppKey = (typeof MSG_CENTER_SWITCHABLE_APP_KEYS)[number];\n\nexport type MsgCenterAppSwitchState = {\n currentAppKey: string;\n currentSystemAppCode: string;\n currentSystemAppName: string;\n};\n\nexport type MsgCenterSwitchableApp = {\n appKey: string;\n systemAppCode: string;\n name: string;\n};\n\ntype Listener = (appKey: string) => void;\n\nconst listeners = new Set<Listener>();\n\nfunction readStorage(): string {\n if (typeof sessionStorage === 'undefined') return '';\n try {\n return String(sessionStorage.getItem(MSG_CENTER_APP_SWITCH_STORAGE_KEY) || '').trim();\n } catch {\n return '';\n }\n}\n\nfunction writeStorage(appKey: string): void {\n if (typeof sessionStorage === 'undefined') return;\n try {\n sessionStorage.setItem(MSG_CENTER_APP_SWITCH_STORAGE_KEY, appKey);\n } catch {\n /* ignore quota */\n }\n}\n\nfunction notify(appKey: string): void {\n listeners.forEach((fn) => {\n try {\n fn(appKey);\n } catch {\n /* listener error 不阻断 */\n }\n });\n}\n\n/** 从 SystemApp.code 解析 mc appKey;未知则原样返回(调用方须再过滤) */\nexport function msgCenterAppKeyFromSystemAppCode(systemAppCode: string): string {\n const code = String(systemAppCode || '').trim();\n if (!code) return '';\n return SYSTEM_APP_TO_MSG_CENTER_APP_KEY[code] || code;\n}\n\n/**\n * 仅保留本期可切换且用户有权进入的项(禁全量 Agent)。\n * `apps` 须已是「有权进入」子集(由 Hub 用 EP 过滤后再传入)。\n */\nexport function filterMsgCenterSwitchableApps(\n apps: Array<{ code: string; name: string }>,\n): MsgCenterSwitchableApp[] {\n const out: MsgCenterSwitchableApp[] = [];\n const seen = new Set<string>();\n for (const raw of apps) {\n const systemAppCode = String(raw?.code || '').trim();\n const name = String(raw?.name || '').trim() || systemAppCode;\n if (!systemAppCode) continue;\n const appKey = msgCenterAppKeyFromSystemAppCode(systemAppCode);\n if (!(MSG_CENTER_SWITCHABLE_APP_KEYS as readonly string[]).includes(appKey)) continue;\n if (seen.has(appKey)) continue;\n seen.add(appKey);\n out.push({ appKey, systemAppCode, name });\n }\n return out;\n}\n\nexport function getMsgCenterAppKey(fallbackAppKey: string): string {\n const fromStore = readStorage();\n if (fromStore) return fromStore;\n return String(fallbackAppKey || '').trim();\n}\n\nexport function setMsgCenterAppKey(appKey: string, allowed?: readonly string[]): void {\n const next = String(appKey || '').trim();\n if (!next) return;\n if (allowed && allowed.length > 0 && !allowed.includes(next)) {\n throw new Error(`appKey 不在可切换列表:${next}`);\n }\n writeStorage(next);\n notify(next);\n}\n\nexport function subscribeMsgCenterAppKey(listener: Listener): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\n/** 浏览器多页签:storage 事件(仅跨 tab;同页靠 subscribe) */\nexport function bindMsgCenterAppKeyStorageSync(): () => void {\n if (typeof window === 'undefined') return () => undefined;\n const onStorage = (ev: StorageEvent) => {\n if (ev.storageArea !== sessionStorage) return;\n if (ev.key !== MSG_CENTER_APP_SWITCH_STORAGE_KEY) return;\n notify(String(ev.newValue || '').trim());\n };\n window.addEventListener('storage', onStorage);\n return () => window.removeEventListener('storage', onStorage);\n}\n\nexport function resolveMsgCenterSwitchState(\n apps: MsgCenterSwitchableApp[],\n fallbackAppKey: string,\n): MsgCenterAppSwitchState {\n const currentAppKey = getMsgCenterAppKey(fallbackAppKey);\n const hit = apps.find((a) => a.appKey === currentAppKey);\n if (hit) {\n return {\n currentAppKey: hit.appKey,\n currentSystemAppCode: hit.systemAppCode,\n currentSystemAppName: hit.name,\n };\n }\n const fb = apps.find((a) => a.appKey === fallbackAppKey) || apps[0];\n return {\n currentAppKey: fb?.appKey || fallbackAppKey,\n currentSystemAppCode: fb?.systemAppCode || fallbackAppKey,\n currentSystemAppName: fb?.name || fallbackAppKey,\n };\n}\n"],"names":["MSG_CENTER_APP_SWITCH_STORAGE_KEY","SYSTEM_APP_TO_MSG_CENTER_APP_KEY","MSG_CENTER_SWITCHABLE_APP_KEYS","listeners","readStorage","writeStorage","appKey","notify","fn","msgCenterAppKeyFromSystemAppCode","systemAppCode","code","filterMsgCenterSwitchableApps","apps","out","seen","raw","name","getMsgCenterAppKey","fallbackAppKey","fromStore","setMsgCenterAppKey","allowed","next","subscribeMsgCenterAppKey","listener","bindMsgCenterAppKeyStorageSync","onStorage","ev","resolveMsgCenterSwitchState","currentAppKey","hit","a","fb"],"mappings":"AAMO,MAAMA,IAAoC,kCAGpCC,IAAqE;AAAA,EAChF,mBAAmB;AAAA,EACnB,YAAY;AACd,GAGaC,IAAiC,CAAC,mBAAmB,YAAY,GAkBxEC,wBAAgB,IAAA;AAEtB,SAASC,IAAsB;AAC7B,MAAI,OAAO,iBAAmB,IAAa,QAAO;AAClD,MAAI;AACF,WAAO,OAAO,eAAe,QAAQJ,CAAiC,KAAK,EAAE,EAAE,KAAA;AAAA,EACjF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAASK,EAAaC,GAAsB;AAC1C,MAAI,SAAO,iBAAmB;AAC9B,QAAI;AACF,qBAAe,QAAQN,GAAmCM,CAAM;AAAA,IAClE,QAAQ;AAAA,IAER;AACF;AAEA,SAASC,EAAOD,GAAsB;AACpC,EAAAH,EAAU,QAAQ,CAACK,MAAO;AACxB,QAAI;AACF,MAAAA,EAAGF,CAAM;AAAA,IACX,QAAQ;AAAA,IAER;AAAA,EACF,CAAC;AACH;AAGO,SAASG,EAAiCC,GAA+B;AAC9E,QAAMC,IAAO,OAAOD,KAAiB,EAAE,EAAE,KAAA;AACzC,SAAKC,IACEV,EAAiCU,CAAI,KAAKA,IAD/B;AAEpB;AAMO,SAASC,EACdC,GAC0B;AAC1B,QAAMC,IAAgC,CAAA,GAChCC,wBAAW,IAAA;AACjB,aAAWC,KAAOH,GAAM;AACtB,UAAMH,IAAgB,QAAOM,KAAA,gBAAAA,EAAK,SAAQ,EAAE,EAAE,KAAA,GACxCC,IAAO,QAAOD,KAAA,gBAAAA,EAAK,SAAQ,EAAE,EAAE,UAAUN;AAC/C,QAAI,CAACA,EAAe;AACpB,UAAMJ,IAASG,EAAiCC,CAAa;AAC7D,IAAMR,EAAqD,SAASI,CAAM,MACtES,EAAK,IAAIT,CAAM,MACnBS,EAAK,IAAIT,CAAM,GACfQ,EAAI,KAAK,EAAE,QAAAR,GAAQ,eAAAI,GAAe,MAAAO,GAAM;AAAA,EAC1C;AACA,SAAOH;AACT;AAEO,SAASI,EAAmBC,GAAgC;AACjE,QAAMC,IAAYhB,EAAA;AAClB,SAAIgB,KACG,OAAOD,KAAkB,EAAE,EAAE,KAAA;AACtC;AAEO,SAASE,EAAmBf,GAAgBgB,GAAmC;AACpF,QAAMC,IAAO,OAAOjB,KAAU,EAAE,EAAE,KAAA;AAClC,MAAKiB,GACL;AAAA,QAAID,KAAWA,EAAQ,SAAS,KAAK,CAACA,EAAQ,SAASC,CAAI;AACzD,YAAM,IAAI,MAAM,kBAAkBA,CAAI,EAAE;AAE1C,IAAAlB,EAAakB,CAAI,GACjBhB,EAAOgB,CAAI;AAAA;AACb;AAEO,SAASC,EAAyBC,GAAgC;AACvE,SAAAtB,EAAU,IAAIsB,CAAQ,GACf,MAAM;AACX,IAAAtB,EAAU,OAAOsB,CAAQ;AAAA,EAC3B;AACF;AAGO,SAASC,IAA6C;AAC3D,MAAI,OAAO,SAAW,IAAa,QAAO;;AAC1C,QAAMC,IAAY,CAACC,MAAqB;AACtC,IAAIA,EAAG,gBAAgB,kBACnBA,EAAG,QAAQ5B,KACfO,EAAO,OAAOqB,EAAG,YAAY,EAAE,EAAE,MAAM;AAAA,EACzC;AACA,gBAAO,iBAAiB,WAAWD,CAAS,GACrC,MAAM,OAAO,oBAAoB,WAAWA,CAAS;AAC9D;AAEO,SAASE,EACdhB,GACAM,GACyB;AACzB,QAAMW,IAAgBZ,EAAmBC,CAAc,GACjDY,IAAMlB,EAAK,KAAK,CAACmB,MAAMA,EAAE,WAAWF,CAAa;AACvD,MAAIC;AACF,WAAO;AAAA,MACL,eAAeA,EAAI;AAAA,MACnB,sBAAsBA,EAAI;AAAA,MAC1B,sBAAsBA,EAAI;AAAA,IAAA;AAG9B,QAAME,IAAKpB,EAAK,KAAK,CAACmB,MAAMA,EAAE,WAAWb,CAAc,KAAKN,EAAK,CAAC;AAClE,SAAO;AAAA,IACL,gBAAeoB,KAAA,gBAAAA,EAAI,WAAUd;AAAA,IAC7B,uBAAsBc,KAAA,gBAAAA,EAAI,kBAAiBd;AAAA,IAC3C,uBAAsBc,KAAA,gBAAAA,EAAI,SAAQd;AAAA,EAAA;AAEtC;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useState as p, useEffect as g } from "react";
|
|
2
|
+
import { getMsgCenterAppKey as t, subscribeMsgCenterAppKey as i, bindMsgCenterAppKeyStorageSync as c } from "./msgCenterAppSwitch.js";
|
|
3
|
+
function C(e) {
|
|
4
|
+
const [r, n] = p(() => t(e));
|
|
5
|
+
return g(() => {
|
|
6
|
+
n(t(e));
|
|
7
|
+
const s = i((u) => {
|
|
8
|
+
n(u || t(e));
|
|
9
|
+
}), o = c();
|
|
10
|
+
return () => {
|
|
11
|
+
s(), o();
|
|
12
|
+
};
|
|
13
|
+
}, [e]), r;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
C as useMsgCenterAppKey
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useMsgCenterAppKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMsgCenterAppKey.js","sources":["../../../../src/components/Tools/MessageCenter/useMsgCenterAppKey.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport {\n getMsgCenterAppKey,\n subscribeMsgCenterAppKey,\n bindMsgCenterAppKeyStorageSync,\n} from './msgCenterAppSwitch';\n\n/** 订阅当前消息中心 appKey(Hub 切换后触发重渲染) */\nexport function useMsgCenterAppKey(fallbackAppKey: string): string {\n const [appKey, setAppKey] = useState(() => getMsgCenterAppKey(fallbackAppKey));\n\n useEffect(() => {\n setAppKey(getMsgCenterAppKey(fallbackAppKey));\n const unsub = subscribeMsgCenterAppKey((next) => {\n setAppKey(next || getMsgCenterAppKey(fallbackAppKey));\n });\n const unbind = bindMsgCenterAppKeyStorageSync();\n return () => {\n unsub();\n unbind();\n };\n }, [fallbackAppKey]);\n\n return appKey;\n}\n"],"names":["useMsgCenterAppKey","fallbackAppKey","appKey","setAppKey","useState","getMsgCenterAppKey","useEffect","unsub","subscribeMsgCenterAppKey","next","unbind","bindMsgCenterAppKeyStorageSync"],"mappings":";;AAQO,SAASA,EAAmBC,GAAgC;AACjE,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,MAAMC,EAAmBJ,CAAc,CAAC;AAE7E,SAAAK,EAAU,MAAM;AACd,IAAAH,EAAUE,EAAmBJ,CAAc,CAAC;AAC5C,UAAMM,IAAQC,EAAyB,CAACC,MAAS;AAC/C,MAAAN,EAAUM,KAAQJ,EAAmBJ,CAAc,CAAC;AAAA,IACtD,CAAC,GACKS,IAASC,EAAA;AACf,WAAO,MAAM;AACX,MAAAJ,EAAA,GACAG,EAAA;AAAA,IACF;AAAA,EACF,GAAG,CAACT,CAAc,CAAC,GAEZC;AACT;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { InboxBell } from './Inbox';
|
|
2
2
|
export type { InboxBellItem, InboxBellListResult, InboxBellListParams, InboxBellProps, InboxBellMessageType, } from './Inbox';
|
|
3
3
|
export { MessageTemplateAdmin } from './MessageCenter';
|
|
4
|
-
export type { MessageTemplateAdminProps, MessageTemplateAdminItem, MessageEventCatalogItem, MessageAudienceRoleOption, MessageTemplateVariable, } from './MessageCenter';
|
|
5
|
-
export { generateTemplateCode, normalizeTemplatePlaceholders, applyTemplateVars, } from './MessageCenter';
|
|
4
|
+
export type { MessageTemplateAdminProps, MessageTemplateAdminItem, MessageEventCatalogItem, MessageEventCatalogPayload, MessageAudienceRoleOption, MessageTemplateVariable, MessageTemplateVariableAdmin, PushRuleAdminItem, MessageCrudFlags, MessageAdminPermissions, } from './MessageCenter';
|
|
5
|
+
export { generateTemplateCode, normalizeTemplatePlaceholders, applyTemplateVars, resolveMessageAdminPermissions, MSG_CENTER_APP_SWITCH_STORAGE_KEY, SYSTEM_APP_TO_MSG_CENTER_APP_KEY, MSG_CENTER_SWITCHABLE_APP_KEYS, msgCenterAppKeyFromSystemAppCode, filterMsgCenterSwitchableApps, getMsgCenterAppKey, setMsgCenterAppKey, subscribeMsgCenterAppKey, bindMsgCenterAppKeyStorageSync, resolveMsgCenterSwitchState, useMsgCenterAppKey, MsgCenterAppSwitcher, } from './MessageCenter';
|
|
6
|
+
export type { MsgCenterAppSwitchState, MsgCenterSwitchableApp, MsgCenterSwitchableAppKey, MsgCenterAppSwitcherProps, } from './MessageCenter';
|