@24city/web-console 0.1.3 → 0.2.0
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 +52 -0
- package/GUIDELINES.md +223 -0
- package/README.md +42 -10
- package/dist/account/index.js +2 -2
- package/dist/chunks/console-layout-DH-aROYp.js +209 -0
- package/dist/chunks/page-YBG0dEN1.js +111 -0
- package/dist/chunks/scale-smFifpMm.js +26 -0
- package/dist/chunks/{stale-build-DUKkQHuu.js → stale-build-DG-Tb2RA.js} +24 -20
- package/dist/chunks/status-tag-BrLUhH6Z.js +87 -0
- package/dist/chunks/text-link-BAKoHe5o.js +64 -0
- package/dist/chunks/unsupported-browser-Dwq1mNRy.js +48 -0
- package/dist/chunks/upgrade-modal-DgChxbLm.js +667 -0
- package/dist/chunks/{wallet-badge-BXu-WxJa.js → wallet-badge-dVrO6py9.js} +136 -136
- package/dist/chunks/waterfall-CQG8aVdx.js +613 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.js +6 -0
- package/dist/data/metric-card.d.ts +41 -0
- package/dist/data/status-tag.d.ts +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +160 -120
- package/dist/layout/index.js +1 -1
- package/dist/list/choice-cards.d.ts +29 -0
- package/dist/list/content-square.d.ts +50 -0
- package/dist/list/filter-dropdown.d.ts +43 -0
- package/dist/list/filter-panel.d.ts +94 -0
- package/dist/list/index.d.ts +7 -0
- package/dist/list/index.js +27 -0
- package/dist/list/list-toolbar.d.ts +56 -0
- package/dist/list/waterfall-layout.d.ts +11 -0
- package/dist/list/waterfall.d.ts +13 -0
- package/dist/page/index.d.ts +2 -0
- package/dist/page/index.js +19 -15
- package/dist/page/page.d.ts +21 -2
- package/dist/page/select-label.d.ts +11 -0
- package/dist/page/unsupported-browser.d.ts +2 -0
- package/dist/runtime/browser-support.d.ts +6 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +38 -37
- package/dist/runtime/providers.d.ts +1 -1
- package/dist/styles.css +1962 -581
- package/dist/testing/guard.d.ts +20 -0
- package/dist/testing/guard.js +83 -36
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +29 -25
- package/dist/theme/scale.d.ts +34 -0
- package/package.json +13 -2
- package/dist/chunks/console-layout-D5YgsZYN.js +0 -208
- package/dist/chunks/error-boundary-D3qiD7ov.js +0 -35
- package/dist/chunks/page-BaitnD--.js +0 -89
- package/dist/chunks/text-link-FTsBp_QU.js +0 -54
- package/dist/chunks/upgrade-modal-J0X79nT2.js +0 -667
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as s, jsxs as m, Fragment as me } from "react/jsx-runtime";
|
|
2
|
-
import { useState as B, useRef as pe, useCallback as
|
|
3
|
-
import { Skeleton as
|
|
2
|
+
import { useState as B, useRef as pe, useCallback as Se, useEffect as Te } from "react";
|
|
3
|
+
import { Skeleton as ce, Button as b, Toast as _e, Modal as Ae, Avatar as xe, Popover as Pe, Tooltip as Le } from "@douyinfe/semi-ui";
|
|
4
4
|
import { IconUser as D, IconCrown as Ee, IconGift as Ie, IconChevronRight as V, IconUserGroup as ie, IconChevronUp as $e, IconChevronDown as ze, IconTick as Oe } from "@douyinfe/semi-icons";
|
|
5
5
|
import { useNavigate as J } from "react-router";
|
|
6
|
-
import { a as
|
|
6
|
+
import { a as ye, b as g } from "./context-CaVim6ZO.js";
|
|
7
7
|
import { q as v, k as Be, a as De, t as he, w as Me, l as Fe, u as F, g as Re, f as le } from "./logout-signal-CiD_zY5M.js";
|
|
8
|
-
import { useQueryClient as
|
|
8
|
+
import { useQueryClient as fe, useQuery as x } from "@tanstack/react-query";
|
|
9
9
|
import { notifyCustomerSessionChanged as be } from "@24city/web-runtime/session-sync";
|
|
10
|
-
const Ue = "
|
|
10
|
+
const Ue = "_trigger_mz24a_6", Ke = "_avatarWrap_mz24a_27", qe = "_avatar_mz24a_27", We = "_card_mz24a_80", Ye = "_identity_mz24a_90", Ge = "_who_mz24a_98", je = "_nameRow_mz24a_107", Qe = "_name_mz24a_107", Ve = "_planChip_mz24a_124", He = "_diamond_mz24a_154", Xe = "_spaceToggle_mz24a_162", Je = "_spaceStatic_mz24a_163", Ze = "_spaceSwitchText_mz24a_184", et = "_spaceName_mz24a_190", tt = "_spaceType_mz24a_196", nt = "_spaceList_mz24a_206", at = "_spaceOption_mz24a_215", st = "_spaceCheck_mz24a_237", ot = "_plan_mz24a_124", rt = "_links_mz24a_249", ct = "_link_mz24a_249", it = "_linkIcon_mz24a_287", lt = "_linkLabel_mz24a_298", dt = "_linkArrow_mz24a_303", ut = "_divider_mz24a_309", mt = "_logout_mz24a_315", l = {
|
|
11
11
|
trigger: Ue,
|
|
12
12
|
avatarWrap: Ke,
|
|
13
13
|
avatar: qe,
|
|
@@ -27,39 +27,39 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
27
27
|
spaceOption: at,
|
|
28
28
|
spaceCheck: st,
|
|
29
29
|
plan: ot,
|
|
30
|
-
links:
|
|
31
|
-
link:
|
|
30
|
+
links: rt,
|
|
31
|
+
link: ct,
|
|
32
32
|
linkIcon: it,
|
|
33
33
|
linkLabel: lt,
|
|
34
34
|
linkArrow: dt,
|
|
35
35
|
divider: ut,
|
|
36
36
|
logout: mt
|
|
37
|
-
}, pt = ["profile", "subscription", "points"], _t = (e) => pt.includes(e),
|
|
37
|
+
}, pt = ["profile", "subscription", "points"], _t = (e) => pt.includes(e), w = (e, t) => `${e}/account/${t}`, Mn = (e, t) => t === `${e}/account` || t.startsWith(`${e}/account/`), O = (e) => `account-${e}`, P = {
|
|
38
38
|
profile: O("profile"),
|
|
39
39
|
subscription: O("subscription"),
|
|
40
40
|
points: O("points")
|
|
41
|
-
},
|
|
41
|
+
}, yt = /^[a-z][a-z0-9-]{0,31}$/, ht = (e) => {
|
|
42
42
|
const t = e.accountSections ?? [], n = /* @__PURE__ */ new Set();
|
|
43
43
|
for (const a of t) {
|
|
44
|
-
if (!
|
|
44
|
+
if (!yt.test(a.key))
|
|
45
45
|
throw new Error(`个人中心分区 key 不合法:${a.key}(小写字母开头,只含小写字母、数字和连字符)`);
|
|
46
46
|
if (_t(a.key)) throw new Error(`个人中心分区 key 与内置分区重名:${a.key}`);
|
|
47
47
|
if (n.has(a.key)) throw new Error(`个人中心分区 key 重复:${a.key}`);
|
|
48
48
|
n.add(a.key);
|
|
49
49
|
}
|
|
50
50
|
return t;
|
|
51
|
-
},
|
|
51
|
+
}, ft = (e, t = []) => ({
|
|
52
52
|
key: "personal",
|
|
53
53
|
label: "个人中心",
|
|
54
54
|
items: [
|
|
55
|
-
{ key: P.profile, label: "账号与安全", to:
|
|
56
|
-
{ key: P.subscription, label: "订阅与套餐", to:
|
|
57
|
-
{ key: P.points, label: "积分与明细", to:
|
|
55
|
+
{ key: P.profile, label: "账号与安全", to: w(e, "profile"), icon: D },
|
|
56
|
+
{ key: P.subscription, label: "订阅与套餐", to: w(e, "subscription"), icon: Ee },
|
|
57
|
+
{ key: P.points, label: "积分与明细", to: w(e, "points"), icon: Ie },
|
|
58
58
|
...t.map(
|
|
59
59
|
(n) => ({
|
|
60
60
|
key: O(n.key),
|
|
61
61
|
label: n.label,
|
|
62
|
-
to:
|
|
62
|
+
to: w(e, n.key),
|
|
63
63
|
icon: n.icon
|
|
64
64
|
})
|
|
65
65
|
)
|
|
@@ -76,53 +76,53 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
76
76
|
return new Set(
|
|
77
77
|
[...t].filter((n) => e.every((a) => a.benefits.some((o) => o.key === n && o.limit === null)))
|
|
78
78
|
);
|
|
79
|
-
},
|
|
79
|
+
}, Nt = (e, t = [], n = {}) => {
|
|
80
80
|
var u;
|
|
81
|
-
const a = n.benefitCopy ?? [], o = kt(t),
|
|
82
|
-
for (const
|
|
83
|
-
!
|
|
81
|
+
const a = n.benefitCopy ?? [], o = kt(t), r = [];
|
|
82
|
+
for (const c of [...e.benefits, ...t.flatMap((p) => p.benefits)])
|
|
83
|
+
!r.includes(c.key) && !o.has(c.key) && r.push(c.key);
|
|
84
84
|
const d = [];
|
|
85
|
-
for (const
|
|
86
|
-
const p = e.benefits.find((h) => h.key ===
|
|
85
|
+
for (const c of [...r].sort((p, _) => de(a, p) - de(a, _) || r.indexOf(p) - r.indexOf(_))) {
|
|
86
|
+
const p = e.benefits.find((h) => h.key === c);
|
|
87
87
|
if (p) {
|
|
88
88
|
d.push({ text: gt(a, p), included: !0 });
|
|
89
89
|
continue;
|
|
90
90
|
}
|
|
91
|
-
const _ = (u = ge(a,
|
|
91
|
+
const _ = (u = ge(a, c)) == null ? void 0 : u.off;
|
|
92
92
|
_ && d.push({ text: _, included: !1 });
|
|
93
93
|
}
|
|
94
94
|
return d;
|
|
95
|
-
}, H = (e) => e.planName || e.planCode,
|
|
95
|
+
}, H = (e) => e.planName || e.planCode, wt = (e) => e.isDefault || !e.currentPeriodEnd ? "长期有效" : `有效期至 ${Be(e.currentPeriodEnd)}`, vt = 1440 * 60 * 1e3, Ct = (e, t = Date.now()) => {
|
|
96
96
|
if (e.isDefault || !e.currentPeriodEnd) return null;
|
|
97
97
|
const n = Date.parse(e.currentPeriodEnd);
|
|
98
98
|
return Number.isFinite(n) ? Math.max(0, Math.ceil((n - t) / vt)) : null;
|
|
99
|
-
},
|
|
99
|
+
}, St = 7, Tt = { month: "/月", year: "/年", one_time: "" }, At = (e) => {
|
|
100
100
|
const t = (e.amountCents / 100).toLocaleString("zh-CN", { maximumFractionDigits: 2 });
|
|
101
101
|
return e.currency === "CNY" ? `¥${t}` : `${e.currency} ${t}`;
|
|
102
102
|
}, Kn = (e) => e ? { focusPlan: e } : void 0, qn = (e) => {
|
|
103
103
|
if (typeof e != "object" || e === null) return;
|
|
104
104
|
const t = e.focusPlan;
|
|
105
105
|
return typeof t == "string" && t ? t : void 0;
|
|
106
|
-
},
|
|
106
|
+
}, xt = (e) => `${At(e)}${Tt[e.billingPeriod]}`, Pt = (e) => {
|
|
107
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,
|
|
108
|
+
return (n.length ? n : t).reduce((o, r) => !o || r.amountCents < o.amountCents ? r : o, null);
|
|
109
109
|
}, Lt = (e, t, n) => {
|
|
110
110
|
const o = (e ?? []).filter(
|
|
111
|
-
(
|
|
112
|
-
).map((
|
|
111
|
+
(r) => r.spaceType === t && !r.isDefault && (n === null || r.tier > n)
|
|
112
|
+
).map((r) => ({ plan: r, price: Pt(r) }));
|
|
113
113
|
return o.sort(
|
|
114
|
-
(
|
|
115
|
-
var u,
|
|
116
|
-
return
|
|
114
|
+
(r, d) => {
|
|
115
|
+
var u, c;
|
|
116
|
+
return r.plan.tier - d.plan.tier || (((u = r.price) == null ? void 0 : u.amountCents) ?? Number.MAX_SAFE_INTEGER) - (((c = d.price) == null ? void 0 : c.amountCents) ?? Number.MAX_SAFE_INTEGER);
|
|
117
117
|
}
|
|
118
118
|
), o[0] ?? null;
|
|
119
119
|
}, Wn = (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
120
|
if (!e) return ["积分按月发放", "24.city 全产品通用"];
|
|
121
121
|
const a = [];
|
|
122
122
|
e.monthlyPoints > 0 && a.push(`每月 ${v(e.monthlyPoints)} 积分`);
|
|
123
|
-
for (const o of
|
|
123
|
+
for (const o of Nt(e, t, n).filter((r) => r.included).slice(0, 2)) a.push(o.text);
|
|
124
124
|
return a.length < 2 && a.push("24.city 全产品通用"), a;
|
|
125
|
-
}, $t = "
|
|
125
|
+
}, $t = "_promo_62y38_6", zt = "_member_62y38_7", Ot = "_plain_62y38_8", Bt = "_promoArt_62y38_28", Dt = "_promoBody_62y38_38", Mt = "_promoTitle_62y38_44", Ft = "_promoText_62y38_55", Rt = "_cta_62y38_63", Ut = "_ctaButton_62y38_69", Kt = "_ctaTag_62y38_89", qt = "_ownerOnly_62y38_106", Wt = "_memberArt_62y38_122", Yt = "_memberBody_62y38_132", Gt = "_memberEyebrow_62y38_139", jt = "_memberTitle_62y38_145", Qt = "_memberMeta_62y38_159", Vt = "_memberCta_62y38_166", Ht = "_plainBody_62y38_200", Xt = "_plainText_62y38_207", Jt = "_retry_62y38_212", Zt = "_loading_62y38_216", en = "_assets_62y38_224", tn = "_asset_62y38_224", nn = "_coin_62y38_279", an = "_assetLabel_62y38_287", sn = "_assetValue_62y38_291", on = "_assetArrow_62y38_299", rn = "_assetDivider_62y38_312", i = {
|
|
126
126
|
promo: $t,
|
|
127
127
|
member: zt,
|
|
128
128
|
plain: Ot,
|
|
@@ -150,13 +150,13 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
150
150
|
assetLabel: an,
|
|
151
151
|
assetValue: sn,
|
|
152
152
|
assetArrow: on,
|
|
153
|
-
assetDivider:
|
|
154
|
-
},
|
|
153
|
+
assetDivider: rn
|
|
154
|
+
}, cn = P.points, ee = P.subscription, ln = ({ membership: e, text: t, onOpen: n }) => {
|
|
155
155
|
const { canBuy: a, offer: o } = e;
|
|
156
156
|
return a ? /* @__PURE__ */ m("span", { className: i.cta, children: [
|
|
157
157
|
/* @__PURE__ */ s(b, { theme: "light", type: "tertiary", block: !0, className: i.ctaButton, onClick: () => n(ee), children: t }),
|
|
158
158
|
o != null && o.price ? /* @__PURE__ */ m("span", { className: i.ctaTag, children: [
|
|
159
|
-
|
|
159
|
+
xt(o.price),
|
|
160
160
|
"起"
|
|
161
161
|
] }) : null
|
|
162
162
|
] }) : /* @__PURE__ */ s("span", { className: i.ownerOnly, children: "请团队所有者在统一账号中心续费" });
|
|
@@ -167,7 +167,7 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
167
167
|
}) => {
|
|
168
168
|
const { wallet: a } = e, o = a.isPending ? "…" : a.data ? v(a.data.availablePoints) : "暂不可用";
|
|
169
169
|
return /* @__PURE__ */ m("div", { className: i.assets, children: [
|
|
170
|
-
/* @__PURE__ */ m(b, { theme: "borderless", type: "tertiary", className: i.asset, "aria-label": `可用积分 ${o},查看积分与明细`, onClick: () => n(
|
|
170
|
+
/* @__PURE__ */ m(b, { theme: "borderless", type: "tertiary", className: i.asset, "aria-label": `可用积分 ${o},查看积分与明细`, onClick: () => n(cn), children: [
|
|
171
171
|
/* @__PURE__ */ s("span", { className: i.coin, "aria-hidden": "true" }),
|
|
172
172
|
/* @__PURE__ */ s("span", { className: i.assetLabel, children: "积分" }),
|
|
173
173
|
/* @__PURE__ */ s("span", { className: i.assetValue, children: o }),
|
|
@@ -182,9 +182,9 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
182
182
|
] }) : null
|
|
183
183
|
] });
|
|
184
184
|
}, dn = ({ membership: e, onOpen: t }) => {
|
|
185
|
-
const n =
|
|
185
|
+
const n = ye(), { state: a, offer: o, currentPlan: r, subscription: d } = e;
|
|
186
186
|
if (a.kind === "loading")
|
|
187
|
-
return /* @__PURE__ */ s("div", { className: i.loading, children: /* @__PURE__ */ s(
|
|
187
|
+
return /* @__PURE__ */ s("div", { className: i.loading, children: /* @__PURE__ */ s(ce, { loading: !0, active: !0, placeholder: /* @__PURE__ */ s(ce.Paragraph, { rows: 3 }) }) });
|
|
188
188
|
if (a.kind === "error")
|
|
189
189
|
return /* @__PURE__ */ m("div", { className: i.plain, children: [
|
|
190
190
|
/* @__PURE__ */ m("div", { className: i.plainBody, children: [
|
|
@@ -194,48 +194,48 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
194
194
|
/* @__PURE__ */ s(q, { membership: e, onOpen: t })
|
|
195
195
|
] });
|
|
196
196
|
if (a.kind === "member") {
|
|
197
|
-
const { subscription: h, daysLeft:
|
|
198
|
-
return /* @__PURE__ */ m("div", { className: i.member, "data-expiring":
|
|
197
|
+
const { subscription: h, daysLeft: f } = a, S = f !== null && f <= St, T = (r == null ? void 0 : r.monthlyPoints) ?? 0;
|
|
198
|
+
return /* @__PURE__ */ m("div", { className: i.member, "data-expiring": S ? "true" : "false", children: [
|
|
199
199
|
/* @__PURE__ */ s("span", { className: i.memberArt, "aria-hidden": "true" }),
|
|
200
200
|
/* @__PURE__ */ m("div", { className: i.memberBody, children: [
|
|
201
201
|
/* @__PURE__ */ m("span", { className: i.memberEyebrow, children: [
|
|
202
202
|
"当前会员",
|
|
203
|
-
|
|
203
|
+
T > 0 ? ` · 每月 ${v(T)} 积分` : ""
|
|
204
204
|
] }),
|
|
205
205
|
/* @__PURE__ */ s("span", { className: i.memberTitle, children: H(h) }),
|
|
206
|
-
/* @__PURE__ */ s("span", { className: i.memberMeta, children:
|
|
207
|
-
e.canBuy ? /* @__PURE__ */ s(b, { theme: "light", type: "tertiary", size: "small", className: i.memberCta, onClick: () => t(ee), children:
|
|
206
|
+
/* @__PURE__ */ s("span", { className: i.memberMeta, children: wt(h) }),
|
|
207
|
+
e.canBuy ? /* @__PURE__ */ s(b, { theme: "light", type: "tertiary", size: "small", className: i.memberCta, onClick: () => t(ee), children: S ? "立即续费" : o ? "续费或升级" : "续费" }) : null
|
|
208
208
|
] }),
|
|
209
209
|
/* @__PURE__ */ s(
|
|
210
210
|
q,
|
|
211
211
|
{
|
|
212
212
|
membership: e,
|
|
213
213
|
onOpen: t,
|
|
214
|
-
extra:
|
|
214
|
+
extra: f === null ? void 0 : { label: f === 0 ? "今天到期" : `剩余 ${f} 天`, tone: S ? "warning" : void 0 }
|
|
215
215
|
}
|
|
216
216
|
)
|
|
217
217
|
] });
|
|
218
218
|
}
|
|
219
|
-
const u = a.kind === "team-expired",
|
|
219
|
+
const u = a.kind === "team-expired", c = u ? "团队版已到期" : o ? `升级${o.plan.name},畅享更多` : "开通会员畅享", p = u ? "续费后团队成员继续共用套餐和积分" : It(o == null ? void 0 : o.plan, e.plans.data ?? [], n).join(" · "), _ = u ? 0 : (r == null ? void 0 : r.monthlyPoints) ?? 0;
|
|
220
220
|
return /* @__PURE__ */ m("div", { className: i.promo, "data-tone": u ? "team" : "free", children: [
|
|
221
221
|
/* @__PURE__ */ s("span", { className: i.promoArt, "aria-hidden": "true" }),
|
|
222
222
|
/* @__PURE__ */ m("div", { className: i.promoBody, children: [
|
|
223
|
-
/* @__PURE__ */ s("span", { className: i.promoTitle, children:
|
|
223
|
+
/* @__PURE__ */ s("span", { className: i.promoTitle, children: c }),
|
|
224
224
|
/* @__PURE__ */ s("span", { className: i.promoText, children: p }),
|
|
225
225
|
/* @__PURE__ */ s(ln, { membership: e, text: u ? "续费团队版" : "立即开通会员", onOpen: t })
|
|
226
226
|
] }),
|
|
227
227
|
/* @__PURE__ */ s(q, { membership: e, onOpen: t, extra: _ > 0 ? { label: `免费版每月赠 ${v(_)}` } : void 0 })
|
|
228
228
|
] });
|
|
229
229
|
}, un = "个人空间", M = (e) => e.type === "team", X = (e) => e.type === "personal" ? un : e.name || e.slug, mn = { owner: "所有者", admin: "管理员", member: "成员" }, Yn = (e) => e ? mn[e] ?? "" : "", pn = (e) => !!(e && (e.type === "personal" || e.role === "owner")), _n = () => {
|
|
230
|
-
const [e, t] = B(!1), n =
|
|
230
|
+
const [e, t] = B(!1), n = fe(), { accountApi: a, config: o } = g(), r = async () => {
|
|
231
231
|
if (e) return;
|
|
232
232
|
t(!0), De();
|
|
233
233
|
let u = o.routes.publicHome;
|
|
234
234
|
try {
|
|
235
|
-
const { endSessionUrl:
|
|
236
|
-
|
|
237
|
-
} catch (
|
|
238
|
-
if (!he(
|
|
235
|
+
const { endSessionUrl: c } = await a.logout();
|
|
236
|
+
c && (u = c);
|
|
237
|
+
} catch (c) {
|
|
238
|
+
if (!he(c, 401)) {
|
|
239
239
|
Me(), _e.error("退出失败,请重试"), t(!1);
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
@@ -245,16 +245,16 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
245
245
|
});
|
|
246
246
|
};
|
|
247
247
|
return { confirmLogout: () => {
|
|
248
|
-
e ||
|
|
248
|
+
e || Ae.confirm({
|
|
249
249
|
title: "退出登录",
|
|
250
250
|
content: "将同时退出 24.city 统一账号并回到首页,再次进入工作台需要重新登录。",
|
|
251
251
|
okText: "退出登录",
|
|
252
252
|
cancelText: "取消",
|
|
253
253
|
okButtonProps: { type: "danger" },
|
|
254
|
-
onOk:
|
|
254
|
+
onOk: r
|
|
255
255
|
});
|
|
256
|
-
}, logout:
|
|
257
|
-
}, W = (e) => typeof e == "object" && e !== null && !Array.isArray(e),
|
|
256
|
+
}, logout: r, pending: e };
|
|
257
|
+
}, W = (e) => typeof e == "object" && e !== null && !Array.isArray(e), yn = (e) => {
|
|
258
258
|
if (!he(e, 403) || !W(e) || !W(e.response)) return !1;
|
|
259
259
|
const t = e.response.data;
|
|
260
260
|
return W(t) && t.reason === "team_subscription_required";
|
|
@@ -264,58 +264,58 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
264
264
|
subscription: (e, t) => ["product-subscription", e, t],
|
|
265
265
|
plans: ["product-plans"]
|
|
266
266
|
}, hn = () => {
|
|
267
|
-
const { accountApi: e } = g(), { session: t, spaces: n } = F(), a = (t == null ? void 0 : t.activeSpaceId) ?? "", o = (t == null ? void 0 : t.globalUserId) ?? "",
|
|
267
|
+
const { accountApi: e } = g(), { session: t, spaces: n } = F(), a = (t == null ? void 0 : t.activeSpaceId) ?? "", o = (t == null ? void 0 : t.globalUserId) ?? "", r = (t == null ? void 0 : t.purpose) === "user" && !!(a && o), d = n.find((_) => _.id === a), u = x({
|
|
268
268
|
queryKey: L.profile(o),
|
|
269
269
|
queryFn: () => e.getProfile(),
|
|
270
270
|
enabled: !!o,
|
|
271
271
|
staleTime: 1 / 0
|
|
272
|
-
}),
|
|
272
|
+
}), c = x({
|
|
273
273
|
queryKey: L.wallet(a, o),
|
|
274
274
|
queryFn: () => e.getWallet(),
|
|
275
|
-
enabled:
|
|
276
|
-
}), p =
|
|
275
|
+
enabled: r
|
|
276
|
+
}), p = x({
|
|
277
277
|
queryKey: L.subscription(a, o),
|
|
278
278
|
queryFn: () => e.getSubscription(),
|
|
279
|
-
enabled:
|
|
279
|
+
enabled: r
|
|
280
280
|
});
|
|
281
|
-
return { session: t, allowed:
|
|
282
|
-
},
|
|
281
|
+
return { session: t, allowed: r, activeSpace: d, activeSpaceId: a, globalUserId: o, profile: u, wallet: c, subscription: p };
|
|
282
|
+
}, fn = 5 * 6e4, bn = (e) => {
|
|
283
283
|
const { accountApi: t } = g();
|
|
284
|
-
return
|
|
284
|
+
return x({
|
|
285
285
|
queryKey: L.plans,
|
|
286
286
|
queryFn: () => t.getPlans(),
|
|
287
287
|
enabled: e,
|
|
288
|
-
staleTime:
|
|
288
|
+
staleTime: fn
|
|
289
289
|
});
|
|
290
290
|
}, ke = () => {
|
|
291
|
-
var
|
|
292
|
-
const { config: e } = g(), t = hn(), { activeSpace: n, subscription: a, allowed: o } = t,
|
|
293
|
-
let
|
|
294
|
-
!o || a.isPending ?
|
|
295
|
-
const p =
|
|
291
|
+
var f;
|
|
292
|
+
const { config: e } = g(), t = hn(), { activeSpace: n, subscription: a, allowed: o } = t, r = bn(o), d = n ? M(n) : !1, u = d ? "team" : "personal";
|
|
293
|
+
let c;
|
|
294
|
+
!o || a.isPending ? c = { kind: "loading" } : a.isError ? c = yn(a.error) ? { kind: "team-expired" } : { kind: "error" } : !a.data || a.data.isDefault ? c = { kind: "free", subscription: a.data ?? null } : c = { kind: "member", subscription: a.data, daysLeft: Ct(a.data) };
|
|
295
|
+
const p = c.kind === "free" || c.kind === "member" ? ((f = c.subscription) == null ? void 0 : f.tier) ?? null : null, _ = c.kind === "free" || c.kind === "member" || c.kind === "team-expired" ? Lt(r.data, u, p) : null, h = (c.kind === "free" || c.kind === "member") && c.subscription ? Et(r.data, c.subscription) : void 0;
|
|
296
296
|
return {
|
|
297
297
|
...t,
|
|
298
|
-
plans:
|
|
299
|
-
state:
|
|
298
|
+
plans: r,
|
|
299
|
+
state: c,
|
|
300
300
|
offer: _,
|
|
301
301
|
currentPlan: h,
|
|
302
302
|
team: d,
|
|
303
303
|
/** 个人空间是自己的;团队空间只有所有者能买(STD-BILLING-001) */
|
|
304
304
|
canBuy: pn(n),
|
|
305
305
|
/** 「订阅与套餐」的站内地址 */
|
|
306
|
-
subscriptionPath:
|
|
306
|
+
subscriptionPath: w(e.routes.app, "subscription")
|
|
307
307
|
};
|
|
308
308
|
}, gn = () => {
|
|
309
|
-
const e =
|
|
309
|
+
const e = fe(), t = Re(), { session: n } = F(), { accountApi: a } = g(), [o, r] = B(!1), d = pe(0), u = n == null ? void 0 : n.activeSpaceId, c = Se(
|
|
310
310
|
async (p) => {
|
|
311
311
|
if (!p || p === u || o) return;
|
|
312
312
|
const _ = ++d.current;
|
|
313
|
-
|
|
313
|
+
r(!0);
|
|
314
314
|
try {
|
|
315
315
|
if (await e.cancelQueries(), e.clear(), (await a.switchSpace(p)).activeSpaceId !== p) throw new Error("空间切换响应与请求不一致");
|
|
316
|
-
const
|
|
316
|
+
const f = await le(a);
|
|
317
317
|
if (d.current !== _) return;
|
|
318
|
-
t.setContext(
|
|
318
|
+
t.setContext(f), be();
|
|
319
319
|
} catch {
|
|
320
320
|
if (d.current !== _) return;
|
|
321
321
|
try {
|
|
@@ -325,46 +325,46 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
325
325
|
e.clear(), t.clear({ unavailable: !0 });
|
|
326
326
|
}
|
|
327
327
|
} finally {
|
|
328
|
-
d.current === _ &&
|
|
328
|
+
d.current === _ && r(!1);
|
|
329
329
|
}
|
|
330
330
|
},
|
|
331
331
|
[a, u, t, e, o]
|
|
332
332
|
);
|
|
333
|
-
return { switching: o, switchSpace:
|
|
334
|
-
}, Y = "我的账号", kn = 80,
|
|
333
|
+
return { switching: o, switchSpace: c };
|
|
334
|
+
}, Y = "我的账号", kn = 80, Nn = 200, G = ({ space: e }) => /* @__PURE__ */ m(me, { children: [
|
|
335
335
|
/* @__PURE__ */ s("span", { className: l.spaceName, children: X(e) }),
|
|
336
336
|
M(e) ? /* @__PURE__ */ s("span", { className: l.spaceType, children: "团队" }) : null
|
|
337
|
-
] }), ue = ({ nickName: e, member: t, size: n }) => /* @__PURE__ */ s("span", { className: l.avatarWrap, "data-member": t ? "true" : "false", "data-size": n > 40 ? "large" : "small", children: /* @__PURE__ */ s(
|
|
337
|
+
] }), ue = ({ nickName: e, member: t, size: n }) => /* @__PURE__ */ s("span", { className: l.avatarWrap, "data-member": t ? "true" : "false", "data-size": n > 40 ? "large" : "small", children: /* @__PURE__ */ s(xe, { size: "small", shape: "circle", className: l.avatar, style: { width: n, height: n }, children: e ? Array.from(e)[0] : /* @__PURE__ */ s(D, { "aria-hidden": "true" }) }) }), wn = ({ state: e }) => e.kind === "member" ? /* @__PURE__ */ m("span", { className: l.planChip, "data-tone": "member", children: [
|
|
338
338
|
/* @__PURE__ */ s("span", { className: l.diamond, "aria-hidden": "true" }),
|
|
339
339
|
H(e.subscription)
|
|
340
340
|
] }) : e.kind === "free" ? /* @__PURE__ */ s("span", { className: l.planChip, "data-tone": "free", children: e.subscription ? H(e.subscription) : "未开通" }) : e.kind === "team-expired" ? /* @__PURE__ */ s("span", { className: l.planChip, "data-tone": "warning", children: "团队版已到期" }) : null, Gn = ({ personal: e, selectedKey: t, onOpen: n }) => {
|
|
341
|
-
var
|
|
342
|
-
const { config: a } = g(), o =
|
|
343
|
-
|
|
341
|
+
var re;
|
|
342
|
+
const { config: a } = g(), o = ye(), r = J(), d = e ?? ft(a.routes.app, ht(o)), u = ke(), { profile: c, state: p } = u, { session: _, spaces: h } = F(), { confirmLogout: f, pending: S } = _n(), { switching: T, switchSpace: Ne } = gn(), [R, E] = B(!1), [U, I] = B(!1), A = pe(void 0), K = ((re = c.data) == null ? void 0 : re.nickName) ?? "", $ = K || (c.isPending ? "" : Y), te = (_ == null ? void 0 : _.activeSpaceId) ?? "", k = h.find((y) => y.id === te), ne = h.length > 1, ae = p.kind === "member", C = () => {
|
|
343
|
+
A.current !== void 0 && (window.clearTimeout(A.current), A.current = void 0);
|
|
344
344
|
};
|
|
345
|
-
|
|
345
|
+
Te(() => C, []);
|
|
346
346
|
const z = () => {
|
|
347
|
-
|
|
348
|
-
},
|
|
349
|
-
|
|
347
|
+
C(), E(!1), I(!1);
|
|
348
|
+
}, we = () => {
|
|
349
|
+
C(), A.current = window.setTimeout(() => E(!0), kn);
|
|
350
350
|
}, se = () => {
|
|
351
|
-
|
|
351
|
+
C(), A.current = window.setTimeout(() => {
|
|
352
352
|
E(!1), I(!1);
|
|
353
|
-
},
|
|
354
|
-
}, oe = (
|
|
353
|
+
}, Nn);
|
|
354
|
+
}, oe = (y) => {
|
|
355
355
|
if (z(), n) {
|
|
356
|
-
n(
|
|
356
|
+
n(y);
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
}, ve = /* @__PURE__ */ m("div", { className: l.card, role: "dialog", "aria-label": "账号", onMouseEnter:
|
|
359
|
+
const N = d.items.find((Ce) => Ce.key === y);
|
|
360
|
+
N && r(N.to);
|
|
361
|
+
}, ve = /* @__PURE__ */ m("div", { className: l.card, role: "dialog", "aria-label": "账号", onMouseEnter: C, onMouseLeave: se, children: [
|
|
362
362
|
/* @__PURE__ */ m("div", { className: l.identity, children: [
|
|
363
363
|
/* @__PURE__ */ s(ue, { nickName: K, member: ae, size: 52 }),
|
|
364
364
|
/* @__PURE__ */ m("div", { className: l.who, children: [
|
|
365
365
|
/* @__PURE__ */ m("div", { className: l.nameRow, children: [
|
|
366
366
|
/* @__PURE__ */ s("span", { className: l.name, title: $ || Y, children: $ || Y }),
|
|
367
|
-
/* @__PURE__ */ s(
|
|
367
|
+
/* @__PURE__ */ s(wn, { state: p })
|
|
368
368
|
] }),
|
|
369
369
|
k ? ne ? /* @__PURE__ */ m(
|
|
370
370
|
b,
|
|
@@ -375,7 +375,7 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
375
375
|
className: l.spaceToggle,
|
|
376
376
|
"aria-expanded": U,
|
|
377
377
|
"aria-label": `当前空间:${X(k)},切换空间`,
|
|
378
|
-
onClick: () => I((
|
|
378
|
+
onClick: () => I((y) => !y),
|
|
379
379
|
children: [
|
|
380
380
|
M(k) ? /* @__PURE__ */ s(ie, { "aria-hidden": "true" }) : /* @__PURE__ */ s(D, { "aria-hidden": "true" }),
|
|
381
381
|
/* @__PURE__ */ s(G, { space: k }),
|
|
@@ -389,8 +389,8 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
389
389
|
] }) : null
|
|
390
390
|
] })
|
|
391
391
|
] }),
|
|
392
|
-
ne && U ? /* @__PURE__ */ s("div", { className: l.spaceList, role: "group", "aria-label": "切换空间", children: h.map((
|
|
393
|
-
const
|
|
392
|
+
ne && U ? /* @__PURE__ */ s("div", { className: l.spaceList, role: "group", "aria-label": "切换空间", children: h.map((y) => {
|
|
393
|
+
const N = y.id === te;
|
|
394
394
|
return /* @__PURE__ */ m(
|
|
395
395
|
b,
|
|
396
396
|
{
|
|
@@ -398,36 +398,36 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
398
398
|
type: "tertiary",
|
|
399
399
|
block: !0,
|
|
400
400
|
className: l.spaceOption,
|
|
401
|
-
"aria-current":
|
|
402
|
-
disabled:
|
|
401
|
+
"aria-current": N ? "true" : void 0,
|
|
402
|
+
disabled: T && !N,
|
|
403
403
|
onClick: () => {
|
|
404
|
-
|
|
404
|
+
N || (z(), Ne(y.id));
|
|
405
405
|
},
|
|
406
406
|
children: [
|
|
407
|
-
/* @__PURE__ */ s("span", { className: l.spaceCheck, children:
|
|
408
|
-
/* @__PURE__ */ s(G, { space:
|
|
407
|
+
/* @__PURE__ */ s("span", { className: l.spaceCheck, children: N ? /* @__PURE__ */ s(Oe, { "aria-hidden": "true" }) : null }),
|
|
408
|
+
/* @__PURE__ */ s(G, { space: y })
|
|
409
409
|
]
|
|
410
410
|
},
|
|
411
|
-
|
|
411
|
+
y.id
|
|
412
412
|
);
|
|
413
413
|
}) }) : null,
|
|
414
414
|
/* @__PURE__ */ s("div", { className: l.plan, children: /* @__PURE__ */ s(dn, { membership: u, onOpen: oe }) }),
|
|
415
|
-
/* @__PURE__ */ s("div", { className: l.links, role: "group", "aria-label": d.label, children: d.items.map((
|
|
415
|
+
/* @__PURE__ */ s("div", { className: l.links, role: "group", "aria-label": d.label, children: d.items.map((y) => /* @__PURE__ */ m(
|
|
416
416
|
b,
|
|
417
417
|
{
|
|
418
418
|
theme: "borderless",
|
|
419
419
|
type: "tertiary",
|
|
420
420
|
block: !0,
|
|
421
421
|
className: l.link,
|
|
422
|
-
"aria-current":
|
|
423
|
-
onClick: () => oe(
|
|
422
|
+
"aria-current": y.key === t ? "page" : void 0,
|
|
423
|
+
onClick: () => oe(y.key),
|
|
424
424
|
children: [
|
|
425
|
-
|
|
426
|
-
/* @__PURE__ */ s("span", { className: l.linkLabel, children:
|
|
425
|
+
y.icon ? /* @__PURE__ */ s("span", { className: l.linkIcon, "aria-hidden": "true", children: /* @__PURE__ */ s(y.icon, {}) }) : null,
|
|
426
|
+
/* @__PURE__ */ s("span", { className: l.linkLabel, children: y.label }),
|
|
427
427
|
/* @__PURE__ */ s(V, { className: l.linkArrow, "aria-hidden": "true" })
|
|
428
428
|
]
|
|
429
429
|
},
|
|
430
|
-
|
|
430
|
+
y.key
|
|
431
431
|
)) }),
|
|
432
432
|
/* @__PURE__ */ s("div", { className: l.divider, "aria-hidden": "true" }),
|
|
433
433
|
/* @__PURE__ */ s(
|
|
@@ -437,9 +437,9 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
437
437
|
type: "tertiary",
|
|
438
438
|
block: !0,
|
|
439
439
|
className: l.logout,
|
|
440
|
-
disabled:
|
|
440
|
+
disabled: S,
|
|
441
441
|
onClick: () => {
|
|
442
|
-
z(),
|
|
442
|
+
z(), f();
|
|
443
443
|
},
|
|
444
444
|
children: "退出登录"
|
|
445
445
|
}
|
|
@@ -465,36 +465,36 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
465
465
|
"aria-label": $ ? `${$},账号菜单` : "账号菜单",
|
|
466
466
|
"aria-haspopup": "dialog",
|
|
467
467
|
"aria-expanded": R,
|
|
468
|
-
loading:
|
|
469
|
-
onMouseEnter:
|
|
468
|
+
loading: T,
|
|
469
|
+
onMouseEnter: we,
|
|
470
470
|
onMouseLeave: se,
|
|
471
471
|
onClick: () => {
|
|
472
|
-
|
|
472
|
+
C(), E((y) => !y), R && I(!1);
|
|
473
473
|
},
|
|
474
474
|
children: /* @__PURE__ */ s(ue, { nickName: K, member: ae, size: 34 })
|
|
475
475
|
}
|
|
476
476
|
)
|
|
477
477
|
}
|
|
478
478
|
);
|
|
479
|
-
}, vn = "
|
|
479
|
+
}, vn = "_upgrade_1dxl7_2", Cn = "_crown_1dxl7_25", Sn = "_text_1dxl7_37", j = {
|
|
480
480
|
upgrade: vn,
|
|
481
|
-
crown:
|
|
482
|
-
text:
|
|
481
|
+
crown: Cn,
|
|
482
|
+
text: Sn
|
|
483
483
|
}, jn = () => {
|
|
484
484
|
const { config: e } = g(), t = J(), { state: n, canBuy: a } = ke();
|
|
485
485
|
if (!a || n.kind !== "free" && n.kind !== "team-expired") return null;
|
|
486
486
|
const o = n.kind === "team-expired" ? "续费团队版" : "开通会员";
|
|
487
|
-
return /* @__PURE__ */ m(b, { theme: "light", type: "tertiary", className: j.upgrade, onClick: () => t(
|
|
487
|
+
return /* @__PURE__ */ m(b, { theme: "light", type: "tertiary", className: j.upgrade, onClick: () => t(w(e.routes.app, "subscription")), children: [
|
|
488
488
|
/* @__PURE__ */ s("span", { className: j.crown, "aria-hidden": "true" }),
|
|
489
489
|
/* @__PURE__ */ s("span", { className: j.text, children: o })
|
|
490
490
|
] });
|
|
491
|
-
},
|
|
492
|
-
wallet:
|
|
493
|
-
coin:
|
|
494
|
-
value:
|
|
491
|
+
}, Tn = "_wallet_e6uma_2", An = "_coin_e6uma_25", xn = "_value_e6uma_32", Q = {
|
|
492
|
+
wallet: Tn,
|
|
493
|
+
coin: An,
|
|
494
|
+
value: xn
|
|
495
495
|
}, Qn = () => {
|
|
496
|
-
const { accountApi: e, config: t } = g(), { session: n } = F(), a = J(), o = (n == null ? void 0 : n.activeSpaceId) ?? "",
|
|
497
|
-
queryKey: L.wallet(o,
|
|
496
|
+
const { accountApi: e, config: t } = g(), { session: n } = F(), a = J(), o = (n == null ? void 0 : n.activeSpaceId) ?? "", r = (n == null ? void 0 : n.globalUserId) ?? "", d = x({
|
|
497
|
+
queryKey: L.wallet(o, r),
|
|
498
498
|
queryFn: () => e.getWallet(),
|
|
499
499
|
enabled: !!n,
|
|
500
500
|
refetchOnWindowFocus: !0
|
|
@@ -508,7 +508,7 @@ const Ue = "_trigger_cxn03_6", Ke = "_avatarWrap_cxn03_27", qe = "_avatar_cxn03_
|
|
|
508
508
|
type: "tertiary",
|
|
509
509
|
className: Q.wallet,
|
|
510
510
|
"aria-label": d.data ? `积分 ${u}` : u,
|
|
511
|
-
onClick: () => a(
|
|
511
|
+
onClick: () => a(w(t.routes.app, "points")),
|
|
512
512
|
children: [
|
|
513
513
|
/* @__PURE__ */ s("span", { className: Q.coin, "aria-hidden": "true" }),
|
|
514
514
|
/* @__PURE__ */ s("span", { className: Q.value, children: u })
|
|
@@ -521,7 +521,7 @@ export {
|
|
|
521
521
|
ht as B,
|
|
522
522
|
Un as C,
|
|
523
523
|
Fn as D,
|
|
524
|
-
|
|
524
|
+
St as E,
|
|
525
525
|
Y as F,
|
|
526
526
|
Rn as G,
|
|
527
527
|
X as H,
|
|
@@ -542,24 +542,24 @@ export {
|
|
|
542
542
|
dn as d,
|
|
543
543
|
jn as e,
|
|
544
544
|
L as f,
|
|
545
|
-
|
|
546
|
-
|
|
545
|
+
w as g,
|
|
546
|
+
ft as h,
|
|
547
547
|
pn as i,
|
|
548
548
|
Et as j,
|
|
549
549
|
Wn as k,
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
550
|
+
Nt as l,
|
|
551
|
+
At as m,
|
|
552
|
+
xt as n,
|
|
553
553
|
Mn as o,
|
|
554
554
|
_t as p,
|
|
555
555
|
M as q,
|
|
556
|
-
|
|
556
|
+
yn as r,
|
|
557
557
|
Z as s,
|
|
558
558
|
It as t,
|
|
559
559
|
O as u,
|
|
560
|
-
|
|
560
|
+
Ct as v,
|
|
561
561
|
qn as w,
|
|
562
562
|
Kn as x,
|
|
563
|
-
|
|
563
|
+
wt as y,
|
|
564
564
|
H as z
|
|
565
565
|
};
|