@24city/web-console 0.1.0 → 0.1.1
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/CHANGELOG.md +10 -0
- package/README.md +4 -0
- package/dist/account/index.js +2 -2
- package/dist/chunks/{console-layout-CcUiJPf0.js → console-layout-BibioK5M.js} +33 -33
- package/dist/chunks/{error-boundary-BgTZsJA_.js → error-boundary-D3qiD7ov.js} +1 -1
- package/dist/chunks/page-BaitnD--.js +89 -0
- package/dist/chunks/{stale-build-D4N21gap.js → stale-build-DUKkQHuu.js} +1 -1
- package/dist/chunks/{text-link-7A--UEc3.js → text-link-FTsBp_QU.js} +1 -1
- package/dist/chunks/upgrade-modal-DzdKuEkJ.js +667 -0
- package/dist/chunks/wallet-badge-CnyMLpUO.js +565 -0
- package/dist/index.js +7 -7
- package/dist/layout/index.js +1 -1
- package/dist/page/index.js +3 -3
- package/dist/runtime/index.js +1 -1
- package/dist/styles.css +286 -254
- package/package.json +1 -1
- package/dist/chunks/page-BhfOrziX.js +0 -89
- package/dist/chunks/upgrade-modal-BbsM2VE2.js +0 -667
- package/dist/chunks/wallet-badge-D7AFqTLx.js +0 -565
|
@@ -1,565 +0,0 @@
|
|
|
1
|
-
import { jsx as a, jsxs as m, Fragment as me } from "react/jsx-runtime";
|
|
2
|
-
import { useState as O, useRef as pe, useCallback as Se, useEffect as Te } from "react";
|
|
3
|
-
import { Skeleton as ie, Button as k, Toast as fe, Modal as Ae, Avatar as Pe, Popover as xe, Tooltip as Le } from "@douyinfe/semi-ui";
|
|
4
|
-
import { IconUser as B, IconCrown as Ee, IconGift as Ie, IconChevronRight as V, IconUserGroup as ce, IconChevronUp as $e, IconChevronDown as ze, IconTick as je } from "@douyinfe/semi-icons";
|
|
5
|
-
import { useNavigate as J } from "react-router";
|
|
6
|
-
import { a as _e, b } from "./context-CaVim6ZO.js";
|
|
7
|
-
import { q as v, k as Oe, a as Be, t as he, w as De, l as Me, u as M, g as Fe, f as le } from "./logout-signal-CiD_zY5M.js";
|
|
8
|
-
import { useQueryClient as ye, useQuery as P } from "@tanstack/react-query";
|
|
9
|
-
import { notifyCustomerSessionChanged as ke } from "@24city/web-runtime/session-sync";
|
|
10
|
-
const Re = "_trigger_sjkfn_6", Ue = "_avatarWrap_sjkfn_27", Ke = "_avatar_sjkfn_27", qe = "_card_sjkfn_74", We = "_identity_sjkfn_84", Ye = "_who_sjkfn_92", Ge = "_nameRow_sjkfn_101", Qe = "_name_sjkfn_101", Ve = "_planChip_sjkfn_118", He = "_diamond_sjkfn_148", Xe = "_spaceToggle_sjkfn_156", Je = "_spaceStatic_sjkfn_157", Ze = "_spaceSwitchText_sjkfn_178", et = "_spaceName_sjkfn_184", tt = "_spaceType_sjkfn_190", nt = "_spaceList_sjkfn_200", st = "_spaceOption_sjkfn_209", at = "_spaceCheck_sjkfn_231", ot = "_plan_sjkfn_118", rt = "_links_sjkfn_243", it = "_link_sjkfn_243", ct = "_linkIcon_sjkfn_274", lt = "_linkLabel_sjkfn_285", dt = "_linkArrow_sjkfn_290", ut = "_divider_sjkfn_296", mt = "_logout_sjkfn_302", l = {
|
|
11
|
-
trigger: Re,
|
|
12
|
-
avatarWrap: Ue,
|
|
13
|
-
avatar: Ke,
|
|
14
|
-
card: qe,
|
|
15
|
-
identity: We,
|
|
16
|
-
who: Ye,
|
|
17
|
-
nameRow: Ge,
|
|
18
|
-
name: Qe,
|
|
19
|
-
planChip: Ve,
|
|
20
|
-
diamond: He,
|
|
21
|
-
spaceToggle: Xe,
|
|
22
|
-
spaceStatic: Je,
|
|
23
|
-
spaceSwitchText: Ze,
|
|
24
|
-
spaceName: et,
|
|
25
|
-
spaceType: tt,
|
|
26
|
-
spaceList: nt,
|
|
27
|
-
spaceOption: st,
|
|
28
|
-
spaceCheck: at,
|
|
29
|
-
plan: ot,
|
|
30
|
-
links: rt,
|
|
31
|
-
link: it,
|
|
32
|
-
linkIcon: ct,
|
|
33
|
-
linkLabel: lt,
|
|
34
|
-
linkArrow: dt,
|
|
35
|
-
divider: ut,
|
|
36
|
-
logout: mt
|
|
37
|
-
}, pt = ["profile", "subscription", "points"], ft = (e) => pt.includes(e), N = (e, t) => `${e}/account/${t}`, Dn = (e, t) => t === `${e}/account` || t.startsWith(`${e}/account/`), j = (e) => `account-${e}`, x = {
|
|
38
|
-
profile: j("profile"),
|
|
39
|
-
subscription: j("subscription"),
|
|
40
|
-
points: j("points")
|
|
41
|
-
}, _t = /^[a-z][a-z0-9-]{0,31}$/, ht = (e) => {
|
|
42
|
-
const t = e.accountSections ?? [], n = /* @__PURE__ */ new Set();
|
|
43
|
-
for (const s of t) {
|
|
44
|
-
if (!_t.test(s.key))
|
|
45
|
-
throw new Error(`个人中心分区 key 不合法:${s.key}(小写字母开头,只含小写字母、数字和连字符)`);
|
|
46
|
-
if (ft(s.key)) throw new Error(`个人中心分区 key 与内置分区重名:${s.key}`);
|
|
47
|
-
if (n.has(s.key)) throw new Error(`个人中心分区 key 重复:${s.key}`);
|
|
48
|
-
n.add(s.key);
|
|
49
|
-
}
|
|
50
|
-
return t;
|
|
51
|
-
}, yt = (e, t = []) => ({
|
|
52
|
-
key: "personal",
|
|
53
|
-
label: "个人中心",
|
|
54
|
-
items: [
|
|
55
|
-
{ key: x.profile, label: "账号与安全", to: N(e, "profile"), icon: B },
|
|
56
|
-
{ key: x.subscription, label: "订阅与套餐", to: N(e, "subscription"), icon: Ee },
|
|
57
|
-
{ key: x.points, label: "积分与明细", to: N(e, "points"), icon: Ie },
|
|
58
|
-
...t.map(
|
|
59
|
-
(n) => ({
|
|
60
|
-
key: j(n.key),
|
|
61
|
-
label: n.label,
|
|
62
|
-
to: N(e, n.key),
|
|
63
|
-
icon: n.icon
|
|
64
|
-
})
|
|
65
|
-
)
|
|
66
|
-
]
|
|
67
|
-
}), kt = 1e6, Z = (e) => e != null && e >= kt, Mn = (e) => !!e && e.limit !== null && e.used >= e.limit, Fn = (e, t) => e.limit === null ? `已有 ${e.used} ${t}` : e.limit === 0 && e.used === 0 ? "套餐未包含" : Z(e.limit) ? `已有 ${e.used} ${t} · 不限` : `已用 ${e.used}/${e.limit}`, Rn = (e, t) => (n) => n !== null && Z(n) ? t : e(v(n ?? 0)), be = (e, t) => e.find((n) => n.key === t), de = (e, t) => {
|
|
68
|
-
const n = e.findIndex((s) => s.key === t);
|
|
69
|
-
return n === -1 ? e.length : n;
|
|
70
|
-
}, bt = (e, t) => {
|
|
71
|
-
const n = be(e, t.key), s = n ? n.on(t.limit) : t.limit === null ? t.name : `${t.name} ${Z(t.limit) ? "不限" : v(t.limit)}`;
|
|
72
|
-
return t.discounts.length ? `${s}(${t.discounts.join("、")})` : s;
|
|
73
|
-
}, gt = (e) => {
|
|
74
|
-
if (e.length < 2) return /* @__PURE__ */ new Set();
|
|
75
|
-
const t = new Set(e.flatMap((n) => n.benefits.filter((s) => s.limit === null).map((s) => s.key)));
|
|
76
|
-
return new Set(
|
|
77
|
-
[...t].filter((n) => e.every((s) => s.benefits.some((o) => o.key === n && o.limit === null)))
|
|
78
|
-
);
|
|
79
|
-
}, wt = (e, t = [], n = {}) => {
|
|
80
|
-
var u;
|
|
81
|
-
const s = n.benefitCopy ?? [], o = gt(t), r = [];
|
|
82
|
-
for (const i of [...e.benefits, ...t.flatMap((p) => p.benefits)])
|
|
83
|
-
!r.includes(i.key) && !o.has(i.key) && r.push(i.key);
|
|
84
|
-
const d = [];
|
|
85
|
-
for (const i of [...r].sort((p, f) => de(s, p) - de(s, f) || r.indexOf(p) - r.indexOf(f))) {
|
|
86
|
-
const p = e.benefits.find((h) => h.key === i);
|
|
87
|
-
if (p) {
|
|
88
|
-
d.push({ text: bt(s, p), included: !0 });
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
const f = (u = be(s, i)) == null ? void 0 : u.off;
|
|
92
|
-
f && d.push({ text: f, included: !1 });
|
|
93
|
-
}
|
|
94
|
-
return d;
|
|
95
|
-
}, H = (e) => e.planName || e.planCode, Nt = (e) => e.isDefault || !e.currentPeriodEnd ? "长期有效" : `有效期至 ${Oe(e.currentPeriodEnd)}`, vt = 1440 * 60 * 1e3, Ct = (e, t = Date.now()) => {
|
|
96
|
-
if (e.isDefault || !e.currentPeriodEnd) return null;
|
|
97
|
-
const n = Date.parse(e.currentPeriodEnd);
|
|
98
|
-
return Number.isFinite(n) ? Math.max(0, Math.ceil((n - t) / vt)) : null;
|
|
99
|
-
}, St = 7, Tt = { month: "/月", year: "/年", one_time: "" }, At = (e) => {
|
|
100
|
-
const t = (e.amountCents / 100).toLocaleString("zh-CN", { maximumFractionDigits: 2 });
|
|
101
|
-
return e.currency === "CNY" ? `¥${t}` : `${e.currency} ${t}`;
|
|
102
|
-
}, Un = (e) => e ? { focusPlan: e } : void 0, Kn = (e) => {
|
|
103
|
-
if (typeof e != "object" || e === null) return;
|
|
104
|
-
const t = e.focusPlan;
|
|
105
|
-
return typeof t == "string" && t ? t : void 0;
|
|
106
|
-
}, Pt = (e) => `${At(e)}${Tt[e.billingPeriod]}`, xt = (e) => {
|
|
107
|
-
const t = e.prices.filter((o) => o.amountCents > 0), n = t.filter((o) => o.billingPeriod === "month");
|
|
108
|
-
return (n.length ? n : t).reduce((o, r) => !o || r.amountCents < o.amountCents ? r : o, null);
|
|
109
|
-
}, Lt = (e, t, n) => {
|
|
110
|
-
const o = (e ?? []).filter(
|
|
111
|
-
(r) => r.spaceType === t && !r.isDefault && (n === null || r.tier > n)
|
|
112
|
-
).map((r) => ({ plan: r, price: xt(r) }));
|
|
113
|
-
return o.sort(
|
|
114
|
-
(r, d) => {
|
|
115
|
-
var u, i;
|
|
116
|
-
return r.plan.tier - d.plan.tier || (((u = r.price) == null ? void 0 : u.amountCents) ?? Number.MAX_SAFE_INTEGER) - (((i = d.price) == null ? void 0 : i.amountCents) ?? Number.MAX_SAFE_INTEGER);
|
|
117
|
-
}
|
|
118
|
-
), o[0] ?? null;
|
|
119
|
-
}, qn = (e) => e == null ? void 0 : e.filter((t) => t.spaceType === "team" && !t.isDefault).sort((t, n) => t.tier - n.tier)[0], Et = (e, t) => e == null ? void 0 : e.find((n) => n.code === t.planCode), It = (e, t = [], n = {}) => {
|
|
120
|
-
if (!e) return ["积分按月发放", "24.city 全产品通用"];
|
|
121
|
-
const s = [];
|
|
122
|
-
e.monthlyPoints > 0 && s.push(`每月 ${v(e.monthlyPoints)} 积分`);
|
|
123
|
-
for (const o of wt(e, t, n).filter((r) => r.included).slice(0, 2)) s.push(o.text);
|
|
124
|
-
return s.length < 2 && s.push("24.city 全产品通用"), s;
|
|
125
|
-
}, $t = "_promo_10uzf_6", zt = "_member_10uzf_7", jt = "_plain_10uzf_8", Ot = "_promoArt_10uzf_28", Bt = "_promoBody_10uzf_38", Dt = "_promoTitle_10uzf_44", Mt = "_promoText_10uzf_55", Ft = "_cta_10uzf_63", Rt = "_ctaButton_10uzf_69", Ut = "_ctaTag_10uzf_89", Kt = "_ownerOnly_10uzf_106", qt = "_memberArt_10uzf_122", Wt = "_memberBody_10uzf_132", Yt = "_memberEyebrow_10uzf_139", Gt = "_memberTitle_10uzf_145", Qt = "_memberMeta_10uzf_159", Vt = "_memberCta_10uzf_166", Ht = "_plainBody_10uzf_200", Xt = "_plainText_10uzf_207", Jt = "_retry_10uzf_212", Zt = "_loading_10uzf_216", en = "_assets_10uzf_224", tn = "_asset_10uzf_224", nn = "_coin_10uzf_279", sn = "_assetLabel_10uzf_287", an = "_assetValue_10uzf_291", on = "_assetArrow_10uzf_299", rn = "_assetDivider_10uzf_312", c = {
|
|
126
|
-
promo: $t,
|
|
127
|
-
member: zt,
|
|
128
|
-
plain: jt,
|
|
129
|
-
promoArt: Ot,
|
|
130
|
-
promoBody: Bt,
|
|
131
|
-
promoTitle: Dt,
|
|
132
|
-
promoText: Mt,
|
|
133
|
-
cta: Ft,
|
|
134
|
-
ctaButton: Rt,
|
|
135
|
-
ctaTag: Ut,
|
|
136
|
-
ownerOnly: Kt,
|
|
137
|
-
memberArt: qt,
|
|
138
|
-
memberBody: Wt,
|
|
139
|
-
memberEyebrow: Yt,
|
|
140
|
-
memberTitle: Gt,
|
|
141
|
-
memberMeta: Qt,
|
|
142
|
-
memberCta: Vt,
|
|
143
|
-
plainBody: Ht,
|
|
144
|
-
plainText: Xt,
|
|
145
|
-
retry: Jt,
|
|
146
|
-
loading: Zt,
|
|
147
|
-
assets: en,
|
|
148
|
-
asset: tn,
|
|
149
|
-
coin: nn,
|
|
150
|
-
assetLabel: sn,
|
|
151
|
-
assetValue: an,
|
|
152
|
-
assetArrow: on,
|
|
153
|
-
assetDivider: rn
|
|
154
|
-
}, cn = x.points, ee = x.subscription, ln = ({ membership: e, text: t, onOpen: n }) => {
|
|
155
|
-
const { canBuy: s, offer: o } = e;
|
|
156
|
-
return s ? /* @__PURE__ */ m("span", { className: c.cta, children: [
|
|
157
|
-
/* @__PURE__ */ a(k, { theme: "light", type: "tertiary", block: !0, className: c.ctaButton, onClick: () => n(ee), children: t }),
|
|
158
|
-
o != null && o.price ? /* @__PURE__ */ m("span", { className: c.ctaTag, children: [
|
|
159
|
-
Pt(o.price),
|
|
160
|
-
"起"
|
|
161
|
-
] }) : null
|
|
162
|
-
] }) : /* @__PURE__ */ a("span", { className: c.ownerOnly, children: "请团队所有者在统一账号中心续费" });
|
|
163
|
-
}, K = ({
|
|
164
|
-
membership: e,
|
|
165
|
-
extra: t,
|
|
166
|
-
onOpen: n
|
|
167
|
-
}) => {
|
|
168
|
-
const { wallet: s } = e, o = s.isPending ? "…" : s.data ? v(s.data.availablePoints) : "暂不可用";
|
|
169
|
-
return /* @__PURE__ */ m("div", { className: c.assets, children: [
|
|
170
|
-
/* @__PURE__ */ m(k, { theme: "borderless", type: "tertiary", className: c.asset, "aria-label": `可用积分 ${o},查看积分与明细`, onClick: () => n(cn), children: [
|
|
171
|
-
/* @__PURE__ */ a("span", { className: c.coin, "aria-hidden": "true" }),
|
|
172
|
-
/* @__PURE__ */ a("span", { className: c.assetLabel, children: "积分" }),
|
|
173
|
-
/* @__PURE__ */ a("span", { className: c.assetValue, children: o }),
|
|
174
|
-
/* @__PURE__ */ a(V, { className: c.assetArrow, "aria-hidden": "true" })
|
|
175
|
-
] }),
|
|
176
|
-
t ? /* @__PURE__ */ m(me, { children: [
|
|
177
|
-
/* @__PURE__ */ a("span", { className: c.assetDivider, "aria-hidden": "true" }),
|
|
178
|
-
/* @__PURE__ */ m(k, { theme: "borderless", type: "tertiary", className: c.asset, "data-tone": t.tone, onClick: t.onClick ?? (() => n(ee)), children: [
|
|
179
|
-
/* @__PURE__ */ a("span", { className: c.assetValue, children: t.label }),
|
|
180
|
-
/* @__PURE__ */ a(V, { className: c.assetArrow, "aria-hidden": "true" })
|
|
181
|
-
] })
|
|
182
|
-
] }) : null
|
|
183
|
-
] });
|
|
184
|
-
}, dn = ({ membership: e, onOpen: t }) => {
|
|
185
|
-
const n = _e(), { state: s, offer: o, currentPlan: r, subscription: d } = e;
|
|
186
|
-
if (s.kind === "loading")
|
|
187
|
-
return /* @__PURE__ */ a("div", { className: c.loading, children: /* @__PURE__ */ a(ie, { loading: !0, active: !0, placeholder: /* @__PURE__ */ a(ie.Paragraph, { rows: 3 }) }) });
|
|
188
|
-
if (s.kind === "error")
|
|
189
|
-
return /* @__PURE__ */ m("div", { className: c.plain, children: [
|
|
190
|
-
/* @__PURE__ */ m("div", { className: c.plainBody, children: [
|
|
191
|
-
/* @__PURE__ */ a("span", { className: c.plainText, children: "套餐信息暂时读不到" }),
|
|
192
|
-
/* @__PURE__ */ a(k, { theme: "borderless", type: "tertiary", size: "small", className: c.retry, onClick: () => void d.refetch(), children: "重试" })
|
|
193
|
-
] }),
|
|
194
|
-
/* @__PURE__ */ a(K, { membership: e, onOpen: t })
|
|
195
|
-
] });
|
|
196
|
-
if (s.kind === "member") {
|
|
197
|
-
const { subscription: h, daysLeft: y } = s, S = y !== null && y <= St, T = (r == null ? void 0 : r.monthlyPoints) ?? 0;
|
|
198
|
-
return /* @__PURE__ */ m("div", { className: c.member, "data-expiring": S ? "true" : "false", children: [
|
|
199
|
-
/* @__PURE__ */ a("span", { className: c.memberArt, "aria-hidden": "true" }),
|
|
200
|
-
/* @__PURE__ */ m("div", { className: c.memberBody, children: [
|
|
201
|
-
/* @__PURE__ */ m("span", { className: c.memberEyebrow, children: [
|
|
202
|
-
"当前会员",
|
|
203
|
-
T > 0 ? ` · 每月 ${v(T)} 积分` : ""
|
|
204
|
-
] }),
|
|
205
|
-
/* @__PURE__ */ a("span", { className: c.memberTitle, children: H(h) }),
|
|
206
|
-
/* @__PURE__ */ a("span", { className: c.memberMeta, children: Nt(h) }),
|
|
207
|
-
e.canBuy ? /* @__PURE__ */ a(k, { theme: "light", type: "tertiary", size: "small", className: c.memberCta, onClick: () => t(ee), children: S ? "立即续费" : o ? "续费或升级" : "续费" }) : null
|
|
208
|
-
] }),
|
|
209
|
-
/* @__PURE__ */ a(
|
|
210
|
-
K,
|
|
211
|
-
{
|
|
212
|
-
membership: e,
|
|
213
|
-
onOpen: t,
|
|
214
|
-
extra: y === null ? void 0 : { label: y === 0 ? "今天到期" : `剩余 ${y} 天`, tone: S ? "warning" : void 0 }
|
|
215
|
-
}
|
|
216
|
-
)
|
|
217
|
-
] });
|
|
218
|
-
}
|
|
219
|
-
const u = s.kind === "team-expired", i = u ? "团队版已到期" : o ? `升级${o.plan.name},畅享更多` : "开通会员畅享", p = u ? "续费后团队成员继续共用套餐和积分" : It(o == null ? void 0 : o.plan, e.plans.data ?? [], n).join(" · "), f = u ? 0 : (r == null ? void 0 : r.monthlyPoints) ?? 0;
|
|
220
|
-
return /* @__PURE__ */ m("div", { className: c.promo, "data-tone": u ? "team" : "free", children: [
|
|
221
|
-
/* @__PURE__ */ a("span", { className: c.promoArt, "aria-hidden": "true" }),
|
|
222
|
-
/* @__PURE__ */ m("div", { className: c.promoBody, children: [
|
|
223
|
-
/* @__PURE__ */ a("span", { className: c.promoTitle, children: i }),
|
|
224
|
-
/* @__PURE__ */ a("span", { className: c.promoText, children: p }),
|
|
225
|
-
/* @__PURE__ */ a(ln, { membership: e, text: u ? "续费团队版" : "立即开通会员", onOpen: t })
|
|
226
|
-
] }),
|
|
227
|
-
/* @__PURE__ */ a(K, { membership: e, onOpen: t, extra: f > 0 ? { label: `免费版每月赠 ${v(f)}` } : void 0 })
|
|
228
|
-
] });
|
|
229
|
-
}, un = "个人空间", D = (e) => e.type === "team", X = (e) => e.type === "personal" ? un : e.name || e.slug, mn = { owner: "所有者", admin: "管理员", member: "成员" }, Wn = (e) => e ? mn[e] ?? "" : "", pn = (e) => !!(e && (e.type === "personal" || e.role === "owner")), fn = () => {
|
|
230
|
-
const [e, t] = O(!1), n = ye(), { accountApi: s, config: o } = b(), r = async () => {
|
|
231
|
-
if (e) return;
|
|
232
|
-
t(!0), Be();
|
|
233
|
-
let u = o.routes.publicHome;
|
|
234
|
-
try {
|
|
235
|
-
const { endSessionUrl: i } = await s.logout();
|
|
236
|
-
i && (u = i);
|
|
237
|
-
} catch (i) {
|
|
238
|
-
if (!he(i, 401)) {
|
|
239
|
-
De(), fe.error("退出失败,请重试"), t(!1);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return Me(), await n.cancelQueries().catch(() => {
|
|
244
|
-
}), ke(), window.location.assign(u), new Promise(() => {
|
|
245
|
-
});
|
|
246
|
-
};
|
|
247
|
-
return { confirmLogout: () => {
|
|
248
|
-
e || Ae.confirm({
|
|
249
|
-
title: "退出登录",
|
|
250
|
-
content: "将同时退出 24.city 统一账号并回到首页,再次进入工作台需要重新登录。",
|
|
251
|
-
okText: "退出登录",
|
|
252
|
-
cancelText: "取消",
|
|
253
|
-
okButtonProps: { type: "danger" },
|
|
254
|
-
onOk: r
|
|
255
|
-
});
|
|
256
|
-
}, logout: r, pending: e };
|
|
257
|
-
}, q = (e) => typeof e == "object" && e !== null && !Array.isArray(e), _n = (e) => {
|
|
258
|
-
if (!he(e, 403) || !q(e) || !q(e.response)) return !1;
|
|
259
|
-
const t = e.response.data;
|
|
260
|
-
return q(t) && t.reason === "team_subscription_required";
|
|
261
|
-
}, L = {
|
|
262
|
-
profile: (e) => ["product-profile", e],
|
|
263
|
-
wallet: (e, t) => ["product-wallet", e, t],
|
|
264
|
-
subscription: (e, t) => ["product-subscription", e, t],
|
|
265
|
-
plans: ["product-plans"]
|
|
266
|
-
}, hn = () => {
|
|
267
|
-
const { accountApi: e } = b(), { session: t, spaces: n } = M(), s = (t == null ? void 0 : t.activeSpaceId) ?? "", o = (t == null ? void 0 : t.globalUserId) ?? "", r = (t == null ? void 0 : t.purpose) === "user" && !!(s && o), d = n.find((f) => f.id === s), u = P({
|
|
268
|
-
queryKey: L.profile(o),
|
|
269
|
-
queryFn: () => e.getProfile(),
|
|
270
|
-
enabled: !!o,
|
|
271
|
-
staleTime: 1 / 0
|
|
272
|
-
}), i = P({
|
|
273
|
-
queryKey: L.wallet(s, o),
|
|
274
|
-
queryFn: () => e.getWallet(),
|
|
275
|
-
enabled: r
|
|
276
|
-
}), p = P({
|
|
277
|
-
queryKey: L.subscription(s, o),
|
|
278
|
-
queryFn: () => e.getSubscription(),
|
|
279
|
-
enabled: r
|
|
280
|
-
});
|
|
281
|
-
return { session: t, allowed: r, activeSpace: d, activeSpaceId: s, globalUserId: o, profile: u, wallet: i, subscription: p };
|
|
282
|
-
}, yn = 5 * 6e4, kn = (e) => {
|
|
283
|
-
const { accountApi: t } = b();
|
|
284
|
-
return P({
|
|
285
|
-
queryKey: L.plans,
|
|
286
|
-
queryFn: () => t.getPlans(),
|
|
287
|
-
enabled: e,
|
|
288
|
-
staleTime: yn
|
|
289
|
-
});
|
|
290
|
-
}, ge = () => {
|
|
291
|
-
var y;
|
|
292
|
-
const { config: e } = b(), t = hn(), { activeSpace: n, subscription: s, allowed: o } = t, r = kn(o), d = n ? D(n) : !1, u = d ? "team" : "personal";
|
|
293
|
-
let i;
|
|
294
|
-
!o || s.isPending ? i = { kind: "loading" } : s.isError ? i = _n(s.error) ? { kind: "team-expired" } : { kind: "error" } : !s.data || s.data.isDefault ? i = { kind: "free", subscription: s.data ?? null } : i = { kind: "member", subscription: s.data, daysLeft: Ct(s.data) };
|
|
295
|
-
const p = i.kind === "free" || i.kind === "member" ? ((y = i.subscription) == null ? void 0 : y.tier) ?? null : null, f = i.kind === "free" || i.kind === "member" || i.kind === "team-expired" ? Lt(r.data, u, p) : null, h = (i.kind === "free" || i.kind === "member") && i.subscription ? Et(r.data, i.subscription) : void 0;
|
|
296
|
-
return {
|
|
297
|
-
...t,
|
|
298
|
-
plans: r,
|
|
299
|
-
state: i,
|
|
300
|
-
offer: f,
|
|
301
|
-
currentPlan: h,
|
|
302
|
-
team: d,
|
|
303
|
-
/** 个人空间是自己的;团队空间只有所有者能买(STD-BILLING-001) */
|
|
304
|
-
canBuy: pn(n),
|
|
305
|
-
/** 「订阅与套餐」的站内地址 */
|
|
306
|
-
subscriptionPath: N(e.routes.app, "subscription")
|
|
307
|
-
};
|
|
308
|
-
}, bn = () => {
|
|
309
|
-
const e = ye(), t = Fe(), { session: n } = M(), { accountApi: s } = b(), [o, r] = O(!1), d = pe(0), u = n == null ? void 0 : n.activeSpaceId, i = Se(
|
|
310
|
-
async (p) => {
|
|
311
|
-
if (!p || p === u || o) return;
|
|
312
|
-
const f = ++d.current;
|
|
313
|
-
r(!0);
|
|
314
|
-
try {
|
|
315
|
-
if (await e.cancelQueries(), e.clear(), (await s.switchSpace(p)).activeSpaceId !== p) throw new Error("空间切换响应与请求不一致");
|
|
316
|
-
const y = await le(s);
|
|
317
|
-
if (d.current !== f) return;
|
|
318
|
-
t.setContext(y), ke();
|
|
319
|
-
} catch {
|
|
320
|
-
if (d.current !== f) return;
|
|
321
|
-
try {
|
|
322
|
-
const h = await le(s);
|
|
323
|
-
e.clear(), t.setContext(h), h.session.activeSpaceId !== p && fe.error("空间切换失败,请稍后重试");
|
|
324
|
-
} catch {
|
|
325
|
-
e.clear(), t.clear({ unavailable: !0 });
|
|
326
|
-
}
|
|
327
|
-
} finally {
|
|
328
|
-
d.current === f && r(!1);
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
[s, u, t, e, o]
|
|
332
|
-
);
|
|
333
|
-
return { switching: o, switchSpace: i };
|
|
334
|
-
}, W = "我的账号", gn = 80, wn = 200, Y = ({ space: e }) => /* @__PURE__ */ m(me, { children: [
|
|
335
|
-
/* @__PURE__ */ a("span", { className: l.spaceName, children: X(e) }),
|
|
336
|
-
D(e) ? /* @__PURE__ */ a("span", { className: l.spaceType, children: "团队" }) : null
|
|
337
|
-
] }), ue = ({ nickName: e, member: t, size: n }) => /* @__PURE__ */ a("span", { className: l.avatarWrap, "data-member": t ? "true" : "false", "data-size": n > 40 ? "large" : "small", children: /* @__PURE__ */ a(Pe, { size: "small", shape: "circle", className: l.avatar, style: { width: n, height: n }, children: e ? Array.from(e)[0] : /* @__PURE__ */ a(B, { "aria-hidden": "true" }) }) }), Nn = ({ state: e }) => e.kind === "member" ? /* @__PURE__ */ m("span", { className: l.planChip, "data-tone": "member", children: [
|
|
338
|
-
/* @__PURE__ */ a("span", { className: l.diamond, "aria-hidden": "true" }),
|
|
339
|
-
H(e.subscription)
|
|
340
|
-
] }) : e.kind === "free" ? /* @__PURE__ */ a("span", { className: l.planChip, "data-tone": "free", children: e.subscription ? H(e.subscription) : "未开通" }) : e.kind === "team-expired" ? /* @__PURE__ */ a("span", { className: l.planChip, "data-tone": "warning", children: "团队版已到期" }) : null, Yn = ({ personal: e, selectedKey: t, onOpen: n }) => {
|
|
341
|
-
var re;
|
|
342
|
-
const { config: s } = b(), o = _e(), r = J(), d = e ?? yt(s.routes.app, ht(o)), u = ge(), { profile: i, state: p } = u, { session: f, spaces: h } = M(), { confirmLogout: y, pending: S } = fn(), { switching: T, switchSpace: we } = bn(), [F, E] = O(!1), [R, I] = O(!1), A = pe(void 0), U = ((re = i.data) == null ? void 0 : re.nickName) ?? "", $ = U || (i.isPending ? "" : W), te = (f == null ? void 0 : f.activeSpaceId) ?? "", g = h.find((_) => _.id === te), ne = h.length > 1, se = p.kind === "member", C = () => {
|
|
343
|
-
A.current !== void 0 && (window.clearTimeout(A.current), A.current = void 0);
|
|
344
|
-
};
|
|
345
|
-
Te(() => C, []);
|
|
346
|
-
const z = () => {
|
|
347
|
-
C(), E(!1), I(!1);
|
|
348
|
-
}, Ne = () => {
|
|
349
|
-
C(), A.current = window.setTimeout(() => E(!0), gn);
|
|
350
|
-
}, ae = () => {
|
|
351
|
-
C(), A.current = window.setTimeout(() => {
|
|
352
|
-
E(!1), I(!1);
|
|
353
|
-
}, wn);
|
|
354
|
-
}, oe = (_) => {
|
|
355
|
-
if (z(), n) {
|
|
356
|
-
n(_);
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
const w = d.items.find((Ce) => Ce.key === _);
|
|
360
|
-
w && r(w.to);
|
|
361
|
-
}, ve = /* @__PURE__ */ m("div", { className: l.card, role: "dialog", "aria-label": "账号", onMouseEnter: C, onMouseLeave: ae, children: [
|
|
362
|
-
/* @__PURE__ */ m("div", { className: l.identity, children: [
|
|
363
|
-
/* @__PURE__ */ a(ue, { nickName: U, member: se, size: 52 }),
|
|
364
|
-
/* @__PURE__ */ m("div", { className: l.who, children: [
|
|
365
|
-
/* @__PURE__ */ m("div", { className: l.nameRow, children: [
|
|
366
|
-
/* @__PURE__ */ a("span", { className: l.name, title: $ || W, children: $ || W }),
|
|
367
|
-
/* @__PURE__ */ a(Nn, { state: p })
|
|
368
|
-
] }),
|
|
369
|
-
g ? ne ? /* @__PURE__ */ m(
|
|
370
|
-
k,
|
|
371
|
-
{
|
|
372
|
-
theme: "borderless",
|
|
373
|
-
type: "tertiary",
|
|
374
|
-
size: "small",
|
|
375
|
-
className: l.spaceToggle,
|
|
376
|
-
"aria-expanded": R,
|
|
377
|
-
"aria-label": `当前空间:${X(g)},切换空间`,
|
|
378
|
-
onClick: () => I((_) => !_),
|
|
379
|
-
children: [
|
|
380
|
-
D(g) ? /* @__PURE__ */ a(ce, { "aria-hidden": "true" }) : /* @__PURE__ */ a(B, { "aria-hidden": "true" }),
|
|
381
|
-
/* @__PURE__ */ a(Y, { space: g }),
|
|
382
|
-
/* @__PURE__ */ a("span", { className: l.spaceSwitchText, children: "切换" }),
|
|
383
|
-
R ? /* @__PURE__ */ a($e, { "aria-hidden": "true" }) : /* @__PURE__ */ a(ze, { "aria-hidden": "true" })
|
|
384
|
-
]
|
|
385
|
-
}
|
|
386
|
-
) : /* @__PURE__ */ m("span", { className: l.spaceStatic, "aria-label": `当前空间:${X(g)}`, children: [
|
|
387
|
-
D(g) ? /* @__PURE__ */ a(ce, { "aria-hidden": "true" }) : /* @__PURE__ */ a(B, { "aria-hidden": "true" }),
|
|
388
|
-
/* @__PURE__ */ a(Y, { space: g })
|
|
389
|
-
] }) : null
|
|
390
|
-
] })
|
|
391
|
-
] }),
|
|
392
|
-
ne && R ? /* @__PURE__ */ a("div", { className: l.spaceList, role: "group", "aria-label": "切换空间", children: h.map((_) => {
|
|
393
|
-
const w = _.id === te;
|
|
394
|
-
return /* @__PURE__ */ m(
|
|
395
|
-
k,
|
|
396
|
-
{
|
|
397
|
-
theme: "borderless",
|
|
398
|
-
type: "tertiary",
|
|
399
|
-
block: !0,
|
|
400
|
-
className: l.spaceOption,
|
|
401
|
-
"aria-current": w ? "true" : void 0,
|
|
402
|
-
disabled: T && !w,
|
|
403
|
-
onClick: () => {
|
|
404
|
-
w || (z(), we(_.id));
|
|
405
|
-
},
|
|
406
|
-
children: [
|
|
407
|
-
/* @__PURE__ */ a("span", { className: l.spaceCheck, children: w ? /* @__PURE__ */ a(je, { "aria-hidden": "true" }) : null }),
|
|
408
|
-
/* @__PURE__ */ a(Y, { space: _ })
|
|
409
|
-
]
|
|
410
|
-
},
|
|
411
|
-
_.id
|
|
412
|
-
);
|
|
413
|
-
}) }) : null,
|
|
414
|
-
/* @__PURE__ */ a("div", { className: l.plan, children: /* @__PURE__ */ a(dn, { membership: u, onOpen: oe }) }),
|
|
415
|
-
/* @__PURE__ */ a("div", { className: l.links, role: "group", "aria-label": d.label, children: d.items.map((_) => /* @__PURE__ */ m(
|
|
416
|
-
k,
|
|
417
|
-
{
|
|
418
|
-
theme: "borderless",
|
|
419
|
-
type: "tertiary",
|
|
420
|
-
block: !0,
|
|
421
|
-
className: l.link,
|
|
422
|
-
"aria-current": _.key === t ? "page" : void 0,
|
|
423
|
-
onClick: () => oe(_.key),
|
|
424
|
-
children: [
|
|
425
|
-
_.icon ? /* @__PURE__ */ a("span", { className: l.linkIcon, "aria-hidden": "true", children: /* @__PURE__ */ a(_.icon, {}) }) : null,
|
|
426
|
-
/* @__PURE__ */ a("span", { className: l.linkLabel, children: _.label }),
|
|
427
|
-
/* @__PURE__ */ a(V, { className: l.linkArrow, "aria-hidden": "true" })
|
|
428
|
-
]
|
|
429
|
-
},
|
|
430
|
-
_.key
|
|
431
|
-
)) }),
|
|
432
|
-
/* @__PURE__ */ a("div", { className: l.divider, "aria-hidden": "true" }),
|
|
433
|
-
/* @__PURE__ */ a(
|
|
434
|
-
k,
|
|
435
|
-
{
|
|
436
|
-
theme: "borderless",
|
|
437
|
-
type: "tertiary",
|
|
438
|
-
block: !0,
|
|
439
|
-
className: l.logout,
|
|
440
|
-
disabled: S,
|
|
441
|
-
onClick: () => {
|
|
442
|
-
z(), y();
|
|
443
|
-
},
|
|
444
|
-
children: "退出登录"
|
|
445
|
-
}
|
|
446
|
-
)
|
|
447
|
-
] });
|
|
448
|
-
return /* @__PURE__ */ a(
|
|
449
|
-
xe,
|
|
450
|
-
{
|
|
451
|
-
trigger: "custom",
|
|
452
|
-
visible: F,
|
|
453
|
-
position: "bottomRight",
|
|
454
|
-
showArrow: !1,
|
|
455
|
-
spacing: 8,
|
|
456
|
-
className: l.popover,
|
|
457
|
-
content: ve,
|
|
458
|
-
onClickOutSide: z,
|
|
459
|
-
children: /* @__PURE__ */ a(
|
|
460
|
-
k,
|
|
461
|
-
{
|
|
462
|
-
theme: "borderless",
|
|
463
|
-
type: "tertiary",
|
|
464
|
-
className: l.trigger,
|
|
465
|
-
"aria-label": $ ? `${$},账号菜单` : "账号菜单",
|
|
466
|
-
"aria-haspopup": "dialog",
|
|
467
|
-
"aria-expanded": F,
|
|
468
|
-
loading: T,
|
|
469
|
-
onMouseEnter: Ne,
|
|
470
|
-
onMouseLeave: ae,
|
|
471
|
-
onClick: () => {
|
|
472
|
-
C(), E((_) => !_), F && I(!1);
|
|
473
|
-
},
|
|
474
|
-
children: /* @__PURE__ */ a(ue, { nickName: U, member: se, size: 34 })
|
|
475
|
-
}
|
|
476
|
-
)
|
|
477
|
-
}
|
|
478
|
-
);
|
|
479
|
-
}, vn = "_upgrade_ea6lf_2", Cn = "_crown_ea6lf_25", Sn = "_text_ea6lf_37", G = {
|
|
480
|
-
upgrade: vn,
|
|
481
|
-
crown: Cn,
|
|
482
|
-
text: Sn
|
|
483
|
-
}, Gn = () => {
|
|
484
|
-
const { config: e } = b(), t = J(), { state: n, canBuy: s } = ge();
|
|
485
|
-
if (!s || n.kind !== "free" && n.kind !== "team-expired") return null;
|
|
486
|
-
const o = n.kind === "team-expired" ? "续费团队版" : "开通会员";
|
|
487
|
-
return /* @__PURE__ */ m(k, { theme: "light", type: "tertiary", className: G.upgrade, onClick: () => t(N(e.routes.app, "subscription")), children: [
|
|
488
|
-
/* @__PURE__ */ a("span", { className: G.crown, "aria-hidden": "true" }),
|
|
489
|
-
/* @__PURE__ */ a("span", { className: G.text, children: o })
|
|
490
|
-
] });
|
|
491
|
-
}, Tn = "_wallet_weimr_2", An = "_coin_weimr_25", Pn = "_value_weimr_32", Q = {
|
|
492
|
-
wallet: Tn,
|
|
493
|
-
coin: An,
|
|
494
|
-
value: Pn
|
|
495
|
-
}, Qn = () => {
|
|
496
|
-
const { accountApi: e, config: t } = b(), { session: n } = M(), s = J(), o = (n == null ? void 0 : n.activeSpaceId) ?? "", r = (n == null ? void 0 : n.globalUserId) ?? "", d = P({
|
|
497
|
-
queryKey: L.wallet(o, r),
|
|
498
|
-
queryFn: () => e.getWallet(),
|
|
499
|
-
enabled: !!n,
|
|
500
|
-
refetchOnWindowFocus: !0
|
|
501
|
-
});
|
|
502
|
-
if (!n) return null;
|
|
503
|
-
const u = d.isPending ? "读取中" : d.data ? v(d.data.availablePoints) : "积分暂不可用";
|
|
504
|
-
return /* @__PURE__ */ a(Le, { content: "当前空间可用积分,由统一账号中心记账", children: /* @__PURE__ */ m(
|
|
505
|
-
k,
|
|
506
|
-
{
|
|
507
|
-
theme: "light",
|
|
508
|
-
type: "tertiary",
|
|
509
|
-
className: Q.wallet,
|
|
510
|
-
"aria-label": d.data ? `积分 ${u}` : u,
|
|
511
|
-
onClick: () => s(N(t.routes.app, "points")),
|
|
512
|
-
children: [
|
|
513
|
-
/* @__PURE__ */ a("span", { className: Q.coin, "aria-hidden": "true" }),
|
|
514
|
-
/* @__PURE__ */ a("span", { className: Q.value, children: u })
|
|
515
|
-
]
|
|
516
|
-
}
|
|
517
|
-
) });
|
|
518
|
-
};
|
|
519
|
-
export {
|
|
520
|
-
pt as A,
|
|
521
|
-
ht as B,
|
|
522
|
-
Rn as C,
|
|
523
|
-
Mn as D,
|
|
524
|
-
St as E,
|
|
525
|
-
W as F,
|
|
526
|
-
Fn as G,
|
|
527
|
-
X as H,
|
|
528
|
-
Wn as I,
|
|
529
|
-
xt as J,
|
|
530
|
-
Lt as K,
|
|
531
|
-
hn as L,
|
|
532
|
-
fn as M,
|
|
533
|
-
ge as N,
|
|
534
|
-
kn as O,
|
|
535
|
-
x as P,
|
|
536
|
-
bn as Q,
|
|
537
|
-
kt as U,
|
|
538
|
-
Qn as W,
|
|
539
|
-
ue as a,
|
|
540
|
-
Yn as b,
|
|
541
|
-
un as c,
|
|
542
|
-
dn as d,
|
|
543
|
-
Gn as e,
|
|
544
|
-
L as f,
|
|
545
|
-
N as g,
|
|
546
|
-
yt as h,
|
|
547
|
-
pn as i,
|
|
548
|
-
Et as j,
|
|
549
|
-
qn as k,
|
|
550
|
-
wt as l,
|
|
551
|
-
At as m,
|
|
552
|
-
Pt as n,
|
|
553
|
-
Dn as o,
|
|
554
|
-
ft as p,
|
|
555
|
-
D as q,
|
|
556
|
-
_n as r,
|
|
557
|
-
Z as s,
|
|
558
|
-
It as t,
|
|
559
|
-
j as u,
|
|
560
|
-
Ct as v,
|
|
561
|
-
Kn as w,
|
|
562
|
-
Un as x,
|
|
563
|
-
Nt as y,
|
|
564
|
-
H as z
|
|
565
|
-
};
|